Connecting the end and start of vertical lines by proximity

if you are are fascinated by looking at stuff while it iteratively happens on screen as much as I am, here is a sort of Anemone looping thingy that does not produce very useful results but is nice to watch :rofl:

before the loop starts, points are Jittered

you can chose how many iterations to do (iterations = number of tries, not necessarily {and very not probably} number of final connection lines it will produce)… so the name on the slider “total lines” is just plainly wrong… it’s “number of iterations”, sorry for that

you can chose how many iterations the loop will be forced to search for only “horizontal” lines {same Z} (let’s call this A)

then, each iteration, it takes the first point of the list (which is Jittered) and will look for its closest neighbor (if Count <= A the search happens at the very same Z, if Count >A can be any Z {also same Z, but not necessarily} )

once a closest point is found, it considers that candidate line and checks two things:

  1. if that candidate line intersect any previously created connection line
  2. if that candidate line is shorter or equal to the value set on this slider circled in red:

if both checks are passed, then the candidate line goes into the final list of connection lines D1, and the start/end point of that line are removed from the list of available points to be processed on next iterations (so the start/end point of this candidate lines that becomes final are both not available to receive connections anymore: 1 point = maximum 1 line)

if one or more check fails, the candidate line is discarded, and that start-point is moved at the end of the list for next iterations
{now that I think about that… meh, it doesn’t make much sense, because if it didn’t find a closest point with the right features now with n point remaining, then looking for it later with n or “less than n” available points won’t produce any effect… but hey, that’s matter for another day :slight_smile:

I just like so much looking at my screen that does things on its own :rofl: maybe it’s somehow inspiring to you

perpendicular_lines_proximity_weird_loop.gh (30.9 KB)

1 Like