A simple solution is to walk along the edge of the polygon. Given the current edge of the bounded connecting points P0 and P1, the next point on the boundary of P2 will be the point with the smallest possible A, where
H01 = bearing from P0 to P1 H12 = bearing from P1 to P2 A = fmod( H12-H01+360, 360 ) |P2-P1| <= MaxEdgeLength
Then you install
P0 <- P1 P1 <- P2
and repeat until you return to where you started.
This is still O (N ^ 2), so you want to sort your list a bit. You can limit the set of points that must be taken into account at each iteration if you sort the points, say, their supports from the city center.
Mike F Sep 17 '08 at 14:42 2008-09-17 14:42
source share