Connect all point pairs on a branch

Hi! This issue seems extremely basic, but I haven’t been able to find a solution to it and it has been driving me crazy.

I’ve been trying to connect all possible point pairs within each data tree branch. I managed to do it with the explode tree component, but this would require too much manual adjusting in case I wanted to add more branches. Does anybody have an idea on how to fix this? Connecting points with their grafted copy ended up in a complete mess. I would be very grateful for some guidance.



point_pairs_on_branch.gh (15.9 KB)

I think what you want is “Cross Reference” in “Upper Triangle Strict” mode.


Cross reference finds the “list cross product” of two or more lists, so if you feed it A,B,C into the first input, and 1,2,3,4 into the second, you’ll get this:
image
That’s the default “Holistic” mode, which matches every item in A to every item in B.

Upper Triangle Strict is useful when you’re feeding the same list into A and B — “Upper triangle” means if it pairs index 1 with index 2, it won’t pair index 2 with index 1 (so in your case, you won’t get duplicate lines.) “Strict” means it won’t pair items at the same index with each other (it won’t match index 3 with index 3) so you avoid trying to create a line between any point and itself. So in upper triangle strict, with “A,B,C,D” fed into both inputs, you get:
image
Note how “B / B” is not a pair, and because we have “B / C” we don’t also have “C / B.”

Hope that helps!

4 Likes


point_pairs_on_branch_2020Jun13a.gh (21.1 KB)

Thank you both and I’m terribly sorry for the late reaction. As always, @andheum, you’re a rockstar! Such a clean solution, I wasn’t familiar with Cross Reference component, but I see how it can be applied in other cases as well. Once again, thank you!

1 Like