A templated quaternion class. More...
#include <quat.h>
Public Member Functions | |
quat () | |
Creates a new, uninitialized quaternion. | |
quat (type x, type y, type z, type w) | |
Creates a new quaternion with the given coordinates (useless in general outside this header). | |
quat (const type v[4]) | |
Creates a new quaternion with the given coordinates. | |
quat (const quat &v) | |
Creates a new quaternion as a copy of the given quaternion. | |
quat (const vec3< type > &axis, type angle) | |
Create a normalized quaternion from an axis and an angle (MOST USEFUL). | |
quat (const vec3< type > &to, const vec3< type > &from) | |
Create a normalized quaternion which transform a vector into another. | |
quat | operator* (const quat &a) const |
Multiply by another quaternion (replace a 3x3 rotation matrix multiplication). | |
vec3< type > | operator* (const vec3< type > &a) const |
Multiply directly by a vector. | |
quat & | operator*= (const quat &a) |
Multiply by another quaternion (replace a 3x3 rotation matrix multiplication). | |
quat | inverse () const |
Returns the inverse of this quaternion. | |
type | length () const |
If length is 1, this is a normalized quaternion (the interesting ones). | |
quat | normalize () const |
Returns this quaternion normalized to unit length. | |
mat3< type > | toMat3 () const |
Returns the correponding 3x3 rotation matrix. | |
mat4< type > | toMat4 () const |
Returns the correponding 4x4 rotation matrix. | |
Public Attributes | |
type | x |
x coordinate. | |
type | y |
y coordinate. | |
type | z |
z coordinate. | |
type | w |
w coordinate. |
A templated quaternion class.
Important : assumes T is typeing point type.
Creates a new, uninitialized quaternion.
Creates a new quaternion with the given coordinates (useless in general outside this header).
Creates a new quaternion with the given coordinates.
Creates a new quaternion as a copy of the given quaternion.
Create a normalized quaternion from an axis and an angle (MOST USEFUL).
axis | an axis (do not need to be normalized) | |
angle | angle in radian |
ork::quat< type >::quat | ( | const vec3< type > & | to, | |
const vec3< type > & | from | |||
) | [inline] |
Create a normalized quaternion which transform a vector into another.
No need to pass normalized vectors.
Returns the inverse of this quaternion.
type ork::quat< type >::length | ( | ) | const [inline] |
If length is 1, this is a normalized quaternion (the interesting ones).
Returns this quaternion normalized to unit length.
vec3< type > ork::quat< type >::operator* | ( | const vec3< type > & | a | ) | const [inline] |
Multiply directly by a vector.
Returns a rotated vector.
quat< type > ork::quat< type >::operator* | ( | const quat< type > & | a | ) | const [inline] |
Multiply by another quaternion (replace a 3x3 rotation matrix multiplication).
quat< type > & ork::quat< type >::operator*= | ( | const quat< type > & | a | ) | [inline] |
Multiply by another quaternion (replace a 3x3 rotation matrix multiplication).
Returns the correponding 3x3 rotation matrix.
Returns the correponding 4x4 rotation matrix.