Back to index

supertuxkart  0.5+dfsg1
Static Public Member Functions
btTransformUtil Class Reference

Utils related to temporal transforms. More...

#include <btTransformUtil.h>

List of all members.

Static Public Member Functions

static void integrateTransform (const btTransform &curTrans, const btVector3 &linvel, const btVector3 &angvel, btScalar timeStep, btTransform &predictedTransform)
static void calculateVelocity (const btTransform &transform0, const btTransform &transform1, btScalar timeStep, btVector3 &linVel, btVector3 &angVel)
static void calculateDiffAxisAngle (const btTransform &transform0, const btTransform &transform1, btVector3 &axis, btScalar &angle)

Detailed Description

Utils related to temporal transforms.

Definition at line 59 of file btTransformUtil.h.


Member Function Documentation

static void btTransformUtil::calculateDiffAxisAngle ( const btTransform transform0,
const btTransform transform1,
btVector3 axis,
btScalar angle 
) [inline, static]

floating point inaccuracy can lead to w component > 1..., which breaks

Definition at line 112 of file btTransformUtil.h.

       {
       
       #ifdef USE_QUATERNION_DIFF
              btQuaternion orn0 = transform0.getRotation();
              btQuaternion orn1a = transform1.getRotation();
              btQuaternion orn1 = orn0.farthest(orn1a);
              btQuaternion dorn = orn1 * orn0.inverse();
#else
              btMatrix3x3 dmat = transform1.getBasis() * transform0.getBasis().inverse();
              btQuaternion dorn;
              dmat.getRotation(dorn);
#endif//USE_QUATERNION_DIFF
       

              dorn.normalize();
              
              angle = dorn.getAngle();
              axis = btVector3(dorn.x(),dorn.y(),dorn.z());
              axis[3] = btScalar(0.);
              //check for axis length
              btScalar len = axis.length2();
              if (len < SIMD_EPSILON*SIMD_EPSILON)
                     axis = btVector3(btScalar(1.),btScalar(0.),btScalar(0.));
              else
                     axis /= btSqrt(len);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void btTransformUtil::calculateVelocity ( const btTransform transform0,
const btTransform transform1,
btScalar  timeStep,
btVector3 linVel,
btVector3 angVel 
) [inline, static]

Definition at line 103 of file btTransformUtil.h.

       {
              linVel = (transform1.getOrigin() - transform0.getOrigin()) / timeStep;
              btVector3 axis;
              btScalar  angle;
              calculateDiffAxisAngle(transform0,transform1,axis,angle);
              angVel = axis * angle / timeStep;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

static void btTransformUtil::integrateTransform ( const btTransform curTrans,
const btVector3 linvel,
const btVector3 angvel,
btScalar  timeStep,
btTransform predictedTransform 
) [inline, static]

Definition at line 64 of file btTransformUtil.h.

       {
              predictedTransform.setOrigin(curTrans.getOrigin() + linvel * timeStep);
//     #define QUATERNION_DERIVATIVE
       #ifdef QUATERNION_DERIVATIVE
              btQuaternion predictedOrn = curTrans.getRotation();
              predictedOrn += (angvel * predictedOrn) * (timeStep * btScalar(0.5));
              predictedOrn.normalize();
       #else
              //Exponential map
              //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia

              btVector3 axis;
              btScalar      fAngle = angvel.length(); 
              //limit the angular motion
              if (fAngle*timeStep > ANGULAR_MOTION_THRESHOLD)
              {
                     fAngle = ANGULAR_MOTION_THRESHOLD / timeStep;
              }

              if ( fAngle < btScalar(0.001) )
              {
                     // use Taylor's expansions of sync function
                     axis   = angvel*( btScalar(0.5)*timeStep-(timeStep*timeStep*timeStep)*(btScalar(0.020833333333))*fAngle*fAngle );
              }
              else
              {
                     // sync(fAngle) = sin(c*fAngle)/t
                     axis   = angvel*( btSin(btScalar(0.5)*fAngle*timeStep)/fAngle );
              }
              btQuaternion dorn (axis.x(),axis.y(),axis.z(),btCos( fAngle*timeStep*btScalar(0.5) ));
              btQuaternion orn0 = curTrans.getRotation();

              btQuaternion predictedOrn = dorn * orn0;
              predictedOrn.normalize();
       #endif
              predictedTransform.setRotation(predictedOrn);
       }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: