Ask HN: Finding a polygon given a list of random coords?
Help.
Is there any way of finding a polygon that would contain all of a given list of points? without any intersections.
I'm hoping to use it in an app built on Google's Maps API v3. Any help/links would be much appreciated.
(
9 comments
| 4 points
| on HN
)
Graphically:
http://en.wikipedia.org/wiki/Convex_hull_algorithms
Alternatively, willvarfar's approach is faster for large n, but the polygon won't be as pretty.
If you need to restrict yourself to following streets on the map, it might be a bit trickier...
http://opencv.willowgarage.com/documentation/cpp/structural_...
cv::convexHull