Tree/Tree Interaction

Hi,
I have a recurring issue where I am trying to have two trees that I am trying to do operations on with different tree structures. In the attached file I have it set up so one tree has a line in branches {0}, {1}, {2} then a set of points in {0;0;0}, {0;0;1}…{2;2;2}. I want the points in {0;B;C} to relate to the line in {0}, etc to do a closest point operation in this instance. The primary difference between this file and when I encounter this problem in the wild is that the list of points are not the same lengths.

I have two solutions included which work but feel a little clumsy/workaroundy and are just fine/adequate. However, it feels like there should be a cleaner solution which I would greatly appreciate any help in finding.

TreeTreeInteraction.gh (31.0 KB)

Hi @gordonleibowitz
If you want to sort the points according to the closest line line you can use “closest point”.
You have to use the tree structure in the right way. “Member index” will help you here.

TreeTreeInteraction.gh (10.8 KB)

Hi Erik,
That is not what I am trying to achieve. It’s more like I need to know the distance from all the points in {0;B;C} to the curve in {0}, the points in {1;B;C} to the curve in {1} etc.
In my solutions I have to either trim the point tree to match the line tree and then partition the points based on the list lengths or create a list of duplicated lines so that each point in the tree can go 1 to 1 with the lines. Either of these work, but I think there must be a cleaner we to achieve this.

Hi,

Unflatten Tree will save you here.
You can also trim 2 levels at once, don’t need two components.

1 Like

I think Propagate Ancestors might also help, Duplicate objects from ancestral data structure to match a more mature data set

[edit: just found out Propagate Ancestors comes with TreeSloth plugin]

That’ll do it.
Yeah i was only using two trim trees to get the list lengths for the subsequent multiple partitions.
This is analogous to the countless years where I was using path mapper to do trim tree then someone showed me trim tree.

I’ll have to give that plugin a go, seems like lots of useful data management tools.