mudbox::DualQuaternion Class Reference

#include <math.h>

List of all members.


Detailed 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).


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::IsRigid().
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
  Content of the dual quaterion as two regular quaternions.

Constructor & Destructor Documentation

mudbox::DualQuaternion::DualQuaternion void   )  [inline]
 

Constructs a dual quaternion which represents the identical transformation.

01061 { SetIdentity(); };
mudbox::DualQuaternion::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:
vReal  [in] Real part.
vDual  [in] Dual part.
01068     { m_vReal = vReal; m_vDual = vDual; };
mudbox::DualQuaternion::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:
vPivot  [in] Point in the space which is the center of the rotation.
vAxis  [in] Axis of the rotation.
fAngle  [in] Angle of the rotation in radian.
mudbox::DualQuaternion::DualQuaternion float  fAngle,
float  fPitch,
const Vector vDirection,
const Vector vMoment
 

Constructs a dual quaternion which represents a screw motion.

Parameters:
fAngle  [in] Angle of the rotation in radian.
fPitch  [in]
mudbox::DualQuaternion::DualQuaternion const Vector vTranslation,
const Quaternion vRotation
 

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

Parameters:
vTranslation  [in] Translation part of the transformation.
vRotation  [in] Rotation part of the transformation.
mudbox::DualQuaternion::DualQuaternion const Matrix mRigid  ) 
 

Constructs a dual quaternion from a matrix which represents a rigid transformation. Matrix::IsRigid().


Member Function Documentation

Matrix mudbox::DualQuaternion::ToMatrix void   )  const
 

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

Vector mudbox::DualQuaternion::Translation void   )  const
 

Returns the translation represented by this dual quaternion.

Vector mudbox::DualQuaternion::Transform const Vector vPoint  )  const
 

Transform a given point by the dual quaternion.

DualQuaternion mudbox::DualQuaternion::operator+ const DualQuaternion vAddition  )  const
 

Returns the sum of two dual quaternions.

DualQuaternion& mudbox::DualQuaternion::operator+= const DualQuaternion vAddition  ) 
 

Adds a dual quaternion to this dual quaternion.

DualQuaternion mudbox::DualQuaternion::operator- const DualQuaternion vAddition  )  const
 

Returns the substraction of two dual quaternions.

DualQuaternion& mudbox::DualQuaternion::operator-= const DualQuaternion vAddition  ) 
 

Substracts a dual quaternion from this dual quaternion.

DualQuaternion mudbox::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& mudbox::DualQuaternion::operator *= const DualQuaternion vMultiplier  ) 
 

Multiplies a quaternion by another one.

DualQuaternion mudbox::DualQuaternion::operator * float  fMultiplier  )  const
 

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

DualQuaternion& mudbox::DualQuaternion::Normalize void   ) 
 

Normalizes the dual quaternions.

Only normalized dual quaternions are valid representations of rigid transformations.

void mudbox::DualQuaternion::ToScrew float &  fAngle,
float &  fPitch,
Vector vDirection,
Vector vMoment
const
 

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

DualQuaternion& mudbox::DualQuaternion::Power float  fExponent  ) 
 

Calculates the power of the dual quaternion.

DualQuaternion mudbox::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& mudbox::DualQuaternion::Conjugate void   ) 
 

Conjugates the dual quaternion using the quaternion conjugation.

DualQuaternion& mudbox::DualQuaternion::DualConjugate void   ) 
 

Conjugates the dual quaternion using the dual conjugation.

DualQuaternion& mudbox::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().

01148 { Conjugate(); DualConjugate(); return *this; };
DualQuaternion& mudbox::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 mudbox::DualQuaternion::SetIdentity void   )  [inline]
 

Sets the dual quaternion to represents the identical transformaion.

01155 { m_vReal.SetIdentity(); m_vDual.SetZero(); };
float mudbox::DualQuaternion::operator[] int  iIndex  )  const
 

Returns the stored value inside the dual quaternion.

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

Member Data Documentation

Quaternion mudbox::DualQuaternion::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.

Quaternion mudbox::DualQuaternion::m_vDual
 

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.


mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion
mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion mudbox::DualQuaternion