home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!cs.ucf.edu!schnitzi
- From: schnitzi@cs.ucf.edu (Mark Schnitzius)
- Newsgroups: comp.programming
- Subject: Re: How to decide if a point is inside a polygon?
- Message-ID: <schnitzi.714934670@eola.cs.ucf.edu>
- Date: 27 Aug 92 16:57:50 GMT
- References: <7121@bigbird.hri.com.hri.com>
- Sender: news@cs.ucf.edu (News system)
- Organization: University of Central Florida
- Lines: 16
-
- mps@sparc68.hri.com (Mark Stockley) writes:
-
- >I am in need of an algorithm to compute whether or not a given
- >point exists within or without a polygon. Any help or pointers to
- >where to look would be much appreciated.
-
- If I remember right the trick is to extend a line from the point
- infinitely in any direction (say, up). Count how many of the
- polygon's edges this line passes through. If it passes through
- an even number of polygon edges (including zero) the point is
- outside of the polygon. An odd number indicates the point is
- inside the polygon.
-
- Mark Schnitzius
- schnitzi@eola.cs.ucf.edu
- University of Central Florida
-