vmath
vmath-0.13
|
Quaternion class implementing some quaternion algebra operations. More...
#include <vmath.h>
Public Member Functions | |
Quaternion () | |
Quaternion constructor, sets quaternion to (0 + 0i + 0j + 0k). More... | |
Quaternion (const Quaternion< T > &q) | |
Copy constructor. More... | |
template<class FromT > | |
Quaternion (const Quaternion< FromT > &q) | |
Copy casting constructor. More... | |
Quaternion (T w_, const Vector3< T > &v_) | |
Creates quaternion object from real part w_ and complex part v_. More... | |
Quaternion (T w_, T x, T y, T z) | |
Creates quaternion object from value (w_ + xi + yj + zk). More... | |
Quaternion< T > & | operator= (const Quaternion< T > &rhs) |
Copy operator. More... | |
template<class FromT > | |
Quaternion< T > & | operator= (const Quaternion< FromT > &rhs) |
Copy convert operator. More... | |
Quaternion< T > | operator+ (const Quaternion< T > &rhs) const |
Addition operator. More... | |
Quaternion< T > | operator* (const Quaternion< T > &rhs) const |
Multiplication operator. More... | |
Quaternion< T > | operator* (T rhs) const |
Multiplication operator. More... | |
Quaternion< T > | operator- (const Quaternion< T > &rhs) const |
Subtraction operator. More... | |
Quaternion< T > & | operator+= (const Quaternion< T > &rhs) |
Addition operator. More... | |
Quaternion< T > & | operator-= (const Quaternion< T > &rhs) |
Subtraction operator. More... | |
Quaternion< T > & | operator*= (const Quaternion< T > &rhs) |
Multiplication operator. More... | |
Quaternion< T > & | operator*= (T rhs) |
Multiplication operator. More... | |
bool | operator== (const Quaternion< T > &rhs) const |
Equality test operator. More... | |
bool | operator!= (const Quaternion< T > &rhs) const |
Inequality test operator. More... | |
Quaternion< T > | operator- () const |
Unary negate operator. More... | |
Quaternion< T > | operator~ () const |
Unary conjugate operator. More... | |
T | length () const |
Get lenght of quaternion. More... | |
T | lengthSq () const |
Return square of length. More... | |
void | normalize () |
Normalize quaternion. More... | |
Matrix3< T > | rotMatrix () |
Converts quaternion into rotation matrix. More... | |
Matrix4< T > | transform () const |
Converts quaternion into transformation matrix. More... | |
Quaternion< T > | lerp (T fact, const Quaternion< T > &rhs) const |
Linear interpolation of two quaternions. More... | |
std::string | toString () const |
Gets string representation. More... | |
Quaternion< T > | slerp (T r, const Quaternion< T > &q2) const |
Computes spherical interpolation between quaternions (this, q2) using coefficient of interpolation r (in [0, 1]). More... | |
Static Public Member Functions | |
static Quaternion< T > | fromEulerAngles (T x, T y, T z) |
Creates quaternion for eulers angles. More... | |
static Quaternion< T > | fromAxisRot (Vector3< T > axis, float angleDeg) |
Creates quaternion as rotation around axis. More... | |
static Quaternion< T > | fromMatrix (const Matrix4< T > &m) |
Creates quaternion from transform matrix. More... | |
static Quaternion< T > | fromMatrix (const Matrix3< T > &m) |
Creates quaternion from rotation matrix. More... | |
Public Attributes | |
T | w |
Real part of quaternion. More... | |
Vector3< T > | v |
Imaginary part of quaternion. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &oss, const Quaternion< T > &q) |
Provides output to standard output stream. More... | |
Quaternion class implementing some quaternion algebra operations.
Quaternion is kind of complex number it consists of its real part (w) and its complex part v. This complex part has three elements, so we can express it as xi + yj + zk . Note that coordinates of (x,y,z) are hold inside v field.
|
inline |
Quaternion constructor, sets quaternion to (0 + 0i + 0j + 0k).
|
inline |
Copy constructor.
|
inline |
Copy casting constructor.
|
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). |
|
inline |
Creates quaternion object from value (w_ + xi + yj + zk).
w_ | Real part of quaternion. |
x | Complex coefficient for i complex constant. |
y | Complex coefficient for j complex constant. |
z | Complex coefficient for k complex constant. |
|
inlinestatic |
Creates quaternion as rotation around axis.
axis | Unit vector expressing axis of rotation. |
angleDeg | Angle of rotation around axis (in degrees). |
|
inlinestatic |
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). |
|
inlinestatic |
Creates quaternion from transform matrix.
m | Transform matrix used to compute quaternion. |
|
inlinestatic |
Creates quaternion from rotation matrix.
m | Rotation matrix used to compute quaternion. |
|
inline |
Get lenght of quaternion.
|
inline |
|
inline |
Linear interpolation of two quaternions.
fact | Factor of interpolation. For translation from position of this vector to quaternion rhs, values of factor goes from 0.0 to 1.0. |
rhs | Second Quaternion for interpolation |
|
inline |
Normalize quaternion.
|
inline |
Inequality test operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Addition operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Addition operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Subtraction operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Unary negate operator.
|
inline |
Subtraction operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Copy operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Copy convert operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Equality test operator.
rhs | Right hand side argument of binary operator. |
|
inline |
Unary conjugate operator.
|
inline |
Converts quaternion into rotation matrix.
|
inline |
Computes spherical interpolation between quaternions (this, q2) using coefficient of interpolation r (in [0, 1]).
r | The ratio of interpolation form this (r = 0) to q2 (r = 1). |
q2 | Second quaternion for interpolation. |
|
inline |
Gets string representation.
|
inline |
Converts quaternion into transformation matrix.
|
friend |
Provides output to standard output stream.
Vector3<T> Quaternion< T >::v |
Imaginary part of quaternion.
T Quaternion< T >::w |
Real part of quaternion.