Hello! I am trying to use Anemone to loop through a set of points, finding the closest point pairs, and drawing a line between them. Then I want to take the midpoints of those lines, and repeat the process.

The problem I am having is how to switch the looping from the original random points (the pop 3d component) to looping the new set of points (points produced by the evaluate curve component). I have tried to figure this out with a nested loop, but I had trouble with that and am not sure thatâ€™s the right way anyways.

The way it works is if I create 16 points, 8 lines are created between the closest neighboring pairs. Then I want the midpoints of those lines (8 points), and create 4 lines between them. Then I want the midpoints of those lines (4 points), and create 2 lines between them. Then I want to create the last line between the last 2 midpoints.

However I would like this to work for any even amount of points, or any amount of points. But I am not even sure if it can work if it isnâ€™t an n^2 amount of points. (IE 32 points creates 16 lines creates 8 lines creates 4 lines creates 2 lines creates 1 line) If it is 60 points it would start with 30 lines, then 15 lines, then what? 15/2=7.5â€¦

I actually did get the result I wanted by copying+pasting the anemone loop and feeding the output into it as you can see here:

but obviously this is not a real solution, as it means I need to add or take away whole loops based on the original amount of points. (The amount of copy+pasted loops = sqrt(number of original points) ie. 16 points requires 4 loops. Iâ€™m pretty sure.)

There must be a way to do this without copying+pasting! I have attached both .gh files pictured here and would greatly appreciate any help on this problem. If anyone needs any further info from me I will provide it.

James Looping Problem.gh (9.9 KB)

James Looping Problem Anemone manually looped_not a scalable solution.gh (20.3 KB)