Cross-Referencing Data Trees

Hello everybody!

Topic data trees is always big question for me to understand fully

I wanted to archive something

In the first picture (quite easy) I have 2 hexagon and I can draw lines between the midpoints of both hexagons and choose the shortest or longest one (with all possibilities)


But in the second picture (It is the question I couldn’t solve) now I have something more confused. I have in total 4 curves and from these curves I created hexagons again I wanted to do same thing with my first example. Draw lines from the midpoints of each opposite hexagon sides and find the shortest or longest one.

Of course I cound find these lines with easier ways. I wanted to study, when there were simple trees, it was easy to do it; now that there are more complex trees, can I still do it using the same logic?

Question 01.gh (12.5 KB)
Question 01.3dm (38.5 KB)

I guess you need to graft one tree branch, so that each branch with one point get 6 points in one branch.

Already tried:) doesnt work..

You can do something like this:

The Relative Item component lets you shift indices in the path using the Offset (O) input. Each number in O corresponds to one level of the branch path.

Here we want to reference branch {0;0;0;0} with the mid points from the left-side hexagons with {0;1;0;0} which has the rights side midpoints.

Once we have the two separate sides, we can use Cross Reference for pairwise cross-connection only within matching branches. Because of how the data is neatly sorted, Grasshopper now performs the cross reference inside each branch only.

Question 01-re.gh (19.0 KB)

2 Likes

Yes! That is exactly what I wanted!
thank you very much!

Another option is to graft the list with the length of 6 items to get one item each list and on the counterpart repeat the list 6 times to get 6 items each list, but cross refernce seams more elegant.

1 Like

Waow, your work is also quite interesting!
Yes cross reference command exactly fits to that example but in your work I can see how can we play with data.. Now I am trying to understand what the command repeat data is doing:)
Thank you!

That only works with single branches. With multiple branches, the grafted indices start matching with the other branches instead a repetition of the branch you want. You can get around it as you have, or by grouping the geometry of one stream, grafting the geometry of the other stream and then using longest list:

This is a trick I learned today from @Fabio_Franchetti . Otherwise, cross referencing as @diff-arch has is the “proper” way.

2 Likes

Thats a funky solution, very cool :smiling_face_with_sunglasses: