SBDTypeSpatialTransform Class Reference

This class describes spatial transforms. More...

Public Attributes

SBMatrix33 *const orientation
 The pointer to the orientation of the spatial transform.
 
SBPosition3 *const position
 The pointer to the position of the spatial transform.
 

Static Public Attributes

static const SBDTypeSpatialTransform zero
 The zero spatial transform.
 
static const SBDTypeSpatialTransform identity
 The identity spatial transform.
 

Constructors and destructor

 SBDTypeSpatialTransform ()
 Constructs an identity transform.
 
 SBDTypeSpatialTransform (const SBDTypeSpatialTransform &transform)
 Copy constructor.
 
 SBDTypeSpatialTransform (const SBMatrix33 &orientation, const SBPosition3 &position)
 Constructs a transform from an orientation matrix and a position vector.
 
 ~SBDTypeSpatialTransform ()
 Destroys the spatial transform.
 

Serialization

virtual bool isSerializable () const
 Returns true.
 
virtual void serialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER) const
 Serializes the spatial transform.
 
virtual void unserialize (SBCSerializer *serializer, const SBVersionNumber &sdkVersionNumber=SB_SDK_VERSION_NUMBER)
 Unserializes the spatial transform.
 

Operators

SBPosition3 operator* (const SBPosition3 &position) const
 Returns the result of the transformation of position position by this transform.
 
SBVelocity6 operator* (const SBVelocity6 &velocity) const
 Returns the result of the transformation of spatial velocity velocity by this transform.
 
SBAcceleration6 operator* (const SBAcceleration6 &acceleration) const
 Returns the result of the transformation of spatial acceleration acceleration by this transform.
 
SBForce6 operator* (const SBForce6 &force) const
 Returns the result of the transformation of spatial force force by this transform.
 
SBDTypeSpatialTransform operator* (const SBDTypeSpatialTransform &transform) const
 Returns the product of this transform with the transform transform.
 
SBDTypeSpatialTransformoperator= (const SBDTypeSpatialTransform &transform)
 Sets this transform to transform.
 
bool operator== (const SBDTypeSpatialTransform &transform) const
 Returns true if and only if this transform is equal to transform.
 
bool operator!= (const SBDTypeSpatialTransform &transform) const
 Returns true if and only if this transform is not equal to transform.
 

Useful functions

void setIdentity ()
 Sets this transform to identity.
 
void computeOpenGLMatrix (double mat[16]) const
 Stores the OpenGL matrix corresponding to this transform in mat. More...
 
void inverse (SBDTypeSpatialTransform &inverse) const
 Stores the inverse of this transform in inverse.
 
SBDTypeSpatialTransform inverse () const
 Returns the inverse of this transform.
 
void rightMultiply3D (const SBDTypeSpatialTransform &leftMember, SBDTypeSpatialTransform &result) const
 Stores in result the product of leftMember and this transform.
 
void rightMultiplyInverse3D (const SBDTypeSpatialTransform &leftMember, SBDTypeSpatialTransform &result) const
 Stores in result the product of leftMember and the inverse of this transform.
 
void print () const
 Prints the spatial transform.
 

Transformations

void transformPoint (const SBPosition3 &p, SBPosition3 &result) const
 Transforms the point p into the point result.
 
void transformVelocity (const SBVelocity6 &velocityA, SBVelocity6 &velocityB) const
 Transforms the spatial velocity velocityA into the spatial velocity velocityB.
 
void transformAcceleration (const SBAcceleration6 &accelerationA, SBAcceleration6 &accelerationB) const
 Transforms the spatial acceleration accelerationA into the spatial acceleration accelerationB.
 
void inverseTransformVelocity (const SBVelocity6 &motionA, SBVelocity6 &motionB) const
 Transforms the spatial velocity velocityA into the spatial velocity velocityB by applying the inverse of this transform.
 
void inverseTransformAcceleration (const SBAcceleration6 &motionA, SBAcceleration6 &motionB) const
 Transforms the spatial acceleration accelerationA into the spatial acceleration accelerationB by applying the inverse of this transform.
 
void transformForce (const SBForce6 &forceA, SBForce6 &forceB) const
 Transforms the spatial force forceA into the spatial force forceB.
 
void transformInverseInertia (const SBInverseInertia66 &phiA, SBInverseInertia66 &phiB) const
 Transforms the inverse inertia phiA into the inverse inertia phiB.
 
void transformInverseInertiaLeft (const SBInverseInertia66 &phi, SBInverseInertia66 &result) const
 Left-multiplies the inverse inertia phi by this spatial transform and stores the result in result.
 
void transformInverseInertiaRight (const SBInverseInertia66 &phi, SBInverseInertia66 &result) const
 Right-multiplies the inverse inertia phi by this spatial transform and stores the result in result.
 
void transformInverseInertiaTransposeRight (const SBInverseInertia66 &phi, SBInverseInertia66 &result) const
 Right-multiplies the transpose of the inverse inertia phi by this spatial transform and stores the result in result.
 
void transformInertia (const SBInertia66 &IA, SBInertia66 &IB) const
 Transforms the inertia IA by this spatial transform and stores the result in IB.
 
void transformInertiaLeft (const SBInertia66 &I, SBInertia66 &result) const
 Left-multiplies the inertia I by this spatial transform and stores the result in result.
 
void transformInertiaRight (const SBInertia66 &I, SBInertia66 &result) const
 Right-multiplies the inertia I by this spatial transform and stores the result in result.
 

Accessors

SBVector3 getE1 () const
 Returns the first column of the orientation matrix.
 
SBVector3 getE2 () const
 Returns the second column of the orientation matrix.
 
SBVector3 getE3 () const
 Returns the third column of the orientation matrix.
 
SBPosition3 getE4 () const
 Returns the position vector.
 
void setE1 (const SBVector3 &v)
 Sets the first column of the orientation matrix to v.
 
void setE2 (const SBVector3 &v)
 Sets the second column of the orientation matrix to v.
 
void setE3 (const SBVector3 &v)
 Sets the third column of the orientation matrix to v.
 
void setE4 (const SBPosition3 &p)
 Sets the position vector to p.
 

Detailed Description

This class handles rigid body transforms, and includes some useful functions to treat the transform either as a regular 3D transform (e.g. to transform points) or as a spatial transform (e.g. to transform spatial velocities, spatial accelerations, spatial inertias, etc.). A spatial transform is composed of an orientation part (SBMatrix33) and a position part (SBPosition3).

Short name: SBSpatialTransform

See also
The SBDType library
SBDTypePhysicalVector3
SBDTypeMatrix33

Member Function Documentation

◆ computeOpenGLMatrix()

void SBDTypeSpatialTransform::computeOpenGLMatrix ( double  mat[16]) const

Stores the OpenGL matrix corresponding to this transform in mat:

mat[0] = orientation->m[0][0].getValue();
mat[1] = orientation->m[1][0].getValue();
mat[2] = orientation->m[2][0].getValue();
mat[3] = 0;
mat[4] = orientation->m[0][1].getValue();
mat[5] = orientation->m[1][1].getValue();
mat[6] = orientation->m[2][1].getValue();
mat[7] = 0;
mat[8] = orientation->m[0][2].getValue();
mat[9] = orientation->m[1][2].getValue();
mat[10] = orientation->m[2][2].getValue();
mat[11] = 0;
mat[12] = position->v[0].getValue();
mat[13] = position->v[1].getValue();
mat[14] = position->v[2].getValue();
mat[15] = 1;