home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!cs.ucf.edu!schnitzi
- From: schnitzi@cs.ucf.edu (Mark Schnitzius)
- Subject: Re: How to decide if a point is inside a polygon?
- Message-ID: <schnitzi.715032142@eola.cs.ucf.edu>
- Sender: news@cs.ucf.edu (News system)
- Organization: University of Central Florida
- References: <7121@bigbird.hri.com.hri.com> <schnitzi.714934670@eola.cs.ucf.edu> <1992Aug27.153902@is.morgan.com> <schnitzi.715017774@eola.cs.ucf.edu> <1992Aug28.134203@is.morgan.com>
- Date: Fri, 28 Aug 1992 20:02:22 GMT
- Lines: 25
-
- berlin@is.morgan.com (Alexander Berlin) writes:
- >| I write:
- >|> Well, one solution to this problem is this: consider each vertice of the
- >|> polygon as belonging to only _one_ of the line segments it is connected to.
- >|> So in the above example, only consider point C to be on the line segment
- >|> BC and not on AC. Then if the line you're drawing goes through point C,
- >|> it is only considered to have gone through line segment BC and not AC.
- >|> This simple fix should clear up any problems.
-
- >No, it doesn't. I didn't say that the line drawn from point X has one or two
- >crossings. My point is that X-line and Y-line have the same number of crossings
- >(be it 1 or 2) while X is outside and Y is inside. The fix you suggest doesn't
- >distinguish X- and Y- cases in my example.
- >The rule that would work is to check if AC and CB segments are on the same
- >side of the line (2 or 0 crossings, case X) or on the different sides
- >(1 crossing, case Y). But I think it is much better to just avoid these
- >confusing cases.
-
- You are right; sorry, I misunderstod your earlier point. So how can we
- get this to work for all cases? Just find a direction to extend the
- infinite line that doesn't intersect any vertices?
-
- Mark Schnitzius
- schnitzi@eola.cs.ucf.edu
- University of Central Florida
-