Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get the perimeter of a 2D set of points

I have a set of points in 2D ( coordinates for x and y ), now I need to discard all the points that are not meaningful to me, and what I mean by that is that I'm only interested in the area that this points are tracing.

In short, this

enter image description here

it's supposed to produce this

enter image description here

question: what algorithm can do this kind of filtering on this points ?

like image 427
pgf Avatar asked Jan 14 '23 19:01

pgf


1 Answers

You can use Graham Scan to compute Convex hull of the given points. Once you have all the points on the convex hull you can eliminate the others.

There are other algorithms as well for computing convex hull, but Graham scan is easy to implement and is O(n logn).

like image 156
vidit Avatar answered Jan 19 '23 08:01

vidit