Sort points around clockwise

How to sort points around clockwise?

sort points around center 01.gh (19.9 KB)

Convex hull is an option. However, the radial sort component is better (see also the example file for better understanding.

Looks like you tried to sort the points twice

sort points around center 01_sg.gh (13.6 KB)

2 Likes

I have a strange problem trying to sort points clockwise whilst using a plane in the angle component. It works using the Y axis of the plane, but not the X as desired. If I disconnect the plane from Angle and use X it works, but the ‘left’ and ‘right’ will need a separate sort as they can be mixed up. sort points clockwise problem.gh (69.0 KB)

@mattm don’t know exactly why there is difference with using the X or Y vector. It could be because of minor differences in rounding but that’s just a guess. I haven’t dug into it deeply but I see that the angles between the vectors are not 0,90, 180, 270 but are slightly off from that. Did you generate the surfaces from a grasshopper script as well?
Other than that what’s your intended goal with sorting the surfaces? Maybe it can be solved differently, maybe even before sorting, you can make the script such that you don’t even need the sorting if you keep the data ordered from the very beginning.