Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 1
    $\begingroup$ I don't believe Mathematica has a build-in function for this. You could build your own in which case this is a good starting point: point in polygon $\endgroup$ Commented Aug 14, 2012 at 8:39
  • $\begingroup$ Perhaps this answer by Heike? $\endgroup$ Commented Aug 14, 2012 at 8:49
  • 2
    $\begingroup$ It's pretty depressing that you already accepted an answer before I posted mine, but I posted anyway. :-/ $\endgroup$ Commented Aug 14, 2012 at 10:02
  • 4
    $\begingroup$ The best answer to this question depends on the intended use and other constraints. The most important determinants are (1) whether this will be a one-off test or if many points will be tested for a given polygon; (2) where the points are likely to fall; and (3) whether the test needs to be absolutely accurate. Except for the one-off accurate test, by far the fastest method--and one not yet offered in any answer--is to rasterize the polygon's interior, probe the raster at the point's location (a $O(1)$ operation), and revert to a more expensive test only if the probe is inconclusive. $\endgroup$ Commented Aug 14, 2012 at 17:52
  • 4
    $\begingroup$ The various responses are quite good. That said, if you have to test many points and the polygon has many vertices, the method indicated at this link should be fairly efficient. forums.wolfram.com/mathgroup/archive/2009/Feb/msg00519.html $\endgroup$ Commented Aug 14, 2012 at 21:10