home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / programm / 2527 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.8 KB  |  37 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!cs.ucf.edu!schnitzi
  3. From: schnitzi@cs.ucf.edu (Mark Schnitzius)
  4. Subject: Re: How to decide if a point is inside a polygon?
  5. Message-ID: <schnitzi.715032142@eola.cs.ucf.edu>
  6. Sender: news@cs.ucf.edu (News system)
  7. Organization: University of Central Florida
  8. 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>
  9. Date: Fri, 28 Aug 1992 20:02:22 GMT
  10. Lines: 25
  11.  
  12. berlin@is.morgan.com (Alexander Berlin) writes:
  13. >| I write:
  14. >|> Well, one solution to this problem is this: consider each vertice of the
  15. >|> polygon as belonging to only _one_ of the line segments it is connected to.
  16. >|> So in the above example,  only consider point C to be on the line segment
  17. >|> BC and not on AC.  Then if the line you're drawing goes through point C,
  18. >|> it is only considered to have gone through line segment BC and not AC.
  19. >|> This simple fix should clear up any problems.
  20.  
  21. >No, it doesn't. I didn't say that the line drawn from point X has one or two
  22. >crossings. My point is that X-line and Y-line have the same number of crossings
  23. >(be it 1 or 2) while X is outside and Y is inside. The fix you suggest doesn't
  24. >distinguish X- and Y- cases in my example.
  25. >The rule that would work is to check if AC and CB segments are on the same 
  26. >side of the line (2 or 0 crossings, case X) or on the different sides 
  27. >(1 crossing, case Y). But I think it is much better to just avoid these
  28. >confusing cases. 
  29.  
  30. You are right; sorry, I misunderstod your earlier point.  So how can we
  31. get this to work for all cases?  Just find a direction to extend the
  32. infinite line that doesn't intersect any vertices?
  33.  
  34. Mark Schnitzius
  35. schnitzi@eola.cs.ucf.edu
  36. University of Central Florida
  37.