Mel
Mel

Reputation: 2075

Find a point in a complex polygon

This polygon could be shaped like a C

I tried the formula located here How can I determine whether a 2D Point is within a Polygon?

however it doesn't actually correctly predict if the point is in the polygon.

Upvotes: 2

Views: 1661

Answers (1)

Martin Beckett
Martin Beckett

Reputation: 96157

Easiest way - especially for lots of points is to triangulate the polygon then do a point in triangle test.
You could convert the polygon into a set of convex polygons but that is trickier.

See also Random points inside a 4-sided Polygon

Upvotes: 2

Related Questions