Update of /cvsroot/opal/opal/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/src
Modified Files:
Joint.cpp Joint.h OpalMath.h
Log Message:
Fixed bug in Joint class that crashed when applying a force/torque to a Joint connected to a single Solid.
Index: OpalMath.h
===================================================================
RCS file: /cvsroot/opal/opal/src/OpalMath.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** OpalMath.h 27 Apr 2005 02:28:18 -0000 1.12
--- OpalMath.h 2 May 2005 16:40:59 -0000 1.13
***************
*** 67,70 ****
--- 67,72 ----
/// by the magnitudes of the values) tolerance, depending on whether
/// both values are both less than 1.
+ /// See Christer Ericson's GDC 2005 presentation:
+ /// http://realtimecollisiondetection.net/pubs/GDC05_Ericson_Numerical_Robustness_for_Geometric_Calculations.ppt
inline bool areEqual(real x, real y)
{
Index: Joint.h
===================================================================
RCS file: /cvsroot/opal/opal/src/Joint.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** Joint.h 18 Apr 2005 22:21:03 -0000 1.68
--- Joint.h 2 May 2005 16:40:59 -0000 1.69
***************
*** 154,163 ****
virtual real OPAL_CALL getVelocity(int axisNum)const = 0;
! /// Applies a force to this Joint's Solids. To be used for
! /// translational axes. This does nothing if the Joint is disabled.
virtual void OPAL_CALL addForce(int axisNum, real magnitude,
real duration, bool singleStep=false);
! /// Applies a torque to this Joint's Solids. To be used for
/// rotational Joints. This does nothing if the Joint is disabled.
virtual void OPAL_CALL addTorque(int axisNum, real magnitude,
--- 154,163 ----
virtual real OPAL_CALL getVelocity(int axisNum)const = 0;
! /// Applies a force to this Joint's Solid(s). To be used for
! /// translational axes. This does nothing if the Joint is disabled.
virtual void OPAL_CALL addForce(int axisNum, real magnitude,
real duration, bool singleStep=false);
! /// Applies a torque to this Joint's Solid(s). To be used for
/// rotational Joints. This does nothing if the Joint is disabled.
virtual void OPAL_CALL addTorque(int axisNum, real magnitude,
Index: Joint.cpp
===================================================================
RCS file: /cvsroot/opal/opal/src/Joint.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Joint.cpp 18 Apr 2005 22:21:03 -0000 1.30
--- Joint.cpp 2 May 2005 16:40:59 -0000 1.31
***************
*** 210,216 ****
f.vec = magnitude * direction;
! mData.solid0->addForce(f);
f.vec *= (real)-1.0;
! mData.solid1->addForce(f);
}
}
--- 210,224 ----
f.vec = magnitude * direction;
! if (mData.solid0)
! {
! mData.solid0->addForce(f);
! }
!
f.vec *= (real)-1.0;
!
! if (mData.solid1)
! {
! mData.solid1->addForce(f);
! }
}
}
***************
*** 237,243 ****
f.vec = magnitude * axis;
! mData.solid0->addForce(f);
f.vec *= (real)-1.0;
! mData.solid1->addForce(f);
}
}
--- 245,259 ----
f.vec = magnitude * axis;
! if (mData.solid0)
! {
! mData.solid0->addForce(f);
! }
!
f.vec *= (real)-1.0;
!
! if (mData.solid1)
! {
! mData.solid1->addForce(f);
! }
}
}
|