How to sort points to get closed polyline?

How to sort points to get closed polyline.
Here is attached file with two examples, looking forward to some efficient suggestions.

PointQuestion_Sorting.gh (9.4 KB)

Does this work for you?

PointQuestion_Sorting-b.gh (8.2 KB)

2 Likes

this is perfect exactly what I was looking for, thanks