[Plib-cvs] plib/src/sg sg.h,1.56,1.57 sgIsect.cxx,1.7,1.8
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-02-02 01:37:13
|
Update of /cvsroot/plib/plib/src/sg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12104/plib/src/sg Modified Files: sg.h sgIsect.cxx Log Message: Added ssgStatistics. Fixed bug in sgIsect.cxx that could cause div0 error. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- sg.h 21 Jan 2004 22:33:46 -0000 1.56 +++ sg.h 2 Feb 2004 01:35:15 -0000 1.57 @@ -1382,8 +1382,14 @@ SGfloat sgIsectLinesegPlane ( sgVec3 dst, sgVec3 v1, sgVec3 v2, sgVec4 plane ) ; -bool sgPointInTriangle ( sgVec3 point, sgVec3 tri[3] ); +bool sgPointInTriangle3 ( sgVec3 point, sgVec3 tri[3] ) ; +bool sgPointInTriangle2 ( sgVec2 point, sgVec2 tri[3] ) ; + +inline bool sgPointInTriangle ( sgVec3 point, sgVec3 tri[3] ) +{ + return sgPointInTriangle3 ( point, tri ) ; +} Index: sgIsect.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sgIsect.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sgIsect.cxx 2 Sep 2002 06:05:46 -0000 1.7 +++ sgIsect.cxx 2 Feb 2004 01:35:15 -0000 1.8 @@ -226,129 +226,165 @@ // return the sign of a value -static inline const int SG_SIGN( const SGfloat x ) { - return x < 0 ? -1 : 1; + +static inline const int SG_SIGN( const SGfloat x ) +{ + return x < 0 ? -1 : 1; } [...234 lines suppressed...] + + sgMake2DLine ( le, a, b ) ; + + if ( SG_SIGN ( le[0]*c[0] + le[1]*c[1] + le[2] ) != + SG_SIGN ( le[0]*point[0] + le[1]*point[1] + le[2] ) ) return false ; + + sgMake2DLine ( le, b, c ) ; + + if ( SG_SIGN ( le[0]*a[0] + le[1]*a[1] + le[2] ) != + SG_SIGN ( le[0]*point[0] + le[1]*point[1] + le[2] ) ) return false ; + + sgMake2DLine ( le, c, a ) ; + + if ( SG_SIGN ( le[0]*b[0] + le[1]*b[1] + le[2] ) != + SG_SIGN ( le[0]*point[0] + le[1]*point[1] + le[2] ) ) return false ; + + return true ; +} + + |