Subtraction two trees?

Hi Everyone, I am new to Grasshopper and I am trying to subtract two trees with branches. I post them below:

Simply the first panel, A, consists of two branches. The second panel, B, consists of 30 branches (all zero values). If we use A - B component, we get the third panel. I realized that the {0;0;0} in third panel gives 15.11 and the others {0;0;1} … {0;15;1} is 12.70. Why does Grasshopper subtracts only once {0;0} in panel A and then subtract 29 times {0;1} in panel A? I hope this is clear. Actually, I don’t understand how operations are done between branches from different trees? Thank you so much

Hi,

Branch numbers don’t matter when components have their inputs as item.
So Grasshopper associated the first branch of A to the first branch of B.
Then, the second branch of A to the second branch of B.
And then, there are 28 remaining branches in B but no matching branch in A, so Grasshopper uses the last branch of A.

You need to use Trim Tree on B.

Thank you magicteddy! It is now clear what’s happening. However, I don’t want to trim B. I want to subtract in alternating way, I mean:

  1. The first one in B {0;0;0} to subtract {0;0} in A
  2. The second one in B {0;0;1} to subtract {0;1} in A
  3. The third one in B {0;1;0} to subtract {0;0} in A
  4. The fourth one in B {0;1;1} to subtract {0;1} in A
  5. The fifth one in B {0;2;0} to subtract {0;0} in A
  6. The sixth one in B {0;2;1} to subtract {0;1} in A
    etc … Is that possible?

You’ll have to repeat the branches of A I’m afraid.

AMinusB.gh (17.3 KB)

1 Like