#include <vmath.h>
Public Member Functions | |
Quaternion () | |
Quaternion (const Quaternion< T > &q) | |
Quaternion (T w_, const Vector3< T > &v_) | |
Quaternion (T w_, T x, T y, T z) | |
Quaternion< T > & | operator= (const Quaternion< T > &rhs) |
Quaternion< T > | operator+ (const Quaternion< T > &rhs) const |
Quaternion< T > | operator * (const Quaternion< T > &rhs) const |
Quaternion< T > | operator * (T rhs) const |
Quaternion< T > | operator- (const Quaternion< T > &rhs) const |
Quaternion< T > & | operator+= (const Quaternion< T > &rhs) |
Quaternion< T > & | operator-= (const Quaternion< T > &rhs) |
Quaternion< T > & | operator *= (const Quaternion< T > &rhs) |
Quaternion< T > & | operator *= (T rhs) |
bool | operator== (const Quaternion< T > &rhs) const |
bool | operator!= (const Quaternion< T > &rhs) const |
T | length () |
T | lengthSq () |
void | normalize () |
Matrix3< T > | rotMatrix () |
Matrix4< T > | transform () |
Quaternion< T > | lerp (T fact, const Quaternion< T > &rhs) const |
Quaternion< T > | slerp (T r, const Quaternion< T > &q2) const |
Static Public Member Functions | |
static Quaternion< T > | fromEulerAngles (T x, T y, T z) |
static Quaternion< T > | fromAxisRot (Vector3< T > axis, float angleDeg) |
static Quaternion< T > | fromMatrix (const Matrix4< T > &m) |
static Quaternion< T > | fromMatrix (const Matrix3< T > &m) |
Public Attributes | |
T | w |
Vector3< T > | v |
Friends | |
std::ostream & | operator<< (std::ostream &oss, const Quaternion< T > &q) |
Quaternion< T >::Quaternion | ( | ) | [inline] |
Quaternion constructor, sets quaternion to (0 + 0i + 0j + 0k).
Quaternion< T >::Quaternion | ( | const Quaternion< T > & | q | ) | [inline] |
Copy constructor.
Quaternion< T >::Quaternion | ( | T | w_, | |
const Vector3< T > & | v_ | |||
) | [inline] |
Creates quaternion object from real part w_ and complex part v_.
w_ | Real part of quaternion. | |
v_ | Complex part of quaternion (xi + yj + zk). |
Quaternion< T >::Quaternion | ( | T | w_, | |
T | x, | |||
T | y, | |||
T | z | |||
) | [inline] |
Creates quaternion object from value (w_ + xi + yj + zk).
w_ | Real part of quaternion. | |
x | Complex cooeficinet for i complex constant. | |
y | Complex cooeficinet for j complex constant. | |
z | Complex cooeficinet for k complex constant. |
Quaternion<T>& Quaternion< T >::operator= | ( | const Quaternion< T > & | rhs | ) | [inline] |
Copy operator
rhs | Right hand side argument of binary operator. |
Quaternion<T> Quaternion< T >::operator+ | ( | const Quaternion< T > & | rhs | ) | const [inline] |
Addition operator
rhs | Right hand side argument of binary operator. |
Quaternion<T> Quaternion< T >::operator * | ( | const Quaternion< T > & | rhs | ) | const [inline] |
Multiplication operator
rhs | Right hand side argument of binary operator. |
Quaternion<T> Quaternion< T >::operator * | ( | T | rhs | ) | const [inline] |
Multiplication operator
rhs | Right hand side argument of binary operator. |
Quaternion<T> Quaternion< T >::operator- | ( | const Quaternion< T > & | rhs | ) | const [inline] |
Substraction operator
rhs | Right hand side argument of binary operator. |
Quaternion<T>& Quaternion< T >::operator+= | ( | const Quaternion< T > & | rhs | ) | [inline] |
Addition operator
rhs | Right hand side argument of binary operator. |
Quaternion<T>& Quaternion< T >::operator-= | ( | const Quaternion< T > & | rhs | ) | [inline] |
Substraction operator
rhs | Right hand side argument of binary operator. |
Quaternion<T>& Quaternion< T >::operator *= | ( | const Quaternion< T > & | rhs | ) | [inline] |
Multiplication operator
rhs | Right hand side argument of binary operator. |
Quaternion<T>& Quaternion< T >::operator *= | ( | T | rhs | ) | [inline] |
Multiplication operator
rhs | Right hand side argument of binary operator. |
bool Quaternion< T >::operator== | ( | const Quaternion< T > & | rhs | ) | const [inline] |
Equality test operator
rhs | Right hand side argument of binary operator. |
bool Quaternion< T >::operator!= | ( | const Quaternion< T > & | rhs | ) | const [inline] |
Inequality test operator
rhs | Right hand side argument of binary operator. |
T Quaternion< T >::length | ( | ) | [inline] |
Get lenght of quaternion.
T Quaternion< T >::lengthSq | ( | ) | [inline] |
void Quaternion< T >::normalize | ( | ) | [inline] |
Normalize quaternion
static Quaternion<T> Quaternion< T >::fromEulerAngles | ( | T | x, | |
T | y, | |||
T | z | |||
) | [inline, static] |
Creates quaternion for eulers angles.
x | Rotation around x axis (in degrees). | |
y | Rotation around y axis (in degrees). | |
z | Rotation around z axis (in degrees). |
static Quaternion<T> Quaternion< T >::fromAxisRot | ( | Vector3< T > | axis, | |
float | angleDeg | |||
) | [inline, static] |
Creates quaternion as rotation around axis.
axis | Unit vector expressing axis of rotation. | |
angleDeg | Angle of rotation around axis (in degrees). |
Matrix3<T> Quaternion< T >::rotMatrix | ( | ) | [inline] |
Converts quaternion into rotation matrix.
Matrix4<T> Quaternion< T >::transform | ( | ) | [inline] |
Converts quaternion into transformation matrix.
Quaternion<T> Quaternion< T >::lerp | ( | T | fact, | |
const Quaternion< T > & | rhs | |||
) | const [inline] |
Linear interpolation of two quaternions
fact | Factor of interpolation. For translation from positon of this vector to quaternion rhs, values of factor goes from 0.0 to 1.0. | |
rhs | Second Quaternion for interpolation |
static Quaternion<T> Quaternion< T >::fromMatrix | ( | const Matrix4< T > & | m | ) | [inline, static] |
Creates quaternion from transform matrix.
m | Transfrom matrix used to compute quaternion. |
static Quaternion<T> Quaternion< T >::fromMatrix | ( | const Matrix3< T > & | m | ) | [inline, static] |
Creates quaternion from rotation matrix.
m | Rotation matrix used to compute quaternion. |
Quaternion<T> Quaternion< T >::slerp | ( | T | r, | |
const Quaternion< T > & | q2 | |||
) | const [inline] |
Computes spherical interpolation between quaternions (this, q2) using coeficient of interpolation r (in [0, 1]).
r | The ratio of interpolation form this (r = 0) to q2 (r = 1). | |
q2 | Second quaternion for interpolation. |
std::ostream& operator<< | ( | std::ostream & | oss, | |
const Quaternion< T > & | q | |||
) | [friend] |
Provides output to standard output stream.
T Quaternion< T >::w |
Real part of quaternion.
Vector3<T> Quaternion< T >::v |
Complex part of quaternion.