18 #ifndef BT_SPATIAL_ALGEBRA_H    19 #define BT_SPATIAL_ALGEBRA_H    44                 m_bottomVec[0] += ax; m_bottomVec[1] += ay; m_bottomVec[2] += az;
    45                 m_topVec[0] += lx; m_topVec[1] += ly; m_topVec[2] += lz;                        
    84                 m_topVec[0] += ax; m_topVec[1] += ay; m_topVec[2] += az;
    85                 m_bottomVec[0] += lx; m_bottomVec[1] += ly; m_bottomVec[2] += lz;                       
   104         template<
typename SpatialVectorType>
   105         void cross(
const SpatialVectorType &b, SpatialVectorType &out)
 const   107                 out.m_topVec = m_topVec.
cross(b.m_topVec);
   108                 out.m_bottomVec = m_bottomVec.
cross(b.m_topVec) + m_topVec.
cross(b.m_bottomVec);
   110         template<
typename SpatialVectorType>
   111         SpatialVectorType 
cross(
const SpatialVectorType &b)
 const   113                 SpatialVectorType out;
   114                 out.m_topVec = m_topVec.
cross(b.m_topVec);
   115                 out.m_bottomVec = m_bottomVec.
cross(b.m_topVec) + m_topVec.
cross(b.m_bottomVec);
   137                 m_topLeftMat = topLeftMat;
   138                 m_topRightMat = topRightMat;
   139                 m_bottomLeftMat = bottomLeftMat;
   144                 m_topLeftMat += topLeftMat;
   145                 m_topRightMat += topRightMat;
   146                 m_bottomLeftMat += bottomLeftMat;
   177         template<
typename SpatialVectorType>
   179                       SpatialVectorType &outVec,
   184                         outVec.m_topVec = m_rotMat * inVec.m_topVec;
   185                         outVec.m_bottomVec = -m_trnVec.
cross(outVec.m_topVec) + m_rotMat * inVec.m_bottomVec;
   187                 else if(outOp == 
Add)
   189                         outVec.m_topVec += m_rotMat * inVec.m_topVec;
   190                         outVec.m_bottomVec += -m_trnVec.
cross(outVec.m_topVec) + m_rotMat * inVec.m_bottomVec;
   192                 else if(outOp == Subtract)
   194                         outVec.m_topVec -= m_rotMat * inVec.m_topVec;
   195                         outVec.m_bottomVec -= -m_trnVec.
cross(outVec.m_topVec) + m_rotMat * inVec.m_bottomVec;
   200         template<
typename SpatialVectorType>
   202                                                                 SpatialVectorType &outVec,
   207                         outVec.m_topVec = m_rotMat * inVec.m_topVec;
   208                         outVec.m_bottomVec = m_rotMat * inVec.m_bottomVec;
   210                 else if(outOp == 
Add)
   212                         outVec.m_topVec += m_rotMat * inVec.m_topVec;
   213                         outVec.m_bottomVec += m_rotMat * inVec.m_bottomVec;
   215                 else if(outOp == Subtract)
   217                         outVec.m_topVec -= m_rotMat * inVec.m_topVec;
   218                         outVec.m_bottomVec -= m_rotMat * inVec.m_bottomVec;
   223         template<
typename SpatialVectorType>
   225                                                         SpatialVectorType &outVec,
   230                         outVec.m_topVec = m_rotMat.
transpose() * inVec.m_topVec;
   231                         outVec.m_bottomVec = m_rotMat.
transpose() * (inVec.m_bottomVec + m_trnVec.
cross(inVec.m_topVec));
   233                 else if(outOp == 
Add)
   235                         outVec.m_topVec += m_rotMat.
transpose() * inVec.m_topVec;
   236                         outVec.m_bottomVec += m_rotMat.
transpose() * (inVec.m_bottomVec + m_trnVec.
cross(inVec.m_topVec));
   238                 else if(outOp == Subtract)
   240                         outVec.m_topVec -= m_rotMat.
transpose() * inVec.m_topVec;
   241                         outVec.m_bottomVec -= m_rotMat.
transpose() * (inVec.m_bottomVec + m_trnVec.
cross(inVec.m_topVec));
   245         template<
typename SpatialVectorType>
   247                                                                                 SpatialVectorType &outVec,
   252                         outVec.m_topVec = m_rotMat.
transpose() * inVec.m_topVec;
   253                         outVec.m_bottomVec = m_rotMat.
transpose() * inVec.m_bottomVec;
   255                 else if(outOp == 
Add)
   257                         outVec.m_topVec += m_rotMat.
transpose() * inVec.m_topVec;
   258                         outVec.m_bottomVec += m_rotMat.
transpose() * inVec.m_bottomVec;
   260                 else if(outOp == Subtract)
   262                         outVec.m_topVec -= m_rotMat.
transpose() * inVec.m_topVec;
   263                         outVec.m_bottomVec -= m_rotMat.
transpose() * inVec.m_bottomVec;
   272                 const btMatrix3x3 r_cross(      0, -m_trnVec[2], m_trnVec[1],
   273                                                                 m_trnVec[2], 0, -m_trnVec[0],
   274                                                                 -m_trnVec[1], m_trnVec[0], 0);
   283                 else if(outOp == 
Add)
   289                 else if(outOp == Subtract)
   297         template<
typename SpatialVectorType>
   300                 SpatialVectorType out;
   306 template<
typename SpatialVectorType>
   317 template<
typename SpatialVectorType>
   330 #endif //BT_SPATIAL_ALGEBRA_H 
btSpatialForceVector & operator+=(const btSpatialForceVector &vec)
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
const btVector3 & getLinear() const
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone. 
void setValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
void addValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
btSpatialForceVector & operator-=(const btSpatialForceVector &vec)
btSpatialForceVector(const btVector3 &angular, const btVector3 &linear)
void addLinear(const btVector3 &linear)
void symmetricSpatialOuterProduct(const SpatialVectorType &a, const SpatialVectorType &b, btSymmetricSpatialDyad &out)
btMatrix3x3 outerProduct(const btVector3 &v0, const btVector3 &v1)
void addLinear(const btVector3 &linear)
btMatrix3x3 transpose() const
Return the transpose of the matrix. 
void setValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
void addAngular(const btVector3 &angular)
void addValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
btSpatialForceVector operator*(const btScalar &s) const
const btVector3 & getLinear() const
void setVector(const btVector3 &angular, const btVector3 &linear)
const btVector3 & getAngular() const
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector. 
btScalar dot(const btVector3 &v) const
Return the dot product. 
void setLinear(const btVector3 &linear)
btSpatialForceVector operator+(const btSpatialForceVector &vec) const
void setAngular(const btVector3 &angular)
void setAngular(const btVector3 &angular)
btVector3 can be used to represent 3D points and vectors. 
btSpatialForceVector operator-() const
btSpatialForceVector(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
void cross(const SpatialVectorType &b, SpatialVectorType &out) const
void setMatrix(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)
btScalar dot(const btSpatialForceVector &b) const
SpatialVectorType cross(const SpatialVectorType &b) const
const btVector3 & getAngular() const
btMatrix3x3 m_bottomLeftMat
void setVector(const btVector3 &angular, const btVector3 &linear)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
static btMatrix3x3 Add(const btMatrix3x3 &a, const btMatrix3x3 &b)
void addVector(const btVector3 &angular, const btVector3 &linear)
void addVector(const btVector3 &angular, const btVector3 &linear)
btSymmetricSpatialDyad(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)
void addAngular(const btVector3 &angular)
void addMatrix(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)
void setLinear(const btVector3 &linear)
void setIdentity()
Set the matrix to the identity. 
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btMatrix3x3 m_topRightMat
btSpatialMotionVector(const btVector3 &angular, const btVector3 &linear)