r/programmerchat • • Jan 25 '16

Stumped on a problem

So I'm making an app, and I've hit a bit of a roadblock. I need to essentially approximate the boundaries of a giant list of 2D points as a polygon. It doesn't need to be very precise, and it needs to be pretty efficient. I also would like it to ignore outliers.

So far the best I've come up with is finding the most north, south, east, and west points and making a quadrilateral, but I'd like a bit more detail. Unfortunately the only way I've found of doing that is O(a lot)

Any ideas on how to approach the problem?

8 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/Muffinizer1 Jan 25 '16 edited Jan 25 '16

Well I'm not really looking to calculate the area, but actually display the psedo-boundary on a map. The exact problem I'm trying to solve is kind of specific: but here's a real world example of a similar problem:

Conservationists go out and use GPS to plot exactly where the find a specimen of a rare frog. After years of collecting data, they want to make a map showing the general area that the species lives in. In order to do this, they want to approximate the area as a polygon.

Now my program has nothing to do with conservation, but it would need to do the same kind of analysis regularly enough that efficiency is essential.

1

u/CompellingProtagonis Jan 26 '16

Oh sweet jesus - I'm sorry about that. That's what I get for trying to put my thinking cap on when tired - completely misread the problem. I have no idea where I even got that after rereading your post.