[Opal-commits] opal/src/ODE ODESimulator.h,1.65,1.66 ODESolid.cpp,1.77,1.78 ODESolid.h,1.65,1.66
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-23 07:54:44
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29501/src/ODE Modified Files: ODESimulator.h ODESolid.cpp ODESolid.h Log Message: finished AccelerationSensor; remove VelocitySensor because the existing Solid velocity functions render it useless Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** ODESimulator.h 14 Mar 2005 05:18:26 -0000 1.65 --- ODESimulator.h 23 Mar 2005 07:54:34 -0000 1.66 *************** *** 34,38 **** #include "../AccelerationSensor.h" #include "../RaycastSensor.h" - #include "../VelocitySensor.h" #include "../VolumeSensor.h" #include "ODESolid.h" --- 34,37 ---- Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** ODESolid.h 10 Mar 2005 21:11:05 -0000 1.65 --- ODESolid.h 23 Mar 2005 07:54:35 -0000 1.66 *************** *** 93,96 **** --- 93,99 ---- virtual Vec3r OPAL_CALL getLocalLinearVel()const; + virtual Vec3r OPAL_CALL getLocalLinearVelAtLocalPos( + const Point3r& p)const; + virtual void OPAL_CALL setLocalAngularVel(const Vec3r& vel); *************** *** 101,104 **** --- 104,110 ---- virtual Vec3r OPAL_CALL getGlobalLinearVel()const; + virtual Vec3r OPAL_CALL getGlobalLinearVelAtLocalPos( + const Point3r& p)const; + virtual void OPAL_CALL setGlobalAngularVel(const Vec3r& vel); Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ODESolid.cpp 21 Mar 2005 03:53:57 -0000 1.77 --- ODESolid.cpp 23 Mar 2005 07:54:34 -0000 1.78 *************** *** 652,655 **** --- 652,657 ---- { const dReal* vel = dBodyGetLinearVel(mBodyID); + + // Convert the vector from global to local coordinates. dVector3 localVel; dBodyVectorFromWorld(mBodyID, vel[0], vel[1], vel[2], localVel); *************** *** 662,665 **** --- 664,686 ---- } + Vec3r ODESolid::getLocalLinearVelAtLocalPos(const Point3r& p)const + { + if (!mData.isStatic) + { + // First find the global velocity at the given point. + dVector3 result; + dBodyGetRelPointVel(mBodyID, p[0], p[1], p[2], result); + + // Now convert the velocity from global to local coordinates. + dBodyVectorFromWorld(mBodyID, result[0], result[1], result[2], + result); + return Vec3r(result[0], result[1], result[2]); + } + else + { + return Vec3r(0,0,0); + } + } + void ODESolid::setLocalAngularVel(const Vec3r& vel) { *************** *** 679,682 **** --- 700,705 ---- { const dReal* vel = dBodyGetAngularVel(mBodyID); + + // Convert the vector from global to local coordinates. dVector3 localVel; dBodyVectorFromWorld(mBodyID, vel[0], vel[1], vel[2], localVel); *************** *** 711,714 **** --- 734,752 ---- } + Vec3r ODESolid::getGlobalLinearVelAtLocalPos(const Point3r& p)const + { + if (!mData.isStatic) + { + // First find the global velocity at the given point. + dVector3 result; + dBodyGetRelPointVel(mBodyID, p[0], p[1], p[2], result); + return Vec3r(result[0], result[1], result[2]); + } + else + { + return Vec3r(0,0,0); + } + } + void ODESolid::setGlobalAngularVel(const Vec3r& vel) { |