Re: Point inside a polygon?
- To: mathgroup at smc.vnet.net
- Subject: [mg25426] Re: Point inside a polygon?
- From: Avi Mintz <Avi.Mintz at nsc.com>
- Date: Fri, 29 Sep 2000 01:07:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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 polygon) - 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 avi