Om
1.0.0
A universal framework for multimedia simulation
|
A templatized math class representing a 4-component quaternion. More...
#include <omQuaternion.h>
Public Member Functions | |
Quaternion4D () | |
Create a new identity quaternion corresponding to no rotation. More... | |
Quaternion4D (T newW, T newX, T newY, T newZ) | |
Create a new quaternion by specifying it's 4 component values. More... | |
Quaternion4D (const T array[4]) | |
Create a new quaternion from a pointer to a 4 element array specifying its components. More... | |
Quaternion4D (T angle, const VectorND< T, 3 > &axis) | |
Create a new unit quaternion from a normalized axis and angle representation. More... | |
Quaternion4D (const MatrixND< T, 3, 3 > &m) | |
Create a new quaternion from a 3x3 orthonormal rotation matrix. More... | |
template<typename U > | |
Quaternion4D (const Quaternion4D< U > &quaternion) | |
Create a new quaternion from an existing quaternion with different template type. More... | |
T | getMagnitude () const |
Return the magnitude (norm) of this quaternion. More... | |
T | getNorm () const |
Return the magnitude (norm) of this quaternion. More... | |
T | getMagnitudeSquared () const |
Return the squared magnitude (norm) of this quaternion. More... | |
Quaternion4D< T > | normalize () const |
Return a normalized version of this quaternion. More... | |
Quaternion4D< T > | normalize (T &magnitude) const |
Return a normalized version of this quaternion, placing the quaternion's magnitude in the output parameter. More... | |
Quaternion4D< T > | invert () const |
Return the inverse of this quaternion. More... | |
Quaternion4D< T > | invertNormalized () const |
Return the inverse of this normalized quaternion. More... | |
MatrixND< T, 3, 3 > | toMatrix () const |
Return the inverse of this quaternion. More... | |
MatrixND< T, 3, 3 > | toMatrixNormalized () const |
Return the inverse of this normalized quaternion. More... | |
const T * | toArray () const |
Return a shallow array representation of this quaternion. More... | |
T | getW () const |
Return the W coordinate (real part) of this quaternion. More... | |
T | getX () const |
Return the X coordinate of this quaternion. More... | |
T | getY () const |
Return the Y coordinate of this quaternion. More... | |
T | getZ () const |
Return the Z coordinate of this quaternion. More... | |
T | getXYZ () const |
Return the XYZ vector of this quaternion. More... | |
T | getAngle () const |
Return the rotation angle in radians that this quaternion describes. More... | |
VectorND< T, 3 > | getAxis () const |
Return the normalized axis of rotation for this quaternion. More... | |
Bool | operator== (const Quaternion4D< T > &q) const |
Compare two quaternions component-wise for equality. More... | |
Bool | operator!= (const Quaternion4D< T > &q) const |
Compare two quaternions component-wise for inequality. More... | |
Quaternion4D< T > | operator+ (const Quaternion4D< T > &q) const |
Add this quaternion to another and return the result. More... | |
Quaternion4D< T > | operator- (const Quaternion4D< T > &q) const |
Subtract a quaternion from this quaternion component-wise and return the result. More... | |
Quaternion4D< T > | operator* (const Quaternion4D< T > &q) const |
Multiply this quaternion and another quaternion. More... | |
Quaternion4D< T > | operator* (const T &value) const |
Multiply every component of this quaternion by a value and return the result. More... | |
Quaternion4D< T > | operator/ (const T &value) const |
Divide every component of this quaternion by a value and return the result. More... | |
Quaternion4D< T > & | operator+= (const Quaternion4D< T > &q) |
Add a quaternion to this quaternion, modifying this original quaternion. More... | |
Quaternion4D< T > & | operator-= (const Quaternion4D< T > &q) |
Subtract a quaternion from this quaternion, modifying this original quaternion. More... | |
Quaternion4D< T > & | operator*= (const Quaternion4D< T > &q) |
Multiply component-wise this quaternion and another quaternion and modify this quaternion. More... | |
Quaternion4D< T > & | operator*= (const T &value) |
Multiply a value with each component of this quaternion, modifying it. More... | |
Quaternion4D< T > & | operator/= (const T &value) |
Divide each component of this quaternion by a value, modifying it. More... | |
data::String | toString () const |
Convert this quaternion into a human-readable string representation. More... | |
operator data::String () const | |
Convert this quaternion into a human-readable string representation. More... | |
Public Attributes | |
T | w |
The W coordinate of a quaternion, the real coordinate. More... | |
T | x |
The X coordinate of a quaternion, the first imaginary coordinate. More... | |
T | y |
The Y coordinate of a quaternion, the second imaginary coordinate. More... | |
T | z |
The Z coordinate of a quaternion, the third imaginary coordinate. More... | |
Static Public Attributes | |
static const Quaternion4D< T > | ZERO |
A constant quaternion with all elements equal to zero. More... | |
static const Quaternion4D< T > | IDENTITY |
A constant quaternion representing no rotation. More... | |
A templatized math class representing a 4-component quaternion.
|
inline |
Create a new identity quaternion corresponding to no rotation.
|
inline |
Create a new quaternion by specifying it's 4 component values.
|
inline |
Create a new quaternion from a pointer to a 4 element array specifying its components.
|
inline |
Create a new unit quaternion from a normalized axis and angle representation.
|
inline |
Create a new quaternion from a 3x3 orthonormal rotation matrix.
|
inline |
Create a new quaternion from an existing quaternion with different template type.
This constructor takes the x, y, z, and w values of the quaternion parameter and sets the coordinates of this quaternion to be the same. This is a templatized version of the copy constructor.
quaternion | - The quaternion to be copied. |
|
inline |
Return the magnitude (norm) of this quaternion.
|
inline |
Return the magnitude (norm) of this quaternion.
|
inline |
Return the squared magnitude (norm) of this quaternion.
|
inline |
Return a normalized version of this quaternion.
This method normalizes this quaternion by dividing each component by the quaternion's magnitude and returning the result. This method does not modify the original quaternion.
|
inline |
Return a normalized version of this quaternion, placing the quaternion's magnitude in the output parameter.
This method normalizes this quaternion by dividing each component by the quaternion's magnitude and returning the result. This method does not modify the original quaternion. The magnitude of the original quaternion is returned in the output parameter.
|
inline |
Return the inverse of this quaternion.
This method makes no assumptions about the quaternion's magnitude. If inverting a unit-length quaternion, use invertNormalized() instead because it is significantly fast.
|
inline |
Return the inverse of this normalized quaternion.
This method assumes that the quaternion is of unit length. This greatly simplifies the calculations needed to invert the quaternion.
|
inline |
Return the inverse of this quaternion.
This method makes no assumptions about the quaternion's magnitude. If converting a unit-length quaternion, use toMatrixNormalized() instead because it is significantly faster.
|
inline |
Return the inverse of this normalized quaternion.
This method assumes that the quaternion is of unit length. This greatly simplifies the calculations needed to convert the quaternion to a matrix.
|
inline |
Return a shallow array representation of this quaternion.
This method returns a pointer to the address of the X coordinate of the quaternion and does not do any copying of the elements. Therefore, this method should only be used where one needs an array representation of a quaternion without having to allocate more memory and copy the quaternion.
|
inline |
Return the W coordinate (real part) of this quaternion.
|
inline |
Return the X coordinate of this quaternion.
|
inline |
Return the Y coordinate of this quaternion.
|
inline |
Return the Z coordinate of this quaternion.
|
inline |
Return the XYZ vector of this quaternion.
|
inline |
Return the rotation angle in radians that this quaternion describes.
|
inline |
Return the normalized axis of rotation for this quaternion.
|
inline |
Compare two quaternions component-wise for equality.
|
inline |
Compare two quaternions component-wise for inequality.
|
inline |
Add this quaternion to another and return the result.
This method adds another quaternion to this one, component-wise, and returns this addition. It does not modify either of the original quaternions.
q | - The quaternion to add to this one. |
|
inline |
Subtract a quaternion from this quaternion component-wise and return the result.
This method subtracts another quaternion from this one, component-wise, and returns this subtraction. It does not modify either of the original quaternions.
q | - The quaternion to subtract from this one. |
|
inline |
Multiply this quaternion and another quaternion.
This operation, like matrix multiplication, is not commutative.
|
inline |
Multiply every component of this quaternion by a value and return the result.
This method multiplies the value parameter with every component of the quaternion, and returns a quaternion representing this result. It does not modifiy the original quaternion.
value | - The value to multiplly with all components of this quaternion. |
|
inline |
Divide every component of this quaternion by a value and return the result.
This method divides every component of the quaternion by the value parameter, and returns a quaternion representing this result. It does not modifiy the original quaternion.
value | - The value to divide all components of this quaternion by. |
|
inline |
Add a quaternion to this quaternion, modifying this original quaternion.
This method adds another quaternion to this quaternion, component-wise, and sets this quaternion to have the result of this addition.
q | - The quaternion to add to this quaternion. |
|
inline |
Subtract a quaternion from this quaternion, modifying this original quaternion.
This method subtracts another quaternion from this quaternion, component-wise, and sets this quaternion to have the result of this subtraction.
q | - The quaternion to subtract from this quaternion. |
|
inline |
Multiply component-wise this quaternion and another quaternion and modify this quaternion.
This operator multiplies each component of this quaternion by the corresponding component of the other quaternion and modifies this quaternion to contain the result.
q | - The quaternion to multiply this quaternion by. |
|
inline |
Multiply a value with each component of this quaternion, modifying it.
This operator multiplies a value with each component of this quaternion and modifies this quaternion to store the result.
value | - The value to multiply with every component of this quaternion. |
|
inline |
Divide each component of this quaternion by a value, modifying it.
This operator Divides each component of this quaternion by value and modifies this quaternion to store the result.
value | - The value to multiply with every component of this quaternion. |
|
inline |
Convert this quaternion into a human-readable string representation.
|
inline |
Convert this quaternion into a human-readable string representation.
T om::math::Quaternion4D< T >::w |
The W coordinate of a quaternion, the real coordinate.
T om::math::Quaternion4D< T >::x |
The X coordinate of a quaternion, the first imaginary coordinate.
T om::math::Quaternion4D< T >::y |
The Y coordinate of a quaternion, the second imaginary coordinate.
T om::math::Quaternion4D< T >::z |
The Z coordinate of a quaternion, the third imaginary coordinate.
|
static |
A constant quaternion with all elements equal to zero.
|
static |
A constant quaternion representing no rotation.