views:

263

answers:

1

This polygon could be shaped like a C

I tried the formula located here http://stackoverflow.com/questions/217578/point-in-polygon-aka-hit-test

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

+2  A: 

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 http://stackoverflow.com/questions/240778/random-points-inside-a-polygon

Martin Beckett