home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!pipex!warwick!pavo.csi.cam.ac.uk!camcus!gjm11
- From: gjm11@cus.cam.ac.uk (G.J. McCaughan)
- Subject: Re: Polygon point enclosure
- Message-ID: <1992Aug26.235700.16224@infodev.cam.ac.uk>
- Sender: news@infodev.cam.ac.uk (USENET news)
- Nntp-Posting-Host: bootes.cus.cam.ac.uk
- Organization: U of Cambridge, England
- References: <7122@bigbird.hri.com.hri.com>
- Date: Wed, 26 Aug 1992 23:57:00 GMT
- Lines: 10
-
- In article <7122@bigbird.hri.com.hri.com>, mps@sparc68.hri.com (Mark Stockley) writes:
-
- > I'm looking for a method to determine if a point is enclosed
- > by a polygon. Any help would be greatly appreciated.
-
- Well, here's one approach. Imagine a ray (=half-line) coming off from the point
- in some direction. Count how many of the sides of the polygon it goes through.
- (If it goes *along* any of those sides you're in trouble and should try another
- direction.) If it's an odd number the point is inside the polygon; if it's an
- even number the point is outside the polygon.
-