MathGroup Archive 2000

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

Search the Archive

RE: Point inside a plygon?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25398] RE: [mg25239] Point inside a plygon?
  • From: torres <torres at morgon.lmt.ens-cachan.fr>
  • Date: Fri, 29 Sep 2000 01:06:34 -0400 (EDT)
  • Organization: ENS Cachan, France
  • References: <8qhmln$ivh@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

   Hi, we can know if a point is inside a polygon using the following
calculation...  It works for right or left ordered polygons (it changes
the sign of I)

   Denoting by P the point and V_i the set of N vertex of the polygon, we
can calculate the following 

   I = Sum( angle(V_(i+1)-P, V_i-P), i=1..N-1) + angle(V_N-P,V_1-P)

if I != 0 then P is inside the polygon.  If P == 0 the P is outside. 

   with angle returning a value in ]-Pi,Pi] or ]-180,180].

   This is a discrete form of a Gauss integral (from complex calculus)

   I hope this helps....

	Rafa

Rafael Torres Carot
rtorres at onera.fr	torres at lmt.ens-cachan.fr
Spanish PhD Student en el extranjero




  • Prev by Date: Re: extracting elements from a list?
  • Next by Date: StringQ?
  • Previous by thread: RE: Point inside a plygon?
  • Next by thread: Re: Point inside a plygon?