Hello ! i am trying to order a group of curves either clockwise or counterclockwise, i tried many solutions that i found in the Grasshopper Forumss and it worked only in the cases where the curves were closed. my question is if there a way to order not closed curves clockwise or counterclockwise?
Sorting curves clockwise.3dm
very appriated for any hint
P.S. Oops, if you want “clockwise direction” just reverse the resulting list.
Thank you so much @Joseph_Oster. this is exactly what i was looking for. just i have a question do you think its possible that the vector’s direction follow this sequence as well ?
@Baris posted the same solution before I did.
Vectors, what vectors? Your eight line fragments don’t touch each other, is that a concern?
by mistake i skipped your solution. Thank you so much, it worked perfectly @Baris
Hi Joseph, it mattars for me because i am looking for getting at the end two lists the first one contains the current line’s direction and the other one that contains the clockwise direction for each line to compare between them to get line which has an oppisite dirction of clockwise.
These vectors? Green group (in white group), along with corresponding line segments.
Sketchy though when so many line fragments don’t meet. Feels like a mistake?
this soultion is great. Unfortunately the curves looks like that and they should not be attached to each other this way it made it complicated. i was just wondering why the lines cant be sperated lines after by explode?
There is nothing to explode, they are all just plain simple lines, not polylines.
This solution is prone to error.
This solution sorts along a circumscribed circle and appears to be more robust?
P.S. Stretching the top-left and top-right line segments demonstrates that version ‘c’ is indeed more robust than version ‘b’, which is bad! (as I suspected) No code changes, only the internalized lines.
sort_edges_2021_Jul8bb.gh (18.5 KB) BAD!
(20.7 KB) GOOD? (NO! ALSO BAD!!)
P.P.S. Well, well, the circumscribed circle makes no difference at all. I didn’t notice that the vertical lines/vectors on the left and right both have the same direction, which is wrong!
I don’t know the answer to this?