I have polygon and its vertices represented with randomly shuffled 2d points, how can I find the correct order?
In correct order I mean order so that segment between P[i] and P[(i + 1) % n] is a side of polygon.
Or if this is hard, how to solve it for 4 sides?
I'm looking for an efficient solutions. Many thanks.