home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / graphics / 9688 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.graphics
  2. Path: sparky!uunet!spool.mu.edu!caen!destroyer!ubc-cs!fornax!chapman
  3. From: chapman@cs.sfu.ca (John Chapman)
  4. Subject: Re: 3d line through 3d polygon
  5. Message-ID: <1992Sep13.220742.995@cs.sfu.ca>
  6. Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
  7. References: <BuGD8w.CxA@iat.holonet.net> <92256.221654JIANGY@QUCDN.QueensU.CA>
  8. Date: Sun, 13 Sep 1992 22:07:42 GMT
  9. Lines: 35
  10.  
  11. In article <92256.221654JIANGY@QUCDN.QueensU.CA> <JIANGY@QUCDN.QueensU.CA> writes:
  12. >The most intuitive (not necessarily efficient) solution is:
  13. >   (1) compute the coefficient (A, B, C, D) of the polygon plane
  14. >       using Newell (?) method. See Gems I (or II or III, cann't
  15. >       remember exactly) for the code.
  16. >   (2) compute the intersection point between the infinite line
  17. >       and the plane.
  18. >   (3) test if the point is in the polygon. The code for this can be
  19. >       found in the latest Raytracing news (ftp: princeton.edu, in
  20. >       pub/Graphics/RTNews/RTNv5n3).
  21. >   (4) if the answer to (3) is yes, determine if this point lies
  22. >       between the two end points of the line segment. If yes, the
  23. >       line segment intersect the polygon and the point is what you
  24. >       are looking for.
  25. >
  26. >Yaohong Jiang
  27. >Queen's U
  28. >
  29. >
  30. >(Sorry, I missed one step between steps 2 and 3: you have to rotate
  31. >the polygon and the intersection point so that all the polygon vertices
  32. >and the intersection point have the same z coordinates, since the point-in-
  33. >polygon test in RTNews works only for 2D point and polygons.
  34. >
  35. > (details of rotation here)
  36. >
  37. >Y. Jiang
  38.  
  39. You don't need to rotate the polygon (or line) just project against
  40. a plane orthogonal to the largest component of the polygon surface
  41. normal, e.g. if the Z component of the normal is larger than X & Y
  42. components then project against the XY plane and do your point in polygon
  43. test in 2d; if the Y component is largest ( I should be saying magnitude
  44. I guess) then project against ZX etc etc
  45.  
  46.