I have a set of points with x and y coordinates that can be seen in the figure below. The coordinates of the 9 points were stored in a list as follows:
Sorting by angle is not enough
We should sort points lexicographicallly by polar angle and distance from origin
We sort by polar angle and in case of a tie we sort by a distance from origin