Sort List of Adjacent Points into Polygon

时间:2015-06-25 18:39:54

标签: c++ geometry polygon

I have a list of points (x, y) that represent the outline of a polygon and are not in any specific order (for example, if we have the rectangle ABCD, the list of points could be something like DACB). In the attached image, the blue shape is the polygon, the points in the list are black and the red line is what correct order of the points should be when sorted. So, the question is, how could I go about sorting this list into one that represents the outline of the polygon in clockwise or counterclockwise order?

0 个答案:

没有答案