DualQuaternion Class Reference

DualQuaternion Class Reference

#include <math.h>

Class Description

The DualQuaternion class is used to represent rigid transformations in most cases.

It is an alternative to the Matrix class to store transformations which are rigid, i.e. has only rotation and translation part. In this case the dual quaternion is unit. The advantage of the dual quaternion representation over the matrices is that it is easier to do transformation blending, and it only needs 32 bytes in the memory. Disadvangate is that it is limited to rigid transformations only (scaling is not supported).

Definition at line 1415 of file math.h.

Public Member Functions

 DualQuaternion (void)
 Constructs a dual quaternion which represents the identical transformation. More...
 
 DualQuaternion (const Quaternion &vReal, const Quaternion &vDual)
 Constructs a dual quaternion from two quaternions, using one as the real and the other one as the dual part. More...
 
 DualQuaternion (const Vector &vPivot, const Vector &vAxis, float fAngle)
 Constructs a dual quaternion which represents a transformation which is a rotation around a given point in the space with a given rotation axis and a given vector. More...
 
 DualQuaternion (float fAngle, float fPitch, const Vector &vDirection, const Vector &vMoment)
 Constructs a dual quaternion which represents a screw motion. More...
 
 DualQuaternion (const Vector &vTranslation, const Quaternion &vRotation)
 Construct a dual quaternion which represents a rotation and a translation. More...
 
 DualQuaternion (const Matrix &mRigid)
 Constructs a dual quaternion from a matrix which represents a rigid transformation. More...
 
Matrix ToMatrix (void) const
 Converts the dual quaternion into a matrix which represents the same transformation as the quaternion. More...
 
Vector Translation (void) const
 Returns the translation represented by this dual quaternion. More...
 
Vector Transform (const Vector &vPoint) const
 Transform a given point by the dual quaternion. More...
 
DualQuaternion operator+ (const DualQuaternion &vAddition) const
 Returns the sum of two dual quaternions. More...
 
DualQuaternionoperator+= (const DualQuaternion &vAddition)
 Adds a dual quaternion to this dual quaternion. More...
 
DualQuaternion operator- (const DualQuaternion &vAddition) const
 Returns the substraction of two dual quaternions. More...
 
DualQuaternionoperator-= (const DualQuaternion &vAddition)
 Substracts a dual quaternion from this dual quaternion. More...
 
DualQuaternion operator* (const DualQuaternion &vMultiplier) const
 Returns the multiplication of two dual quaternions. More...
 
DualQuaternionoperator*= (const DualQuaternion &vMultiplier)
 Multiplies a quaternion by another one. More...
 
DualQuaternion operator* (float fMultiplier) const
 Returns the product of the dual quaternion and a scalar value. More...
 
DualQuaternionNormalize (void)
 Normalizes the dual quaternions. More...
 
void ToScrew (float &fAngle, float &fPitch, Vector &vDirection, Vector &vMoment) const
 Converts the transfomation represented by the qual quaternion into a screw motion. More...
 
DualQuaternionPower (float fExponent)
 Calculates the power of the dual quaternion. More...
 
DualQuaternion Slerp (const DualQuaternion &vTarget, float fWeight) const
 Calculates the weighted average of two dual quaternions. More...
 
DualQuaternionConjugate (void)
 Conjugates the dual quaternion using the quaternion conjugation. More...
 
DualQuaternionDualConjugate (void)
 Conjugates the dual quaternion using the dual conjugation. More...
 
DualQuaternionDoubleConjugate (void)
 Conjugates the dual quaternion by both the quaternion and dual conjugation. More...
 
DualQuaternionInvert (void)
 Inverts the dual quaternion. More...
 
void SetIdentity (void)
 Sets the dual quaternion to represents the identical transformaion. More...
 
float operator[] (int iIndex) const
 Returns the stored value inside the dual quaternion. More...
 

Public Attributes

Quaternion m_vReal
 Content of the dual quaterion as two regular quaternions. More...
 
Quaternion m_vDual
 

Constructor & Destructor Documentation

DualQuaternion ( void  )
inline

Constructs a dual quaternion which represents the identical transformation.

Definition at line 1419 of file math.h.

1419 { SetIdentity(); };
void SetIdentity(void)
Sets the dual quaternion to represents the identical transformaion.
Definition: math.h:1513
DualQuaternion ( const Quaternion vReal,
const Quaternion vDual 
)
inline

Constructs a dual quaternion from two quaternions, using one as the real and the other one as the dual part.

Parameters
[in]vRealReal part.
[in]vDualDual part.

Definition at line 1422 of file math.h.

1426  { m_vReal = vReal; m_vDual = vDual; };
Quaternion m_vReal
Content of the dual quaterion as two regular quaternions.
Definition: math.h:1525
Quaternion m_vDual
Definition: math.h:1525
DualQuaternion ( const Vector vPivot,
const Vector vAxis,
float  fAngle 
)

Constructs a dual quaternion which represents a transformation which is a rotation around a given point in the space with a given rotation axis and a given vector.

Parameters
[in]vPivotPoint in the space which is the center of the rotation.
[in]vAxisAxis of the rotation.
[in]fAngleAngle of the rotation in radian.
DualQuaternion ( float  fAngle,
float  fPitch,
const Vector vDirection,
const Vector vMoment 
)

Constructs a dual quaternion which represents a screw motion.

Parameters
[in]fAngleAngle of the rotation in radian.
[in]fPitch
DualQuaternion ( const Vector vTranslation,
const Quaternion vRotation 
)

Construct a dual quaternion which represents a rotation and a translation.

Parameters
[in]vTranslationTranslation part of the transformation.
[in]vRotationRotation part of the transformation.
DualQuaternion ( const Matrix mRigid)

Constructs a dual quaternion from a matrix which represents a rigid transformation.

See also
Matrix::IsRigid()

Member Function Documentation

Matrix ToMatrix ( void  ) const

Converts the dual quaternion into a matrix which represents the same transformation as the quaternion.

Vector Translation ( void  ) const

Returns the translation represented by this dual quaternion.

Vector Transform ( const Vector vPoint) const

Transform a given point by the dual quaternion.

DualQuaternion operator+ ( const DualQuaternion vAddition) const

Returns the sum of two dual quaternions.

DualQuaternion& operator+= ( const DualQuaternion vAddition)

Adds a dual quaternion to this dual quaternion.

DualQuaternion operator- ( const DualQuaternion vAddition) const

Returns the substraction of two dual quaternions.

DualQuaternion& operator-= ( const DualQuaternion vAddition)

Substracts a dual quaternion from this dual quaternion.

DualQuaternion operator* ( const DualQuaternion vMultiplier) const

Returns the multiplication of two dual quaternions.

The result is representing the transformation which is the concatenation of the two transformation represented by the two dual quaternions.

DualQuaternion& operator*= ( const DualQuaternion vMultiplier)

Multiplies a quaternion by another one.

DualQuaternion operator* ( float  fMultiplier) const

Returns the product of the dual quaternion and a scalar value.

DualQuaternion& Normalize ( void  )

Normalizes the dual quaternions.

Only normalized dual quaternions are valid representations of rigid transformations.

void ToScrew ( float &  fAngle,
float &  fPitch,
Vector vDirection,
Vector vMoment 
) const

Converts the transfomation represented by the qual quaternion into a screw motion.

DualQuaternion& Power ( float  fExponent)

Calculates the power of the dual quaternion.

DualQuaternion Slerp ( const DualQuaternion vTarget,
float  fWeight 
) const

Calculates the weighted average of two dual quaternions.

This is a good quality but slow blending function.

DualQuaternion& Conjugate ( void  )

Conjugates the dual quaternion using the quaternion conjugation.

DualQuaternion& DualConjugate ( void  )

Conjugates the dual quaternion using the dual conjugation.

DualQuaternion& DoubleConjugate ( void  )
inline

Conjugates the dual quaternion by both the quaternion and dual conjugation.

For unit dual quaternions this is the same as Invert().

Definition at line 1506 of file math.h.

1506 { Conjugate(); DualConjugate(); return *this; };
DualQuaternion & Conjugate(void)
Conjugates the dual quaternion using the quaternion conjugation.
DualQuaternion & DualConjugate(void)
Conjugates the dual quaternion using the dual conjugation.
DualQuaternion& Invert ( void  )

Inverts the dual quaternion.

The result will represent a transformation which is the inverse of the transformation represented by the original dual quaternion.

void SetIdentity ( void  )
inline

Sets the dual quaternion to represents the identical transformaion.

Definition at line 1513 of file math.h.

Quaternion m_vReal
Content of the dual quaterion as two regular quaternions.
Definition: math.h:1525
void SetZero(void)
Sets the quaternion to represents the zero transformation.
Definition: math.h:1394
Quaternion m_vDual
Definition: math.h:1525
void SetIdentity(void)
Sets the quaternion to represents the identical transformation.
Definition: math.h:1390
float operator[] ( int  iIndex) const

Returns the stored value inside the dual quaternion.

Parameters
[in]iIndexIndex of the dual quaternion value, must be smaller than 8.

Member Data Documentation

Quaternion m_vReal

Content of the dual quaterion as two regular quaternions.

These data members of the class can be accessed freely. The dual quaterion is represented with two quaternions, one beeing as the real part and the other is the dual part. In other words, m_vReal holds the rotation component, while the dual part is responsible for the translation part.

Definition at line 1525 of file math.h.

Quaternion m_vDual

Definition at line 1525 of file math.h.


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