Calculating the right distances between two trees

Dear all,

I have a list of red points and a list of green points. If I want to get the two closest points of each red point, I would GRAFT the list of red points and calculate the distance with the FLATTEN list of green points. Eventually I would sort and split.

However I don’t know how to make the lists work together when I have a tree of red points and a tree of green points. I have too many branches to explode them and do it manually. In the attached image, it shows that I would like to compare the red points from the purple box with the green points from the purple box. In other words, I want to make the list starting with {1200;0;x } work together with just {1200;0}.

Would someone help me with this ?

Thank you ! (11.9 KB)

Does the “Closest Points” component not solve this?

@rheinason yes it does!
Line is just for illustration purposes :wink: (10.2 KB)

Oh thanks, I didn’t know that component. But I am still wondering about making the list work together ?

I’m not sure what you mean by making the list work together. @Amir_Touhidi’s example includes a Trim Tree to reduce the list from A;B;C to A;B?