Drag[en]gine Game Engine
1.21
|
4 Component Quaternion. More...
#include <decQuaternion.h>
Public Member Functions | |
Constructors and Destructors | |
decQuaternion () | |
Create new quaternion initialized to no rotation. More... | |
decQuaternion (float nx, float ny, float nz, float nw) | |
Create new quaternion with the given values. More... | |
decQuaternion (const decQuaternion &q) | |
Create new quaternion with the values of another quaternion. More... | |
Management | |
float | Length () const |
Length of the quaternion. More... | |
void | Normalize () |
decQuaternion | Normalized () const |
Normalized quaternion. More... | |
decQuaternion | Conjugate () const |
Conjugation of this quaternion. More... | |
const decQuaternion | Absolute () const |
Retrieves absolute quaternion. More... | |
float | Dot (const decQuaternion &q) const |
Dot-product. More... | |
const decVector | GetEulerAngles () const |
Retrieves quaternion as euler angles. More... | |
decQuaternion | Slerp (const decQuaternion &other, float factor) const |
Calculates the slerp of this quaternion with another given an interpolation factor. More... | |
bool | IsEqualTo (const decQuaternion &q, float threshold=QUATERNION_THRESHOLD) const |
Two quaternions are equal component wise with respect to a threshold. More... | |
bool | SameRotation (const decQuaternion &q, float threshold=QUATERNION_THRESHOLD) const |
Two quaternions represent the same rotation with respect to a threshold. More... | |
void | SetZero () |
Sets all components to 0 and w to 1. More... | |
void | Set (float nx, float ny, float nz, float nw) |
Set components to the given values. More... | |
void | Set (const decQuaternion &q) |
Set quaternion from another one. More... | |
void | SetFromEuler (float rx, float ry, float rz) |
Set from euler angles. More... | |
void | SetFromEuler (const decVector &angles) |
Set from euler angles. More... | |
void | SetFromEulerX (float angle) |
Set from an euler angle around the x axis. More... | |
void | SetFromEulerY (float angle) |
Set from an euler angle around the y axis. More... | |
void | SetFromEulerZ (float angle) |
Set from an euler angle around the z axis. More... | |
void | SetFromAxis (const decVector &axis, float angle) |
Set from axis and rotation angle around axis. More... | |
Operators | |
decQuaternion | operator- () const |
Negation of this quaternion. More... | |
decQuaternion & | operator= (const decQuaternion &q) |
Set components of this quaternion to the values of another one. More... | |
decQuaternion & | operator+= (const decQuaternion &q) |
Adds the components of another quaternion to this one. More... | |
decQuaternion & | operator-= (const decQuaternion &q) |
Subtracts the components of another quaternion from this quaternion. More... | |
decQuaternion & | operator*= (float k) |
Multiplies the components of this quaternion with a value k. More... | |
decQuaternion & | operator*= (const decQuaternion &q) |
Multiply this quaternion with another quaternion. More... | |
decQuaternion & | operator/= (float k) |
Divides components by a value k. If the value k is 0 an exception is thrown. More... | |
decQuaternion | operator+ (const decQuaternion &q) const |
Quaternion with the sum of this quaternion with another one. More... | |
decQuaternion | operator- (const decQuaternion &q) const |
Quaternion with the difference of this quaternion to another one. More... | |
decQuaternion | operator* (float k) const |
Quaternion scaled by k. More... | |
decQuaternion | operator* (const decQuaternion &q) const |
Quaternion multiplied by another quaternion. More... | |
decQuaternion | operator/ (float k) const |
Quaternion divided by k. If k is 0 an exception is thrown. More... | |
decVector | operator* (const decVector &v) const |
Rotate a vector by this quaternion. More... | |
decDVector | operator* (const decDVector &v) const |
Rotate a vector by this quaternion. More... | |
bool | operator< (const decQuaternion &q) const |
All components are less then the components of another one. More... | |
bool | operator> (const decQuaternion &q) const |
All components are greater then the components of another one. More... | |
bool | operator<= (const decQuaternion &q) const |
All components are less then or equal to the components of another one. More... | |
bool | operator>= (const decQuaternion &q) const |
All components are greater then or equal to the components of another one. More... | |
Static Public Member Functions | |
Quaternion Creation | |
static decQuaternion | CreateFromEuler (float rx, float ry, float rz) |
Create new quaternion from euler angles. More... | |
static decQuaternion | CreateFromEuler (const decVector &angles) |
Create new quaternion from euler angles. More... | |
static decQuaternion | CreateFromEulerX (float angle) |
Create new quaternion from an euler angle around the x axis. More... | |
static decQuaternion | CreateFromEulerY (float angle) |
Create new quaternion from an euler angle around the y axis. More... | |
static decQuaternion | CreateFromEulerZ (float angle) |
Create new quaternion from an euler angle around the z axis. More... | |
static decQuaternion | CreateFromAxis (const decVector &axis, float angle) |
Create from axis and rotation angle around axis. More... | |
Public Attributes | |
float | w |
W Component of quaternion. More... | |
float | x |
X Component of quaternion. More... | |
float | y |
Y Component of quaternion. More... | |
float | z |
Z Component of quaternion. More... | |
4 Component Quaternion.
decQuaternion::decQuaternion | ( | ) |
Create new quaternion initialized to no rotation.
decQuaternion::decQuaternion | ( | float | nx, |
float | ny, | ||
float | nz, | ||
float | nw | ||
) |
Create new quaternion with the given values.
decQuaternion::decQuaternion | ( | const decQuaternion & | q | ) |
Create new quaternion with the values of another quaternion.
const decQuaternion decQuaternion::Absolute | ( | ) | const |
Retrieves absolute quaternion.
decQuaternion decQuaternion::Conjugate | ( | ) | const |
Conjugation of this quaternion.
This yields the inverse rotation of the quaterion.
|
static |
Create from axis and rotation angle around axis.
|
static |
Create new quaternion from euler angles.
|
static |
Create new quaternion from euler angles.
|
static |
Create new quaternion from an euler angle around the x axis.
|
static |
Create new quaternion from an euler angle around the y axis.
|
static |
Create new quaternion from an euler angle around the z axis.
float decQuaternion::Dot | ( | const decQuaternion & | q | ) | const |
Dot-product.
const decVector decQuaternion::GetEulerAngles | ( | ) | const |
Retrieves quaternion as euler angles.
bool decQuaternion::IsEqualTo | ( | const decQuaternion & | q, |
float | threshold = QUATERNION_THRESHOLD |
||
) | const |
Two quaternions are equal component wise with respect to a threshold.
float decQuaternion::Length | ( | ) | const |
Length of the quaternion.
void decQuaternion::Normalize | ( | ) |
\breief Normalize quaternion.
If the length of the quaternion is 0 an exception is thrown.
decQuaternion decQuaternion::Normalized | ( | ) | const |
Normalized quaternion.
If the length of the quaterion is 0 an exception is thrown.
decDVector decQuaternion::operator* | ( | const decDVector & | v | ) | const |
Rotate a vector by this quaternion.
decQuaternion decQuaternion::operator* | ( | const decQuaternion & | q | ) | const |
Quaternion multiplied by another quaternion.
decQuaternion decQuaternion::operator* | ( | float | k | ) | const |
Quaternion scaled by k.
decQuaternion& decQuaternion::operator*= | ( | const decQuaternion & | q | ) |
Multiply this quaternion with another quaternion.
decQuaternion& decQuaternion::operator*= | ( | float | k | ) |
Multiplies the components of this quaternion with a value k.
decQuaternion decQuaternion::operator+ | ( | const decQuaternion & | q | ) | const |
Quaternion with the sum of this quaternion with another one.
decQuaternion& decQuaternion::operator+= | ( | const decQuaternion & | q | ) |
Adds the components of another quaternion to this one.
decQuaternion decQuaternion::operator- | ( | ) | const |
Negation of this quaternion.
decQuaternion decQuaternion::operator- | ( | const decQuaternion & | q | ) | const |
Quaternion with the difference of this quaternion to another one.
decQuaternion& decQuaternion::operator-= | ( | const decQuaternion & | q | ) |
Subtracts the components of another quaternion from this quaternion.
decQuaternion decQuaternion::operator/ | ( | float | k | ) | const |
Quaternion divided by k. If k is 0 an exception is thrown.
decQuaternion& decQuaternion::operator/= | ( | float | k | ) |
Divides components by a value k. If the value k is 0 an exception is thrown.
bool decQuaternion::operator< | ( | const decQuaternion & | q | ) | const |
All components are less then the components of another one.
bool decQuaternion::operator<= | ( | const decQuaternion & | q | ) | const |
All components are less then or equal to the components of another one.
decQuaternion& decQuaternion::operator= | ( | const decQuaternion & | q | ) |
Set components of this quaternion to the values of another one.
bool decQuaternion::operator> | ( | const decQuaternion & | q | ) | const |
All components are greater then the components of another one.
bool decQuaternion::operator>= | ( | const decQuaternion & | q | ) | const |
All components are greater then or equal to the components of another one.
bool decQuaternion::SameRotation | ( | const decQuaternion & | q, |
float | threshold = QUATERNION_THRESHOLD |
||
) | const |
Two quaternions represent the same rotation with respect to a threshold.
Same as
. In particular quaternions of the same rotation are not required to be equal.
void decQuaternion::Set | ( | const decQuaternion & | q | ) |
Set quaternion from another one.
void decQuaternion::Set | ( | float | nx, |
float | ny, | ||
float | nz, | ||
float | nw | ||
) |
Set components to the given values.
void decQuaternion::SetFromAxis | ( | const decVector & | axis, |
float | angle | ||
) |
Set from axis and rotation angle around axis.
void decQuaternion::SetFromEuler | ( | const decVector & | angles | ) |
Set from euler angles.
void decQuaternion::SetFromEuler | ( | float | rx, |
float | ry, | ||
float | rz | ||
) |
Set from euler angles.
void decQuaternion::SetFromEulerX | ( | float | angle | ) |
Set from an euler angle around the x axis.
void decQuaternion::SetFromEulerY | ( | float | angle | ) |
Set from an euler angle around the y axis.
void decQuaternion::SetFromEulerZ | ( | float | angle | ) |
Set from an euler angle around the z axis.
void decQuaternion::SetZero | ( | ) |
Sets all components to 0 and w to 1.
decQuaternion decQuaternion::Slerp | ( | const decQuaternion & | other, |
float | factor | ||
) | const |
Calculates the slerp of this quaternion with another given an interpolation factor.
float decQuaternion::w |
W Component of quaternion.
float decQuaternion::x |
X Component of quaternion.
float decQuaternion::y |
Y Component of quaternion.
float decQuaternion::z |
Z Component of quaternion.