Does anyone know if there's an algorithm for this? I have several 2D points. I need to find a list of points that when you draw a line from point n to point n+1 you end up with an area that contains all the points. If I could attach an image, I could explain myself better. Thanks in advance.
+7
A:
What you are looking for is probably the convex hull. Wikipedia has a picture. There are several algorithms to compute the convex hull. The Graham scan probably provides the best balance between performance and ease of implementation.
Thomas
2009-03-07 23:39:42
The Graham scan looks like what I was looking for, thanks a lot! :D
Pablote
2009-03-08 00:16:42
+3
A:
What you are asking for sounds like what's called the convex hull. Google that for lots of information.
If the points don't have to be members of the set, just find the bounding box.
If the collection doesn't have to be convex, just find the center of mass of the cloud, order the points (say, clockwise) around this, and you'll have an irregular star.
MarkusQ
2009-03-07 23:40:48
A:
If you are coding in C/C++ (or understand them) this is an excellent source of geometry algorithms - both source and explanation.
Martin Beckett
2009-03-08 01:12:23