In my script I have two lists, consisting of sublists, which I want to compare with the Geometry.DistanceTo node. My first list contains sublists of points and my second list contains sublists of lines.
I would like to compare each point from sublist 0 against each line in sublist 0 to measure it’s distance, and also for each other list only the other corresponding sublist:
I’ve managed to get the desired results I want by first flatting the list with all my lines and then compare each point against each line (so 6 comparisons instead of 2 for each point).
At this scale with only 12 points and 6 lines it doesn’t really matter, but in my main script I can easily have over 50.000 points and 1000 lines so I would really like to only compare sublists.
I would really appreciate it if you guys could see if you can manage to only do the comparison within the respective sublists .
You usually can’t combine list levels and lacing like this unless a node is already built for specific list inputs (not just recursion). Whenever list structure gets specific like this your best bet is always to match list length and structure. Duplicate each line by the number of points in the respective sublist and do the same to points. That way you end up with a one-to-one comparison of points and lines.