views:

130

answers:

4

I have a list of (about 200-300) 2d points. I know needs to find the polygon that encloses all of them. The polygon has to be convex, and it should be as complex as possible (i.e. not a rectangular bounding box). It should find this in as low as possible time, but there are no restrictions on memory.

You may answer in pseudocode or any language you want to use.

+5  A: 

Take a look at Graham's Algorithm.

zebrabox
+13  A: 

Sounds like you're looking for a convex hull algorithm? It's been more than a decade since I was taught about these, but the name Graham Scan sticks in my mind and would probably be where I'd start.

crazyscot
A: 

If it is a real world problem - as in, not an academic one - there's never really a reason to solve such a generic problem yourself.

Ofek Shilon
+1  A: 

Qhull is good software for computing 2D convex hulls.

Suresh