18#ifndef BT_SPATIAL_ALGEBRA_H
19#define BT_SPATIAL_ALGEBRA_H
104 template<
typename SpatialVectorType>
105 void cross(
const SpatialVectorType &b, SpatialVectorType &out)
const
107 out.m_topVec =
m_topVec.cross(b.m_topVec);
110 template<
typename SpatialVectorType>
111 SpatialVectorType
cross(
const SpatialVectorType &b)
const
113 SpatialVectorType out;
114 out.m_topVec =
m_topVec.cross(b.m_topVec);
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;
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;
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));
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;
262 outVec.m_topVec -=
m_rotMat.transpose() * inVec.m_topVec;
263 outVec.m_bottomVec -=
m_rotMat.transpose() * inVec.m_bottomVec;
283 else if(outOp ==
Add)
297 template<
typename SpatialVectorType>
300 SpatialVectorType out;
306template<
typename SpatialVectorType>
317template<
typename SpatialVectorType>
btMatrix3x3 outerProduct(const btVector3 &v0, const btVector3 &v1)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void symmetricSpatialOuterProduct(const SpatialVectorType &a, const SpatialVectorType &b, btSymmetricSpatialDyad &out)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 transpose() const
Return the transpose of the matrix.
btVector3 can be used to represent 3D points and vectors.
These spatial algebra classes are used for btMultiBody, see BulletDynamics/Featherstone.
btSpatialForceVector & operator+=(const btSpatialForceVector &vec)
void addLinear(const btVector3 &linear)
void setValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
btSpatialForceVector & operator-=(const btSpatialForceVector &vec)
void setAngular(const btVector3 &angular)
void addVector(const btVector3 &angular, const btVector3 &linear)
btSpatialForceVector(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 btScalar &s) const
const btVector3 & getAngular() const
btSpatialForceVector operator-() const
const btVector3 & getLinear() const
void addAngular(const btVector3 &angular)
btSpatialForceVector operator+(const btSpatialForceVector &vec) const
btSpatialForceVector(const btVector3 &angular, const btVector3 &linear)
void setLinear(const btVector3 &linear)
void setVector(const btVector3 &angular, const btVector3 &linear)
SpatialVectorType cross(const SpatialVectorType &b) const
void addValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
void setLinear(const btVector3 &linear)
const btVector3 & getLinear() const
btSpatialMotionVector & operator-=(const btSpatialMotionVector &vec)
btSpatialMotionVector operator-() const
void addVector(const btVector3 &angular, const btVector3 &linear)
btSpatialMotionVector & operator+=(const btSpatialMotionVector &vec)
void cross(const SpatialVectorType &b, SpatialVectorType &out) const
void setValue(const btScalar &ax, const btScalar &ay, const btScalar &az, const btScalar &lx, const btScalar &ly, const btScalar &lz)
const btVector3 & getAngular() const
btScalar dot(const btSpatialForceVector &b) const
btSpatialMotionVector operator+(const btSpatialMotionVector &vec) const
void addAngular(const btVector3 &angular)
btSpatialMotionVector operator*(const btScalar &s) const
void setAngular(const btVector3 &angular)
btSpatialMotionVector & operator*=(const btScalar &s)
void addLinear(const btVector3 &linear)
btSpatialMotionVector(const btVector3 &angular, const btVector3 &linear)
void setVector(const btVector3 &angular, const btVector3 &linear)
btSpatialForceVector operator*(const btSpatialMotionVector &vec)
btSymmetricSpatialDyad & operator-=(const btSymmetricSpatialDyad &mat)
btSymmetricSpatialDyad(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)
btMatrix3x3 m_topRightMat
btMatrix3x3 m_bottomLeftMat
void setMatrix(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)
void addMatrix(const btMatrix3x3 &topLeftMat, const btMatrix3x3 &topRightMat, const btMatrix3x3 &bottomLeftMat)