RE: [Plib-devel] Is a point inside a triangle in 3-d
Brought to you by:
sjbaker
From: Fay J. F C. AAC/W. <joh...@eg...> - 2004-04-30 20:45:06
|
OK, I have a well-tested point-inside-a-triangle function in two dimensions. I have a poorly-tested point-inside-a-triangle function in three dimensions. The problem is not well-posed (the point may not lie on the plane of the triangle) and it will give different answers from the present function in SG. The differences are especially apparent if the point does not lie in the plane of the triangle, in which case the present code can easily give an improper answer. I have a somewhat-tested intersection-of-two-lines function in three dimensions. It is consistent with the documentation although it gives different results from the present algorithm if the two lines do not actually intersect. I did a bit of work on a function to return the line of intersection between two planes but realized that the general vector algebra solution would be less efficient than the present code so I gave it up. John F. Fay joh...@eg... -----Original Message----- From: pli...@li... [mailto:pli...@li...]On Behalf Of Norman Vine Sent: Friday, March 26, 2004 9:37 AM To: pli...@li... Subject: RE: [Plib-devel] Is a point inside a triangle in 3-d John Fay writes: > I've been mulling the 3-d version of the point/triangle problem and I have a question or two. > (1) The current code assumes that the point and the triangle are in the same plane. Is this a good thing? > (2) Is there a need for a faster point-in-triangle function? One always needs a faster intersection routine :-) To see how this one is used see < URL all one line > http://cvs.flightgear.org/cgi-bin/viewcvs/viewcvs.cgi/FlightGear/src/Scenery /hitlist.cxx?rev=1.9&cvsroot=FlightGear-0.9&content-type =text/vnd.viewcvs-markup The code is not the easiest to follow but a generic line intersection with a SSG tree is in there < the line is described by its origin and direction > void FGHitList::Intersect( ssgBranch *scene, sgdVec3 orig, sgdVec3 dir ) { sgdMat4 m; clear(); sgdMakeIdentMat4 ( m ) ; IntersectBranch( scene, m, orig, dir ); } Cheers Norman ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel |