# 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

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

I just like so much looking at my screen that does things on its own maybe itâ€™s somehow inspiring to you

1 Like