If you want something a little faster, you could project the line defining 
your slicing plane and all the mesh's points onto a virtual plane 
perpendicular to the camera's point of view, then compute which side of the 
slicing line each vertex resides and flag it as -1, 0, or 1 for below, on, 
or above the line respectively.  As you traverse the edges of the mesh, 
compare the flags of the two vertices comprising the edge to see if they are 
on opposite sides of the slicing line.  If yes, then select the edge.  Since 
you know the slicing line passes through the edge, then by definition it 
must intersect both triangles sharing the edge (unless the edge is parallel 
to the slicing line).  That implies exactly one other edge of each triangle 
intersects with the slicing line.  So test the next available edge of each. 
Regardless of the outcome of the test, you know which 2 edges of the 
triangle intersect the slicing line, so you can skip testing the 3rd.  If 
you have enough information flagged, you may be able to extend the 
implication to neighboring triangles to eliminate those which share the edge 
which does not intersect the slicing line, and likewise, more rapidly walk 
the mesh to find the other edges that do.  It should be obvious you'll need 
a data structure which keeps track of which edges/triangles you've visited. 
If you extend the logic to a 2nd slicing line perpendicular to the first and 
record left/on/right side of the 2nd slicing line, you have an algorithm for 
finding intersection of a point inside of a triangle.  A little 
unconventional, but it works.

With some analysis and deduction, you can speed up the algorithm a lot more.


Matt


------
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to