Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Point inside a polygon?

  • To: mathgroup at
  • Subject: [mg25426] Re: Point inside a polygon?
  • From: Avi Mintz <Avi.Mintz at>
  • Date: Fri, 29 Sep 2000 01:07:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Adriano Moreira wrote:
> Hi,
> I need a routine to check if a point is inside or outside a polygon
> (simple polygon non self-intersecting).
> Any help appreciated.
> Adriano Moreira

that is a "famous" question for interviews of new imployees.

take a straight line from the point to infinity (or at least beyond the
 - it is usually best if that line is parralel to one of the axis
then count how many times the new line intersects with lines of the
polygon - an even number means its outside,
an odd number means its inside


  • Prev by Date: Re: extracting elements from a list?
  • Next by Date: Re: extracting elements from a list?
  • Previous by thread: extracting common items from a list
  • Next by thread: InequalitySolve?