Update of /cvsroot/plib/plib/src/sg
In directory sc8-pr-cvs1:/tmp/cvs-serv15955
Modified Files:
sg.cxx
Log Message:
Bug fix to function: SGfloat sgDistSquaredToLineVec3(constsgLine3, const sgVec3)
Fix is based on diff provided by John Fay.
Index: sg.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- sg.cxx 12 Nov 2003 12:39:16 -0000 1.40
+++ sg.cxx 20 Jan 2004 22:12:15 -0000 1.41
@@ -848,9 +848,11 @@
SGfloat sgDistSquaredToLineVec3 ( const sgLine3 line, const sgVec3 pnt )
{
sgVec3 r ; sgSubVec3 ( r, pnt, line.point_on_line ) ;
+
+ float projectedDistance = sgScalarProductVec3(r,line.direction_vector);
return sgScalarProductVec3 ( r, r ) -
- sgScalarProductVec3 ( r, line.direction_vector ) ;
+ projectedDistance * projectedDistance;
}
|