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