MathGroup Archive 2000

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

Search the Archive

RE: Point inside a plygon?

  • To: mathgroup at
  • Subject: [mg25398] RE: [mg25239] Point inside a plygon?
  • From: torres <torres at>
  • Date: Fri, 29 Sep 2000 01:06:34 -0400 (EDT)
  • Organization: ENS Cachan, France
  • References: <8qhmln$>
  • Sender: owner-wri-mathgroup at

   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....


Rafael Torres Carot
rtorres at	torres at
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?