Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: testing if a point is inside a polygon

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96429] Re: testing if a point is inside a polygon
  • From: mark mcclure <mcmcclur at unca.edu>
  • Date: Fri, 13 Feb 2009 03:45:02 -0500 (EST)
  • References: <gmp0mt$btn$1@smc.vnet.net>

On Feb 9, 5:31 am, Mitch Murphy <mi... at lemma.ca> wrote:
> is there a way to test whether a point is inside apolygon? ie.
>   PointInsidePolygonQ[point_,polygon_] -> True or False

Of course, we can write our own program to do just about
anything we want.  If you want to know whether there is
a built in function "InPolygon", the answer is no.  If
you want to if there are freely available packages that
include this functionality, the answer is yes:
CompG:
http://library.wolfram.com/infocenter/MathSource/5712/
and IMTEK:
http://www.imtek.de/simulation//mathematica/IMSweb/

Curiously, the functionality is clearly "in Mathematica",
it's just not exposed.  You can see that a point in
polygon is implemented by playing with the following:
Graphics[Tooltip[Polygon[
  {{0, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 2}, {0, 2}}],
  "in polygon"]]

In fact, there must be a large computational geometry
library contained in the Mathematica kernel to support
the extensive graphics routines.  Hopefully, that
functionality will be exposed in the not too distant
future.

Mark McClure


  • Prev by Date: Re: Re: Log[x]//TraditionalForm
  • Next by Date: Re: Best syntax for derivative
  • Previous by thread: Re: testing if a point is inside a polygon
  • Next by thread: Re: testing if a point is inside a polygon