CSIBCQuaterniond Class Reference

Generic class representing quaternions. More...

#include <SIBCQuaterniond.h>

List of all members.

Public Member Functions

  CSIBCQuaterniond ()
  CSIBCQuaterniond (const double in_dW, const double in_dX, const double in_dY, const double in_dZ)
  CSIBCQuaterniond (const CSIBCVector3Dd &in_vct)
  CSIBCQuaterniond (const CSIBCVector4Dd &in_vct)
bool  IsPure (double in_dEpsilon=PICO_EPS) const
double  GetLength () const
double  GetSquaredLength () const
CSIBCQuaterniond SetIdentity ()
bool  IsIdentity ()
CSIBCQuaterniond Normalize ()
double  GetW () const
double  GetX () const
double  GetY () const
double  GetZ () const
CSIBCQuaterniond SetW (const double in_dW)
CSIBCQuaterniond SetX (const double in_dX)
CSIBCQuaterniond SetY (const double in_dY)
CSIBCQuaterniond SetZ (const double in_dZ)
CSIBCVector4Dd Get (CSIBCVector4Dd &out_vct) const
void  Get (double &out_dW, double &out_dX, double &out_dY, double &out_dZ) const
CSIBCQuaterniond Set (const double in_dW, const double in_dX, const double in_dY, const double in_dZ)
CSIBCQuaterniond Set (const CSIBCVector4Dd &in_vct)
CSIBCQuaterniond Set (const CSIBCVector3Dd &in_vct)
CSIBCQuaterniond Set (const CSIBCQuaterniond &in_quat)
bool  operator== (const CSIBCQuaterniond &in_quat) const
bool  operator!= (const CSIBCQuaterniond &in_quat) const
CSIBCQuaterniond Negate ()
CSIBCQuaterniond Invert (const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Invert ()
CSIBCQuaterniond Conjugate (const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Conjugate ()
CSIBCQuaterniond Add (const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Add (const CSIBCQuaterniond &in_quat1, const CSIBCQuaterniond &in_quat2)
CSIBCQuaterniond Sub (const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Sub (const CSIBCQuaterniond &in_quat1, const CSIBCQuaterniond &in_quat2)
CSIBCQuaterniond Mul (const CSIBCQuaterniond &in_quat1, const CSIBCQuaterniond &in_quat2)
CSIBCQuaterniond Mul (const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Mul (const CSIBCVector3Dd &in_quatPure, const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Mul (const CSIBCQuaterniond &in_quat, const CSIBCVector3Dd &in_quatPure)
CSIBCQuaterniond Mul (const CSIBCQuaterniond &in_quat, const double in_dFactor)
CSIBCQuaterniond Mul (const double in_dFactor, const CSIBCQuaterniond &in_quat)
CSIBCQuaterniond Mul (const double in_dFactor)
CSIBCQuaterniond Slerp (const CSIBCQuaterniond &in_quatStart, const CSIBCQuaterniond &in_quatEnd, const double in_dU)
CSIBCQuaterniond BisectSlerp (const CSIBCQuaterniond &in_quatStart, const CSIBCQuaterniond &in_quatEnd)
CSIBCQuaterniond DoubleSlerp (const CSIBCQuaterniond &in_quatStart, const CSIBCQuaterniond &in_quatEnd)
bool  Ln (CSIBCQuaterniond &out_quat)
bool  Exp (CSIBCQuaterniond &out_quat)
CSIBCQuaterniond Squad (const CSIBCQuaterniond &in_quatB0, const CSIBCQuaterniond &in_quatS1, const CSIBCQuaterniond &in_quatS2, const CSIBCQuaterniond &in_quatB3, const double in_dU, const double in_dT)

Friends

bool  AreAlmostEqual (const CSIBCQuaterniond &in_quat1, const CSIBCQuaterniond &in_quat2, const double in_dEpsilon=PICO_EPS)
double  GetDot (const CSIBCQuaterniond &in_quat1, const CSIBCQuaterniond &in_quat2)


Detailed Description

Generic class representing quaternions.

The notation used in this quaternion class (W, X, Y, Z) makes the quaternions closely related to 4D vectors (See CSIBCVector4Dd). In general, the quaternion can be thought of as a scalar plus a vector, where the W component is the vector, and X, Y and Z are the coefficients of the I, J and K matricies respectively.

The components of the CSIBCQuaterniond class are represented by doulbe precision floating-point numbers. Its corresponding single precision class, CSIBCQuaternion, has much less functionality, thus this class is preferred.


Constructor & Destructor Documentation

CSIBCQuaterniond (  ) 

Default Constructor. Sets all components of the quaternion to zero, except W, which is set to one.

See also:
CSIBCQuaterniond::SetIdentity

CSIBCQuaterniond ( const double  in_dW,
const double  in_dX,
const double  in_dY,
const double  in_dZ  
)

Sets the new quaternion's values to those given as the parameters.

Parameters:
in_dW  The value for the W component of the quaternion.
in_dX  The value for the X component of the quaternion.
in_dY  The value for the Y component of the quaternion.
in_dZ  The value for the Z component of the quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond ( const CSIBCVector3Dd in_vct  ) 

Sets the new quaternion's vector values (X, Y, Z) as the corresponding component values in in_vct, and the W component to zero.

Parameters:
in_vct  Vector containing values for the new quaternion's vector components.
See also:
CSIBCQuaterniond::Set(const CSIBCVector3Dd&)

CSIBCQuaterniond ( const CSIBCVector4Dd in_vct  ) 

Sets the new quaternion's values as their corresponding components in in_vct.

Parameters:
in_vct  4D Vector containing component values for the new quaternion.
See also:
CSIBCQuaterniond::Set(const CSIBCVector4Dd&)


Member Function Documentation

bool IsPure ( double  in_dEpsilon = PICO_EPS  )  const

Determines whether this quaternion is a 'pure' quaternion. Pure quaternions have a zero scalar (W) component. Since this function uses floating-point comparison, a threshhold value of in_dEpsilon is used for equality comparison.

Parameters:
in_dEpsilon  Floating-point comparison error range. Defaults to PICO_EPS.
Returns:
bool true if the quaternion is pure, false otherwise.
See also:
CSIBCQuaterniond::IsIdentity

double GetLength (  )  const

Returns the length of this quaternion.

Returns:
double The length of this quaternion.
See also:
CSIBCQuaterniond::GetSquaredLength

CSIBCQuaterniond::Normalize

double GetSquaredLength (  )  const

Returns the squared length of this quaternion.

Returns:
double The squared length of this quaternion.
See also:
CSIBCQuaterniond::GetLength

CSIBCQuaterniond::Normalize

CSIBCQuaterniond& SetIdentity (  ) 

Sets this quaternion to the identity quaternion (all components zero, except W is set to one).

Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::IsIdentity

bool IsIdentity (  ) 

Determines whether this quaternion is the identity quaternion (all components zero, except W is set to one). Note that this function uses exact equality comparison, thus the components must be their exact values.

Returns:
bool true if the quaternion is the identity quaternion, false otherwise.
See also:
CSIBCQuaterniond::SetIdentity

CSIBCQuaterniond& Normalize (  ) 

Normalizes this quaternion to be a unit quaternion.

Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::GetLength

CSIBCQuaterniond::GetSquaredLength

double GetW (  )  const

Returns the W (scalar) component of the quaternion.

Returns:
double The W component of the quaternion.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

CSIBCQuaterniond::GetX

CSIBCQuaterniond::GetY

CSIBCQuaterniond::GetZ

double GetX (  )  const

Returns the X component of the quaternion.

Returns:
double The X component of the quaternion.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

CSIBCQuaterniond::GetW

CSIBCQuaterniond::GetY

CSIBCQuaterniond::GetZ

double GetY (  )  const

Returns the Y component of the quaternion.

Returns:
double The Y component of the quaternion.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

CSIBCQuaterniond::GetW

CSIBCQuaterniond::GetX

CSIBCQuaterniond::GetZ

double GetZ (  )  const

Returns the Z component of the quaternion.

Returns:
double The Z component of the quaternion.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

CSIBCQuaterniond::GetW

CSIBCQuaterniond::GetX

CSIBCQuaterniond::GetY

CSIBCQuaterniond& SetW ( const double  in_dW  ) 

Sets the W (scalar) component of the quaternion.

Parameters:
in_dW  New value for the W component of the quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond::SetX

CSIBCQuaterniond::SetY

CSIBCQuaterniond::SetZ

CSIBCQuaterniond& SetX ( const double  in_dX  ) 

Sets the X component of the quaternion.

Parameters:
in_dX  NeX value for the X component of the quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond::SetW

CSIBCQuaterniond::SetY

CSIBCQuaterniond::SetZ

CSIBCQuaterniond& SetY ( const double  in_dY  ) 

Sets the Y component of the quaternion.

Parameters:
in_dY  NeY value for the Y component of the quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond::SetW

CSIBCQuaterniond::SetX

CSIBCQuaterniond::SetZ

CSIBCQuaterniond& SetZ ( const double  in_dZ  ) 

Sets the Z component of the quaternion.

Parameters:
in_dZ  NeZ value for the Z component of the quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond::SetW

CSIBCQuaterniond::SetX

CSIBCQuaterniond::SetY

CSIBCVector4Dd& Get ( CSIBCVector4Dd out_vct  )  const

Gets the quaternion values with a CSIBCVector4Dd.

Parameters:
out_vct  Vector to receive the values of this quaternion.
Returns:
CSIBCVector4Dd& Reference to out_vct.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

void Get ( double &  out_dW,
double &  out_dX,
double &  out_dY,
double &  out_dZ  
) const

Gets the quaternion values.

Parameters:
out_dW  double to receive the W component of the quaternion.
out_dX  double to receive the X component of the quaternion.
out_dY  double to receive the Y component of the quaternion.
out_dZ  double to receive the Z component of the quaternion.
See also:
CSIBCQuaterniond::Get

CSIBCQuaterniond::Set

CSIBCQuaterniond& Set ( const double  in_dW,
const double  in_dX,
const double  in_dY,
const double  in_dZ  
)

Sets the quaternion values.

Parameters:
in_dW  New value for the W component of this quaternion.
in_dX  New value for the X component of this quaternion.
in_dY  New value for the Y component of this quaternion.
in_dZ  New value for the Z component of this quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond& Set ( const CSIBCVector4Dd in_vct  ) 

Sets this quaternion's components from the corresponding components of in_vct.

Parameters:
in_vct  Vector containing new values for the quaternion's components.
Returns:
CSIBCQuateriond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond& Set ( const CSIBCVector3Dd in_vct  ) 

Sets this quaternion's vector components from the corresponding components of in_vct. The scalar (W) component is set to zero.

Parameters:
in_vct  Vector containing new values for the quaternion's vector components.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

CSIBCQuaterniond& Set ( const CSIBCQuaterniond in_quat  ) 

Sets this quaternion's components equal to the components of in_quat.

Parameters:
in_quat  Quaternion
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Set

CSIBCQuaterniond::Get

bool operator== ( const CSIBCQuaterniond in_quat  )  const

Determines whether each of the components of this quaternion and in_quat are exactly equal to each other.

Parameters:
in_quat  Quaternion to compare equality with.
Returns:
bool true if the quaternions are exactly equal, false otherwise.
See also:
CSIBCQuaterniond::AreAlmostEqual

CSIBCQuaterniond::operator!=

bool operator!= ( const CSIBCQuaterniond in_quat  )  const

Determines whether any of the components of this quaternion and in_quat are different. Note that this function does not use floating-point comparison error, thus any difference in component values will result in a true return value.

Parameters:
in_quat  Quaternion to compare inequality with.
Returns:
bool true if the quaternions are not equal, false if they are exactly equal.
See also:
CSIBCQuaterniond::operator==

CSIBCQuaterniond::AreAlmostEqual

CSIBCQuaterniond& Negate (  ) 

Negates all components of this quaternion.

Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Invert

CSIBCQuaterniond::Conjugate

CSIBCQuaterniond& Invert ( const CSIBCQuaterniond in_quat  ) 

Sets this quaternion to the inverse of the unit quaternion in_quat. Since a unitary input quaternion is assumed, this function is equivalent to CSIBCQuaterniond::Conjugate(const CSIBCQuateriond &).

Parameters:
in_quat  Quaternion whose inverse contains the new values for this quaternion's components.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Invert

CSIBCQuaterniond::Conjugate

CSIBCQuaterniond::Normalize

CSIBCQuaterniond& Invert (  ) 

Sets this quaternion to its inverse. It is assumed that this quaternion is a unit quaternion.

Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Invert

CSIBCQuaterniond::Conjugate

CSIBCQuaterniond::Normalize

CSIBCQuaterniond& Conjugate ( const CSIBCQuaterniond in_quat  ) 

Sets this quaternion to the conjugate of in_quat. A conjugate quaternion is a quaternion that has each of its vector components negated.

Parameters:
in_quat  Quaternion whose conjugate contains the new values for this quaternion's components.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Invert

CSIBCQuaterniond::Conjugate

CSIBCQuaterniond::Normalize

CSIBCQuaterniond& Conjugate (  ) 

Sets this quaternion to its conjugate. A conjugate quaternion is a quaternion that has each of its vector components negated.

Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Invert

CSIBCQuaterniond::Conjugate

CSIBCQuaterniond::Normalize

CSIBCQuaterniond& Add ( const CSIBCQuaterniond in_quat  ) 

Adds in_quat to this quaternion.

Parameters:
in_quat  Quaternion to add to this quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Add

CSIBCQuaterniond::Sub

CSIBCQuaterniond& Add ( const CSIBCQuaterniond in_quat1,
const CSIBCQuaterniond in_quat2  
)

Adds in_quat1 and in_quat2 and stores the result in this quaternion.

Parameters:
in_quat1  First quaternion for addition.
in_quat2  Second quaternion for addition.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Add

CSIBCQuaterniond::Sub

CSIBCQuaterniond& Sub ( const CSIBCQuaterniond in_quat  ) 

Subtracts in_quat from this quaternion.

Parameters:
in_quat  Quaternion to subtract from this quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Sub

CSIBCQuaterniond::Add

CSIBCQuaterniond& Sub ( const CSIBCQuaterniond in_quat1,
const CSIBCQuaterniond in_quat2  
)

Subtracts in_quat2 from in_quat1 and stores the result in this quaterinon.

Parameters:
in_quat1  Quaternion for subtraction.
in_quat2  Quaternion to subtract from in_quat1.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Sub

CSIBCQuaterniond::Add

CSIBCQuaterniond& Mul ( const CSIBCQuaterniond in_quat1,
const CSIBCQuaterniond in_quat2  
)

Computes the right-multiplication of in_quat1 by in_quat2 (in_quat1 * in_quat2), and stores the result in this quaternion.

Parameters:
in_quat1  First quaternion for the multiplication (on the left).
in_quat2  Second quaternion for the multiplication (on the right).
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const CSIBCQuaterniond in_quat  ) 

Computes the right-multiplication of this quaternion by in_quat (this * in_quat), and stores the result in this quaternion.

Parameters:
in_quat  Quaternion for the multiplication (on the right).
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const CSIBCVector3Dd in_quatPure,
const CSIBCQuaterniond in_quat  
)

Computes the right-multiplication of the pure quaternion represented by in_quatPure, and the quaternion in_quat (in_quatPure * in_quat), and stores the result in this quaternion.

Parameters:
in_quatPure  Vector representing the vector components of a pure quaternion (W component is zero), for the multiplication (on the left).
in_quat  Quaternion for the multiplication (on the right).
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const CSIBCQuaterniond in_quat,
const CSIBCVector3Dd in_quatPure  
)

Computes the right-multiplication of the quaternion in_quat and the pure quaternion represented by in_quatPure (in_quat * in_quatPure), and stores the result in this quaternion.

Parameters:
in_quat  Quaternion for the multiplication (on the left).
in_quatPure  Vector representing the vector components of a pure quaternion (W component is zero), for the multiplication (on the right).
Returns:
CSIBCQuaterniond& Reference to this quaterion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const CSIBCQuaterniond in_quat,
const double  in_dFactor  
)

Scales in_quat by a factor of in_dFactor, and stores the result in this quaternion.

Parameters:
in_quat  Quaternion to scale.
in_dFactor  Scaling factor for quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const double  in_dFactor,
const CSIBCQuaterniond in_quat  
)

Scales in_quat by a factor of in_dFactor, and stores the result in this quaternion.

Parameters:
in_quat  Quaternion to scale.
in_dFactor  Scaling factor for quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Mul ( const double  in_dFactor  ) 

Scales this quaternion by a factor of in_dFactor.

Parameters:
in_dFactor  Scaling factor to apply to this quaternion.
Returns:
CSIBCQuaterniond& Reference to this quaternion.
See also:
CSIBCQuaterniond::Mul

CSIBCQuaterniond& Slerp ( const CSIBCQuaterniond in_quatStart,
const CSIBCQuaterniond in_quatEnd,
const double  in_dU  
)

Computes the spherical linear interpolation of two unit quaternions, where in_quatStart and in_quatEnd are the starting and ending quaternions, respectively. The interpolation point bewteen the two vectors is given by in_dU, in the range [0.0f, 1.0f]. The interpolated quaternion is stored in this quaternion.

Parameters:
in_quatStart  Unit quaternion for the starting interpolation point.
in_quatEnd  Unit quaternion for the ending interpolation end.
in_dU  Interpolation point between in_quatStart and in_quatEnd. Must be in the range [0.0f, 1.0f].
Returns:
CSIBCQuaterniond& Reference to this quaternion.

CSIBCQuaterniond& BisectSlerp ( const CSIBCQuaterniond in_quatStart,
const CSIBCQuaterniond in_quatEnd  
)

Not implemented yet.

CSIBCQuaterniond& DoubleSlerp ( const CSIBCQuaterniond in_quatStart,
const CSIBCQuaterniond in_quatEnd  
)

Not implemented yet.

bool Ln ( CSIBCQuaterniond out_quat  ) 

Not implemented yet.

bool Exp ( CSIBCQuaterniond out_quat  ) 

Not implemented yet.

CSIBCQuaterniond& Squad ( const CSIBCQuaterniond in_quatB0,
const CSIBCQuaterniond in_quatS1,
const CSIBCQuaterniond in_quatS2,
const CSIBCQuaterniond in_quatB3,
const double  in_dU,
const double  in_dT  
)

Not implemented yet.


Friends And Related Function Documentation

bool AreAlmostEqual ( const CSIBCQuaterniond in_quat1,
const CSIBCQuaterniond in_quat2,
const double  in_dEpsilon = PICO_EPS  
) [friend]

Determines whether each of the components of in_quat1 and in_quat2 are equal to each other. Since this function uses floating-point comparison, a threshhold value of in_dEpsilon is used for equality comparison.

Parameters:
in_quat1  The first quaternion for equality comparison.
in_quat2  The second quaternion for equality comparison.
in_dEpsilon  Floating-point comparison error range. Defaults to PICO_EPS.
Returns:
bool true if the quaternions are equal, false otherwise.
See also:
CSIBCQuaterniond::operator==

CSIBCQuaterniond::operator!=

double GetDot ( const CSIBCQuaterniond in_quat1,
const CSIBCQuaterniond in_quat2  
) [friend]

Computes the dot product of in_quat1 and in_quat2.

Parameters:
in_quat1  First quaternion for the dot product.
in_quat2  Second quaternion for the dot product.
Returns:
double The dot product of in_quat1 and in_quat2.


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