# Subtract vector valued attributes from one another if the indicies match?

As part of a bigger project with simulation nodes, I’m trying to figure out how to subtract one set of positions from another. Something like the attached picture (both geometries are cubes with 8 vertices)

. Unfortunately, for the life of me I can’t get it to work.

What results are you seeing with this node setup?

Nothing changed. There’s definitely an offset (which I made sure to apply) on Cube.001, so one would think Cube’s geometry would be translated, but no such luck. I did some googling and found old ‘attribute math’ nodes, which apparently are supplanted by regular vector math nodes doing double-duty. In my setup the inputs/outputs are diamonds, which I believe indicates that they ought to be operating field-wise, but no such luck.

My expectation would be that the values on the right would be subtracted from the values on the left, and replace the values on the left. Here’s hoping there’s something real simple that I’m missing and this is possible.

1 Like

The expectation is that the position that comes from Cube.001 will be 0 in all cases since there is no data “flow”… since the capture terminates on nothing.

Capture only works on the same “flow” and is only needed when domains change (e.g. mesh to spline).

To transfer data from one geometry to another you need to use one of the Geometry → Sample options:

So, for the following network :

The arrows show that the Position will come from Cube.001, but the Index will come from the “hosting” geometry (i.e. Cube). The Index, although “provided” by the indices of Cube, the Sample Index node will attempt to resolve the indices of Cube.001 which works in this case since there is a 1-to-1 mapping as the geometries have the same number of vertices.

I hope you understand that what you’re trying will not make anything interesting:

…Every position of a offset cube subtracted from another position of a similar cube will just result in a 0-dimetion “cube”… since every point is the same distance from it’s equivalent point.

Good luck.

5 Likes

YES! Thank you, this is exactly what I was looking for. I had figured out that I was reading 0 vectors the way I was doing it, but I couldn’t figure out why. I was banging my head against the proverbial wall trying various combinations for two hours.

And yes, the cubes are uninteresting. My full setup has a bunch of other stuff going on that would have obscured the core part of the question I was asking.

1 Like