Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DQuaternion Class Reference

The U4DQuaternion class is responsible for implementing Quaternion operations in the engine. These operations include: Quaternion addition, subtraction, multiplication, normalization, etc. More...

Public Member Functions

 U4DQuaternion ()
 Default Constructor which creates a Real Quaternion. That is, it creates a quaternion with a scalar equal to 1.0 and a zero vector.
 
 U4DQuaternion (float uS, U4DVector3n &uV)
 Quaternion constructor which creates a quaternion with given scalar and vector component.
 
 ~U4DQuaternion ()
 Default quaternion destructor.
 
 U4DQuaternion (const U4DQuaternion &value)
 Quaternion Copy Constructor. More...
 
U4DQuaternionoperator= (const U4DQuaternion &value)
 Quaternion Copy Constructor. More...
 
void operator+= (const U4DQuaternion &q)
 Method which adds two quaternions. More...
 
U4DQuaternion operator+ (const U4DQuaternion &q) const
 Method which adds two quaternions. More...
 
void operator-= (const U4DQuaternion &q)
 Method which subtracts two quaternions. More...
 
U4DQuaternion operator- (const U4DQuaternion &q) const
 Method which subtracts two quaternions. More...
 
void operator*= (const U4DQuaternion &q)
 Method which multiplies two quaternions. More...
 
U4DQuaternion operator* (const U4DQuaternion &q) const
 Method which multiplies two quaternions. More...
 
U4DQuaternion multiply (const U4DQuaternion &q) const
 Method which multiplies two quaternions. More...
 
U4DQuaternion operator* (const U4DVector3n &uValue) const
 Method which multiplies a quaternion times a 3D vector. More...
 
float dot (U4DQuaternion &q)
 Method which computes the dot product between two quaternions. More...
 
void operator*= (const float value)
 Method which computes the multiplication between a quaternion and scalar. More...
 
U4DQuaternion operator* (const float value) const
 Method which computes the multiplication between a quaternion and scalar. More...
 
float norm ()
 Method which computes the norm of the quaternion. More...
 
void normalize ()
 Method which normalizes the quaternion.
 
U4DQuaternion conjugate ()
 Method which computes the conjugate of the quaternion. More...
 
U4DQuaternion inverse ()
 Method which computes the inverse of the quaternion. More...
 
void inverse (U4DQuaternion &q)
 Method which computes the inverse of the quaternion. More...
 
void convertToUnitNormQuaternion ()
 Method which converts the quaternion into a Unit-Norm quaternion.
 
U4DMatrix3n transformQuaternionToMatrix3n ()
 Method that computes the 3x3 matrix representation of the quaternion. More...
 
void transformEulerAnglesToQuaternion (float x, float y, float z)
 Method that computes a quaternion representation from an Euler angle. More...
 
U4DVector3n transformQuaternionToEulerAngles ()
 Method which computes a quaternion to its Euler angle representation. More...
 
void transformMatrix3nToQuaternion (U4DMatrix3n &uMatrix)
 Method that computes a quaternion from its 3x3 matrix representation. More...
 
U4DQuaternion slerp (U4DQuaternion &q, float time)
 Method that computes the slerp of a quaternion. More...
 
void show ()
 Method which prints the quaternion components to the window console log.
 

Public Attributes

float s
 Scalar component of quaternion.
 
U4DVector3n v
 Vector component of quaternion.
 

Detailed Description

The U4DQuaternion class is responsible for implementing Quaternion operations in the engine. These operations include: Quaternion addition, subtraction, multiplication, normalization, etc.

Constructor & Destructor Documentation

◆ U4DQuaternion()

U4DEngine::U4DQuaternion::U4DQuaternion ( const U4DQuaternion value)

Quaternion Copy Constructor.

Parameters
valueQuaternion to copy
Returns
returns a copy of the quaternion

Member Function Documentation

◆ conjugate()

U4DQuaternion U4DEngine::U4DQuaternion::conjugate ( )

Method which computes the conjugate of the quaternion.

Returns
Returns the conjugate of the quaternion

◆ dot()

float U4DEngine::U4DQuaternion::dot ( U4DQuaternion q)

Method which computes the dot product between two quaternions.

Parameters
qQuaternion to compute the dot product with
Returns
Returns the dot product between the quaternions

◆ inverse() [1/2]

U4DQuaternion U4DEngine::U4DQuaternion::inverse ( )

Method which computes the inverse of the quaternion.

Returns
Returns the inverse of the quaternion

◆ inverse() [2/2]

void U4DEngine::U4DQuaternion::inverse ( U4DQuaternion q)

Method which computes the inverse of the quaternion.

Parameters
qQuaternion to compute the inverse

◆ multiply()

U4DQuaternion U4DEngine::U4DQuaternion::multiply ( const U4DQuaternion q) const

Method which multiplies two quaternions.

Parameters
qQuaternion to multiply
Returns
Returns the multiplication of two quaternions

◆ norm()

float U4DEngine::U4DQuaternion::norm ( )

Method which computes the norm of the quaternion.

Returns
Returns the norm of the quaternion

◆ operator*() [1/3]

U4DQuaternion U4DEngine::U4DQuaternion::operator* ( const float  value) const

Method which computes the multiplication between a quaternion and scalar.

Parameters
valueScalar to multiply the quaternion
Returns
Returns the multiplication result between the scalar and quaternion

◆ operator*() [2/3]

U4DQuaternion U4DEngine::U4DQuaternion::operator* ( const U4DQuaternion q) const

Method which multiplies two quaternions.

Parameters
qQuaternion to multiply
Returns
Returns the multiplication of two quaternions

◆ operator*() [3/3]

U4DQuaternion U4DEngine::U4DQuaternion::operator* ( const U4DVector3n uValue) const

Method which multiplies a quaternion times a 3D vector.

Parameters
uValue3D vector to multiply
Returns
Returns the multiplication of the quaternion and vector

◆ operator*=() [1/2]

void U4DEngine::U4DQuaternion::operator*= ( const float  value)

Method which computes the multiplication between a quaternion and scalar.

Parameters
valueScalar to multiply the quaternion
Returns
Returns the multiplication result between the scalar and quaternion

◆ operator*=() [2/2]

void U4DEngine::U4DQuaternion::operator*= ( const U4DQuaternion q)

Method which multiplies two quaternions.

Parameters
qQuaternion to multiply
Returns
Returns the multiplication of two quaternions

◆ operator+()

U4DQuaternion U4DEngine::U4DQuaternion::operator+ ( const U4DQuaternion q) const

Method which adds two quaternions.

Parameters
qQuaternion to add
Returns
Returns the addition result of the two quaternions

◆ operator+=()

void U4DEngine::U4DQuaternion::operator+= ( const U4DQuaternion q)

Method which adds two quaternions.

Parameters
qQuaternion to add
Returns
Returns the addition result of the two quaternions

◆ operator-()

U4DQuaternion U4DEngine::U4DQuaternion::operator- ( const U4DQuaternion q) const

Method which subtracts two quaternions.

Parameters
qQuaternion to subtract
Returns
Returns the subtraction difference of the two quaternions

◆ operator-=()

void U4DEngine::U4DQuaternion::operator-= ( const U4DQuaternion q)

Method which subtracts two quaternions.

Parameters
qQuaternion to subtract
Returns
Returns the subtraction difference of the two quaternions

◆ operator=()

U4DQuaternion & U4DEngine::U4DQuaternion::operator= ( const U4DQuaternion value)

Quaternion Copy Constructor.

Parameters
valueQuaternion to copy
Returns
returns a copy of the quaternion

◆ slerp()

U4DQuaternion U4DEngine::U4DQuaternion::slerp ( U4DQuaternion q,
float  time 
)

Method that computes the slerp of a quaternion.

Parameters
U4DQuaternion&qQuaternion to compute the slerp
timeTime value
Returns
Returns the slerp of the quaternion

◆ transformEulerAnglesToQuaternion()

void U4DEngine::U4DQuaternion::transformEulerAnglesToQuaternion ( float  x,
float  y,
float  z 
)

Method that computes a quaternion representation from an Euler angle.

Parameters
xThe x component of the euler angle
yThe y component of the euler angle
zThe z component of the euler angle

◆ transformMatrix3nToQuaternion()

void U4DEngine::U4DQuaternion::transformMatrix3nToQuaternion ( U4DMatrix3n uMatrix)

Method that computes a quaternion from its 3x3 matrix representation.

Parameters
uMatrix3x3 matrix to convert

◆ transformQuaternionToEulerAngles()

U4DVector3n U4DEngine::U4DQuaternion::transformQuaternionToEulerAngles ( )

Method which computes a quaternion to its Euler angle representation.

Returns
Returns an Euler Angle representation of the quaternion

◆ transformQuaternionToMatrix3n()

U4DMatrix3n U4DEngine::U4DQuaternion::transformQuaternionToMatrix3n ( )

Method that computes the 3x3 matrix representation of the quaternion.

You need to convert the quaternion to a Unit Norm quaternion before using this method.

Returns
Returns a 3x3 matrix representation of the quaternion