class RED::Quaternion

Quaternion for graphical operations. More...

#include <REDQuaternion.h>

Inherits: Object.

Public functions:

Quaternion ( const double data[4] )
Quaternion ( )
Quaternion ( double iX, double iY, double iZ, double iW )
Quaternion ( const float data[4] )
virtual ~Quaternion ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
voidConjugate ( )
doubleDot ( const RED::Quaternion & iQ ) const
voidGetAxisAngle ( RED::Vector3 & oAxis, double & oAngle ) const
doubleGetLength ( ) const
doubleGetLength2 ( ) const
voidGetRotationMatrix ( RED::Matrix & oRotationMatrix ) const
voidInvert ( )
doubleNormalize ( )
booloperator!= ( const RED::Quaternion & iOther ) const
RED::Quaternionoperator* ( double iScalar ) const
RED::Quaternionoperator* ( const RED::Quaternion & iRight ) const
voidoperator*= ( double iScalar )
voidoperator*= ( const RED::Quaternion & iRight )
RED::Quaternionoperator+ ( const RED::Quaternion & iSource ) const
voidoperator+= ( const RED::Quaternion & iSource )
RED::Quaternionoperator- ( const RED::Quaternion & iRight ) const
RED::Quaternionoperator- ( ) const
voidoperator-= ( const RED::Quaternion & iSource )
RED::Quaternionoperator/ ( double iScalar ) const
voidoperator/= ( double iScalar )
booloperator== ( const RED::Quaternion & iOther ) const
doubleoperator[] ( unsigned int iIndex ) const
double &operator[] ( unsigned int iIndex )
voidSet ( double iX, double iY, double iZ, double iW )
voidSetAxisAngle ( const RED::Vector3 & iAxis, double iAngle )
voidSetRotationMatrix ( const RED::Matrix & iRotationMatrix )
voidSlerp ( const RED::Quaternion & iQuatFrom, const RED::Quaternion & iQuatTo, double iWeight )
doubleW ( ) const
doubleX ( ) const
doubleY ( ) const
doubleZ ( ) const

Public static functions:

static RED::CIDGetClassID ( )

Public variables:

double_w
double_x
double_y
double_z

Public static variables:

static const RED::QuaternionIDENTITY
static const RED::QuaternionZERO

Detailed description:

Quaternion for graphical operations.

The quaternion is of the form q = x*i + y*j + z*k + w.

Functions documentation

public RED::Quaternion::Quaternion(const doubledata[4])

construction for a four double array.

Parameters:

data:array containing the four double precision floating-point vector values.

Quaternion construction method.

Builds a unit quaternion ( 0, 0, 0, 1 ).

public RED::Quaternion::Quaternion(doubleiX,
doubleiY,
doubleiZ,
doubleiW
)

Constructor.

Parameters:

iX:X dimension of the quaternion.
iY:Y dimension of the quaternion.
iZ:Z dimension of the quaternion.
iW:W dimension of the quaternion.
public RED::Quaternion::Quaternion(const floatdata[4])

construction for a four floats array.

Parameters:

data:array containing the four floating-point vector values.

Destructor.

public virtual void * RED::Quaternion::As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

public virtual const void * RED::Quaternion::As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public const T_As * RED::Quaternion::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public T_As * RED::Quaternion::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

'In-place' conjugate of 'this'.

Computes the conjugate of this, replacing the previous quaternion contents.

public double RED::Quaternion::Dot(const RED::Quaternion &iQ) const

Dot product of two quaternions.

Parameters:

iQ:Right operand of the dot product.

Returns:

The dot product of the two quaternions.
public void RED::Quaternion::GetAxisAngle(RED::Vector3 &oAxis,
double &oAngle
)const

Gets the axis angle rotation from this quaternion.

Parameters:

oAxis:Returned rotation axis.
oAngle:Returned rotation angle.
public double RED::Quaternion::GetLength() const

Gets the length of the quaternion.

Returns:

sqrt( x*x + y*y + z*z + w*w ).
public double RED::Quaternion::GetLength2() const

Gets the squared length of the quaternion.

Returns:

The squared length of the quaternion.
public void RED::Quaternion::GetRotationMatrix(RED::Matrix &oRotationMatrix) const

Gets the rotation matrix from this quaternion.

Parameters:

oRotationMatrix:Returned rotation matrix.

'In-place' inversion of 'this'.

Computes the inverse of this, replacing the previous quaternion contents.

Normalizes the quaternion.

Calculates the length of the quaternion( x*x + y*y + z*z + w*w ) and divides the components by this length.

Returns:

The length of the quaternion before normalization.
public bool RED::Quaternion::operator!=(const RED::Quaternion &iOther) const

Returns the result of a difference test between two quaternions.

Parameters:

iOther:Reference to the quaternion to test with.

Returns:

true if the two quaternions are different, false otherwise.
public RED::Quaternion RED::Quaternion::operator*(doubleiScalar) const

Multiplies the components of a quaternion with a scalar.

Parameters:

iScalar:Number to multiply the quaternion with.

Returns:

The product of the quaternion with the scalar.

Multiplication of two vectors.

Parameters:

iRight:Quaternion to multiply to this.

Returns:

The product of the two quaternions.
public void RED::Quaternion::operator*=(doubleiScalar)

Multiplies the components of the quaternion with a scalar.

Parameters:

iScalar:Number to multiply the quaternion with.
public void RED::Quaternion::operator*=(const RED::Quaternion &iRight)

Multiplication of two quaternions.

Store in this the result of the product of this with iRight.

Parameters:

iRight:Quaternion to multiply to this.

Addition operation.

Builds a new quaternion by the addition of two others.

Returns:

the sum of the two input quaternions.
public void RED::Quaternion::operator+=(const RED::Quaternion &iSource)

Increment operation.

Adds the iSource quaternion to this.

Parameters:

iSource:Added term.

Subtraction operation.

Builds a new quaternion by the subtraction of two others.

Parameters:

iRight:Right operand of the subtraction

Returns:

the subtraction of the two input quaternions.

Returns the opposite of the quaternion.

Returns:

-this
public void RED::Quaternion::operator-=(const RED::Quaternion &iSource)

Decrement operation.

Subtracts the iSource quaternion to this.

Parameters:

iSource:Subtracted term.
public RED::Quaternion RED::Quaternion::operator/(doubleiScalar) const

Divides the components of a quaternion by a scalar.

Parameters:

iScalar:Number to divide the quaternion by.

Returns:

The division of the quaternion by the scalar.
public void RED::Quaternion::operator/=(doubleiScalar)

Divides the components of the quaternion by a scalar.

Parameters:

iScalar:Number to divide the quaternion by.
public bool RED::Quaternion::operator==(const RED::Quaternion &iOther) const

Returns the result of an equality test between two quaternions.

Parameters:

iOther:Reference to the quaternion to test with.

Returns:

true if the two quaternions are identical, false otherwise.
public double RED::Quaternion::operator[](unsigned intiIndex) const

Gets the n-th component of a quaternion.

Returns:

The n-th component of the quaternion.
public double & RED::Quaternion::operator[](unsigned intiIndex)

Gets the n-th component of a quaternion in read-write mode.

Returns:

A reference to the n-th component of the quaternion.
public void RED::Quaternion::Set(doubleiX,
doubleiY,
doubleiZ,
doubleiW
)

Sets the four component of a quaternion.

Parameters:

iX:First component.
iY:Second component.
iZ:Third component.
iW:Fourth component.
public void RED::Quaternion::SetAxisAngle(const RED::Vector3 &iAxis,
doubleiAngle
)

Sets the quaternion from an axis angle rotation .

Parameters:

iAxis:The rotation axis.
iAngle:The rotation angle.
public void RED::Quaternion::SetRotationMatrix(const RED::Matrix &iRotationMatrix)

Sets the quaternion from a rotation matrix.

Parameters:

iRotationMatrix:Rotation matrix to set the quaternion from.
public void RED::Quaternion::Slerp(const RED::Quaternion &iQuatFrom,
const RED::Quaternion &iQuatTo,
doubleiWeight
)

Computes the Spherical Linear Interpolation between two quaternions.

Parameters:

iQuatFrom:Starting quaternion.
iQuatTo:Ending quaternion.
iWeight:weight value between 0 and 1.
public double RED::Quaternion::W() const

Returns:

The W dimension of the quaternion.
public double RED::Quaternion::X() const

Returns:

The X dimension of the quaternion.
public double RED::Quaternion::Y() const

Returns:

The Y dimension of the quaternion.
public double RED::Quaternion::Z() const

Returns:

The Z dimension of the quaternion.

Variables documentation

public double RED::Quaternion::_w

W dimension of the vector.

public double RED::Quaternion::_x

X dimension of the vector.

public double RED::Quaternion::_y

Y dimension of the vector.

public double RED::Quaternion::_z

Z dimension of the vector.

Identity quaternion.

Zero quaternion.