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

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!s5!is1.is.morgan.com!is.morgan.com!berlin
  3. From: berlin@is.morgan.com (Alexander Berlin)
  4. Subject: Re: Deciding point-in-polygon: A new idea
  5. Message-ID: <1992Aug31.153324@is.morgan.com>
  6. Sender: news@is.morgan.com
  7. Nntp-Posting-Host: chico
  8. Organization: Morgan Stanley - IS
  9. References: <1992Aug31.083543.27938@olymp.informatik.uni-bonn.de> <schnitzi.715279970@eola.cs.ucf.edu>
  10. Date: Mon, 31 Aug 1992 19:33:24 GMT
  11. Lines: 35
  12.  
  13. In article <schnitzi.715279970@eola.cs.ucf.edu>, schnitzi@cs.ucf.edu (Mark Schnitzius) writes:
  14. |> Confession:  I knew it wouldn't work when I posted it, but I wanted to
  15. |> see if anyone could come up with a way to make it work.  Since then, I
  16. |> came to the realization that this idea WILL work if you add the stipulation
  17. |> that the point must be added in such a way that it will not make any new
  18. |> line crossings, and I believe it is always possible to do so.  Like you
  19. |> said, the only change in sum will depend on (x1,y1), (x2,y2), and (x,y),
  20. |> so after you find the place to add the point (which is where the complex-
  21. |> ity comes in), you only need to check to see if
  22. |> 
  23. |>   (x1*y2-x2*y1) > (x1*y-x*y1)+(x*y2-x2*y)
  24. |> 
  25. |> If this inequality is true, the point is inside the polygon.
  26.  
  27. Wrong again. There are some cases when it is impossible to avoid new 
  28. line crossings. Example? Here goes:
  29.  
  30.     A ______ D
  31.       \    /
  32.        \  /
  33.         \/ * X
  34.         /\
  35.        /  \
  36.       /    \
  37.    C /------\ B
  38.  
  39. And this is not the worst case at all.
  40.  
  41. |> 
  42. |> Mark Schnitzius
  43. |> schnitzi@eola.cs.ucf.edu
  44. |> Univ. of Central Florida
  45. ---
  46. Alex Berlin                     
  47. berlin@is.morgan.com
  48.