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).
#include <math.h>
Public Member Functions |
|
DualQuaternion (void) | |
Constructs a dual quaternion which
represents the identical transformation. |
|
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. |
|
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.
|
|
DualQuaternion (float fAngle, float fPitch, const Vector &vDirection, const Vector &vMoment) | |
Constructs a dual quaternion which
represents a screw motion. |
|
DualQuaternion (const Vector &vTranslation, const Quaternion &vRotation) | |
Construct a dual quaternion which represents
a rotation and a translation. |
|
DualQuaternion (const Matrix &mRigid) | |
Constructs a dual quaternion from a matrix
which represents a rigid transformation. |
|
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. |
|
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. |
|
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. |
|
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) |
Conjugates the dual quaternion by both the
quaternion and dual conjugation. |
|
DualQuaternion & | Invert (void) |
Inverts the dual quaternion. |
|
void | SetIdentity (void) |
Sets the dual quaternion to represents the
identical transformaion. |
|
float | operator[] (int iIndex) const |
Returns the stored value inside the dual
quaternion. |
|
Public Attributes |
|
Quaternion | m_vReal |
Content of the dual quaterion as two regular
quaternions. |
|
Quaternion | m_vDual |
DualQuaternion | ( | void | ) | [inline] |
Constructs a dual quaternion which represents the identical transformation.
Definition at line 1358 of file math.h.
{ SetIdentity(); };
DualQuaternion | ( | const Quaternion & | vReal, |
const Quaternion & | vDual | ||
) | [inline] |
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.
[in] | vPivot | Point in the space which is the center of the rotation. |
[in] | vAxis | Axis of the rotation. |
[in] | fAngle | Angle 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.
[in] | fAngle | Angle 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.
[in] | vTranslation | Translation part of the transformation. |
[in] | vRotation | Rotation part of the transformation. |
DualQuaternion | ( | const Matrix & | mRigid | ) |
Constructs a dual quaternion from a matrix which represents a rigid transformation.
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.
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.
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 1445 of file math.h.
{ Conjugate(); DualConjugate(); return *this; };
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.
float operator[] | ( | int | iIndex | ) | const |
Returns the stored value inside the dual quaternion.
[in] | iIndex | Index of the dual quaternion value, must be smaller than 8. |
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.