Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Implements a Quaternion usually used to represent rotations and orientations. More...
#include <Quaternion.hpp>
Public Types | |
typedef T_Scalar | scalar_type |
Public Member Functions | |
Quaternion () | |
Constructor. | |
template<typename T > | |
Quaternion (const Quaternion< T > &quat) | |
Copy-constructor. | |
Quaternion (T_Scalar x, T_Scalar y, T_Scalar z, T_Scalar w) | |
Constructor. | |
Quaternion (T_Scalar degrees, const Vector3< T_Scalar > &axis) | |
Axis-angle constructor. | |
Quaternion (const Vector4< T_Scalar > &v) | |
Constructor from vec4. | |
Quaternion & | operator= (const Quaternion &q) |
Assignment operator. | |
Quaternion & | operator= (const Vector4< T_Scalar > &v) |
Assignment operator for vec4. | |
bool | operator== (const Quaternion &q) const |
bool | operator!= (const Quaternion &q) const |
bool | operator< (const Quaternion &other) const |
Lexicographic ordering. | |
const Vector4< T_Scalar > & | xyzw () const |
Returns the internal vec4 used to contain the xyzw the quaternion components. | |
Vector4< T_Scalar > & | xyzw () |
Returns the internal vec4 used to contain the xyzw the quaternion components. | |
T_Scalar & | x () |
T_Scalar & | y () |
T_Scalar & | z () |
T_Scalar & | w () |
const T_Scalar & | x () const |
const T_Scalar & | y () const |
const T_Scalar & | z () const |
const T_Scalar & | w () const |
Quaternion | operator* (T_Scalar val) const |
Quaternion & | operator*= (T_Scalar val) |
Quaternion | operator/ (T_Scalar val) const |
Quaternion & | operator/= (T_Scalar val) |
Quaternion | operator+ (const Quaternion &q) const |
Quaternion & | operator+= (const Quaternion &q) |
Quaternion | operator- (const Quaternion &q) const |
Quaternion & | operator-= (const Quaternion &q) |
Quaternion | operator- () const |
Returns the negated quaternion. | |
Quaternion & | setZero () |
Sets all the components of the quaternion to zero. | |
Quaternion & | setNoRotation () |
Set the quaternion to no-rotation, i.e. Quaternion(0,0,0,1). | |
Quaternion & | setFromVectors (const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to) |
Sets the quaternion to represent the rotation transforming from into to . | |
Quaternion & | setFromMatrix (const Matrix4< T_Scalar > &m) |
Creates a quaternion representing the given rotation matrix. | |
Quaternion & | setFromMatrix (const Matrix3< T_Scalar > &m) |
Creates a quaternion representing the given rotation matrix. | |
Quaternion & | setFromEulerXYZ (T_Scalar degX, T_Scalar degY, T_Scalar degZ) |
Quaternion & | setFromEulerZYX (T_Scalar degZ, T_Scalar degY, T_Scalar degX) |
Quaternion & | setFromAxisAngle (const Vector3< T_Scalar > &axis, T_Scalar degrees) |
void | toAxisAngle (Vector3< T_Scalar > &axis, T_Scalar °rees) const |
Converts a quaternion to an axis-angle representation. | |
Matrix4< T_Scalar > | toMatrix4 () const |
Converts a quaternion to a 4x4 rotation matrix. | |
Matrix4< T_Scalar > & | toMatrix4 (Matrix4< T_Scalar > &) const |
Converts a quaternion to a 4x4 rotation matrix. | |
Matrix3< T_Scalar > | toMatrix3 () const |
Converts a quaternion to a 3x3 rotation matrix. | |
Matrix3< T_Scalar > & | toMatrix3 (Matrix3< T_Scalar > &) const |
Converts a quaternion to a 3x3 rotation matrix. | |
T_Scalar | dot (const Quaternion &q) const |
Returns the dot product between a quaternion and the given quaternion. | |
T_Scalar | length () const |
Returns the length of a quaternion. | |
Quaternion & | normalize (T_Scalar *len=NULL) |
Normalizes a quaternion. | |
Quaternion | getNormalized (T_Scalar *len=NULL) const |
Returns the normalized version of a quaternion. | |
Quaternion & | getNormalized (Quaternion &q, T_Scalar *len=NULL) const |
Returns the normalized version of a quaternion. | |
T_Scalar | lengthSquared () const |
Returns the squared length of a quaternion. | |
Quaternion | getConjugate () const |
Returns the conjugate of a quaternion. | |
Quaternion & | getConjugate (Quaternion &q) const |
Returns the conjugate of a quaternion. | |
Quaternion | getInverse () const |
Returns the inverse of a quaternion. | |
Quaternion & | getInverse (Quaternion &q) const |
Returns the inverse of a quaternion. | |
Static Public Member Functions | |
static Quaternion | getZero () |
Returns the zero quaternion. | |
static Quaternion & | getZero (Quaternion &q) |
Returns the zero quaternion. | |
static Quaternion | getNoRotation () |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1). | |
static Quaternion & | getNoRotation (Quaternion &q) |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1). | |
static Quaternion | getFromVectors (const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to) |
Sets the quaternion to represent the rotation transforming from into to . | |
static Quaternion & | getFromVectors (Quaternion &q, const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to) |
Sets the quaternion to represent the rotation transforming from into to . | |
static Quaternion | getFromMatrix (const Matrix4< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. | |
static Quaternion & | getFromMatrix (Quaternion &q, const Matrix4< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. | |
static Quaternion | getFromMatrix (const Matrix3< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. | |
static Quaternion & | getFromMatrix (Quaternion &q, const Matrix3< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. | |
static Quaternion | getFromEulerXYZ (T_Scalar degX, T_Scalar degY, T_Scalar degZ) |
static Quaternion & | getFromEulerXYZ (Quaternion &q, T_Scalar degX, T_Scalar degY, T_Scalar degZ) |
static Quaternion | getFromEulerZYX (T_Scalar degZ, T_Scalar degY, T_Scalar degX) |
static Quaternion & | getFromEulerZYX (Quaternion &q, T_Scalar degZ, T_Scalar degY, T_Scalar degX) |
static Quaternion | getFromAxisAngle (const Vector3< T_Scalar > &axis, T_Scalar degrees) |
static Quaternion & | getFromAxisAngle (Quaternion &q, const Vector3< T_Scalar > &axis, T_Scalar degrees) |
static Quaternion | getSlerp (T_Scalar t, const Quaternion &a, const Quaternion &b) |
Spherical linear interpolation of two quaternions. | |
static Quaternion & | getSlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b) |
Spherical linear interpolation of two quaternions. | |
static Quaternion | getSquad (T_Scalar t, const Quaternion &a, const Quaternion &p, const Quaternion &q, const Quaternion &b) |
Spherical cubic interpolation of two quaternions. | |
static Quaternion & | getSquad (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &p, const Quaternion &q, const Quaternion &b) |
Spherical cubic interpolation of two quaternions. | |
static Quaternion | getNlerp (T_Scalar t, const Quaternion &a, const Quaternion &b) |
Normalized spherical interpolation of two quaternions. | |
static Quaternion & | getNlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b) |
Normalized spherical interpolation of two quaternions. | |
Protected Attributes | |
Vector4< T_Scalar > | mXYZW |
Implements a Quaternion usually used to represent rotations and orientations.
Definition at line 44 of file Quaternion.hpp.
typedef T_Scalar vl::Quaternion< T_Scalar >::scalar_type |
Definition at line 47 of file Quaternion.hpp.
vl::Quaternion< T_Scalar >::Quaternion | ( | ) | [inline] |
Constructor.
Definition at line 50 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setNoRotation().
Referenced by vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::getFromAxisAngle(), vl::Quaternion< T_Scalar >::getFromEulerXYZ(), vl::Quaternion< T_Scalar >::getFromEulerZYX(), vl::Quaternion< T_Scalar >::getFromMatrix(), vl::Quaternion< T_Scalar >::getFromVectors(), vl::Quaternion< T_Scalar >::getNoRotation(), vl::Quaternion< T_Scalar >::getZero(), and vl::Quaternion< T_Scalar >::operator-().
vl::Quaternion< T_Scalar >::Quaternion | ( | const Quaternion< T > & | quat ) | [inline, explicit] |
Copy-constructor.
Definition at line 57 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW, and vl::Quaternion< T_Scalar >::xyzw().
vl::Quaternion< T_Scalar >::Quaternion | ( | T_Scalar | x, |
T_Scalar | y, | ||
T_Scalar | z, | ||
T_Scalar | w | ||
) | [inline, explicit] |
Constructor.
Definition at line 66 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW, vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
vl::Quaternion< T_Scalar >::Quaternion | ( | T_Scalar | degrees, |
const Vector3< T_Scalar > & | axis | ||
) | [inline, explicit] |
Axis-angle constructor.
Definition at line 75 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromAxisAngle().
vl::Quaternion< T_Scalar >::Quaternion | ( | const Vector4< T_Scalar > & | v ) | [inline, explicit] |
Constructor from vec4.
Definition at line 81 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW, vl::Vector4< T_Scalar >::w(), vl::Vector4< T_Scalar >::x(), vl::Vector4< T_Scalar >::y(), and vl::Vector4< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator= | ( | const Quaternion< T_Scalar > & | q ) | [inline] |
Assignment operator.
Definition at line 90 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW, vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator= | ( | const Vector4< T_Scalar > & | v ) | [inline] |
Assignment operator for vec4.
Definition at line 100 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW, vl::Vector4< T_Scalar >::w(), vl::Vector4< T_Scalar >::x(), vl::Vector4< T_Scalar >::y(), and vl::Vector4< T_Scalar >::z().
bool vl::Quaternion< T_Scalar >::operator== | ( | const Quaternion< T_Scalar > & | q ) | const [inline] |
Definition at line 109 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::operator!=().
bool vl::Quaternion< T_Scalar >::operator!= | ( | const Quaternion< T_Scalar > & | q ) | const [inline] |
Definition at line 114 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::operator==().
bool vl::Quaternion< T_Scalar >::operator< | ( | const Quaternion< T_Scalar > & | other ) | const [inline] |
Lexicographic ordering.
Definition at line 120 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
const Vector4<T_Scalar>& vl::Quaternion< T_Scalar >::xyzw | ( | ) | const [inline] |
Returns the internal vec4 used to contain the xyzw the quaternion components.
Definition at line 133 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::Quaternion().
Vector4<T_Scalar>& vl::Quaternion< T_Scalar >::xyzw | ( | ) | [inline] |
Returns the internal vec4 used to contain the xyzw the quaternion components.
Definition at line 136 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
T_Scalar& vl::Quaternion< T_Scalar >::x | ( | ) | [inline] |
Definition at line 138 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::dot(), vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::lengthSquared(), vl::operator*(), vl::Quaternion< T_Scalar >::operator*(), vl::Quaternion< T_Scalar >::operator*=(), vl::Quaternion< T_Scalar >::operator+(), vl::Quaternion< T_Scalar >::operator+=(), vl::Quaternion< T_Scalar >::operator-(), vl::Quaternion< T_Scalar >::operator-=(), vl::Quaternion< T_Scalar >::operator/(), vl::Quaternion< T_Scalar >::operator/=(), vl::Quaternion< T_Scalar >::operator<(), vl::Quaternion< T_Scalar >::operator=(), vl::Quaternion< T_Scalar >::operator==(), and vl::Quaternion< T_Scalar >::Quaternion().
T_Scalar& vl::Quaternion< T_Scalar >::y | ( | ) | [inline] |
Definition at line 140 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::dot(), vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::lengthSquared(), vl::operator*(), vl::Quaternion< T_Scalar >::operator*(), vl::Quaternion< T_Scalar >::operator*=(), vl::Quaternion< T_Scalar >::operator+(), vl::Quaternion< T_Scalar >::operator+=(), vl::Quaternion< T_Scalar >::operator-(), vl::Quaternion< T_Scalar >::operator-=(), vl::Quaternion< T_Scalar >::operator/(), vl::Quaternion< T_Scalar >::operator/=(), vl::Quaternion< T_Scalar >::operator<(), vl::Quaternion< T_Scalar >::operator=(), vl::Quaternion< T_Scalar >::operator==(), and vl::Quaternion< T_Scalar >::Quaternion().
T_Scalar& vl::Quaternion< T_Scalar >::z | ( | ) | [inline] |
Definition at line 142 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::dot(), vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::lengthSquared(), vl::operator*(), vl::Quaternion< T_Scalar >::operator*(), vl::Quaternion< T_Scalar >::operator*=(), vl::Quaternion< T_Scalar >::operator+(), vl::Quaternion< T_Scalar >::operator+=(), vl::Quaternion< T_Scalar >::operator-(), vl::Quaternion< T_Scalar >::operator-=(), vl::Quaternion< T_Scalar >::operator/(), vl::Quaternion< T_Scalar >::operator/=(), vl::Quaternion< T_Scalar >::operator<(), vl::Quaternion< T_Scalar >::operator=(), vl::Quaternion< T_Scalar >::operator==(), and vl::Quaternion< T_Scalar >::Quaternion().
T_Scalar& vl::Quaternion< T_Scalar >::w | ( | ) | [inline] |
Definition at line 144 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::dot(), vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::lengthSquared(), vl::operator*(), vl::Quaternion< T_Scalar >::operator*(), vl::Quaternion< T_Scalar >::operator*=(), vl::Quaternion< T_Scalar >::operator+(), vl::Quaternion< T_Scalar >::operator+=(), vl::Quaternion< T_Scalar >::operator-(), vl::Quaternion< T_Scalar >::operator-=(), vl::Quaternion< T_Scalar >::operator/(), vl::Quaternion< T_Scalar >::operator/=(), vl::Quaternion< T_Scalar >::operator<(), vl::Quaternion< T_Scalar >::operator=(), vl::Quaternion< T_Scalar >::operator==(), and vl::Quaternion< T_Scalar >::Quaternion().
const T_Scalar& vl::Quaternion< T_Scalar >::x | ( | ) | const [inline] |
Definition at line 146 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
const T_Scalar& vl::Quaternion< T_Scalar >::y | ( | ) | const [inline] |
Definition at line 148 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
const T_Scalar& vl::Quaternion< T_Scalar >::z | ( | ) | const [inline] |
Definition at line 150 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
const T_Scalar& vl::Quaternion< T_Scalar >::w | ( | ) | const [inline] |
Definition at line 152 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Quaternion vl::Quaternion< T_Scalar >::operator* | ( | T_Scalar | val ) | const [inline] |
Definition at line 154 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator*= | ( | T_Scalar | val ) | [inline] |
Definition at line 164 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion vl::Quaternion< T_Scalar >::operator/ | ( | T_Scalar | val ) | const [inline] |
Definition at line 173 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator/= | ( | T_Scalar | val ) | [inline] |
Definition at line 184 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion vl::Quaternion< T_Scalar >::operator+ | ( | const Quaternion< T_Scalar > & | q ) | const [inline] |
Definition at line 194 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator+= | ( | const Quaternion< T_Scalar > & | q ) | [inline] |
Definition at line 204 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion vl::Quaternion< T_Scalar >::operator- | ( | const Quaternion< T_Scalar > & | q ) | const [inline] |
Definition at line 213 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::operator-= | ( | const Quaternion< T_Scalar > & | q ) | [inline] |
Definition at line 223 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion vl::Quaternion< T_Scalar >::operator- | ( | ) | const [inline] |
Returns the negated quaternion.
Definition at line 233 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion(), vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion& vl::Quaternion< T_Scalar >::setZero | ( | ) | [inline] |
Sets all the components of the quaternion to zero.
Definition at line 239 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getZero().
static Quaternion vl::Quaternion< T_Scalar >::getZero | ( | ) | [inline, static] |
Returns the zero quaternion.
Definition at line 249 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getZero | ( | Quaternion< T_Scalar > & | q ) | [inline, static] |
Returns the zero quaternion.
Definition at line 255 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setZero().
Quaternion& vl::Quaternion< T_Scalar >::setNoRotation | ( | ) | [inline] |
Set the quaternion to no-rotation, i.e. Quaternion(0,0,0,1).
Definition at line 261 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getNoRotation(), and vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion vl::Quaternion< T_Scalar >::getNoRotation | ( | ) | [inline, static] |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1).
Definition at line 271 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getNoRotation | ( | Quaternion< T_Scalar > & | q ) | [inline, static] |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1).
Definition at line 277 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setNoRotation().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromVectors | ( | const Vector3< T_Scalar > & | from, |
const Vector3< T_Scalar > & | to | ||
) |
Sets the quaternion to represent the rotation transforming from
into to
.
Definition at line 729 of file Quaternion.hpp.
References vl::acos(), vl::clamp(), vl::cross(), vl::dot(), vl::dRAD_TO_DEG, and vl::Vector3< T_Scalar >::normalize().
Referenced by vl::Quaternion< T_Scalar >::getFromVectors().
static Quaternion vl::Quaternion< T_Scalar >::getFromVectors | ( | const Vector3< T_Scalar > & | from, |
const Vector3< T_Scalar > & | to | ||
) | [inline, static] |
Sets the quaternion to represent the rotation transforming from
into to
.
Definition at line 286 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromVectors | ( | Quaternion< T_Scalar > & | q, |
const Vector3< T_Scalar > & | from, | ||
const Vector3< T_Scalar > & | to | ||
) | [inline, static] |
Sets the quaternion to represent the rotation transforming from
into to
.
Definition at line 292 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromVectors().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromMatrix | ( | const Matrix4< T_Scalar > & | m ) |
Creates a quaternion representing the given rotation matrix.
see also http://www.gamasutra.com/features/19980703/quaternions_01.htm
Definition at line 541 of file Quaternion.hpp.
References vl::Matrix4< T_Scalar >::get3x3().
Referenced by vl::Quaternion< T_Scalar >::getFromMatrix().
static Quaternion vl::Quaternion< T_Scalar >::getFromMatrix | ( | const Matrix4< T_Scalar > & | m ) | [inline, static] |
Converts the given rotation matrix into a quaternion.
Definition at line 302 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromMatrix | ( | Quaternion< T_Scalar > & | q, |
const Matrix4< T_Scalar > & | m | ||
) | [inline, static] |
Converts the given rotation matrix into a quaternion.
Definition at line 308 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromMatrix().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromMatrix | ( | const Matrix3< T_Scalar > & | m ) |
Creates a quaternion representing the given rotation matrix.
see also http://www.gamasutra.com/features/19980703/quaternions_01.htm
Definition at line 547 of file Quaternion.hpp.
References vl::Matrix3< T_Scalar >::e(), and vl::sqrt().
static Quaternion vl::Quaternion< T_Scalar >::getFromMatrix | ( | const Matrix3< T_Scalar > & | m ) | [inline, static] |
Converts the given rotation matrix into a quaternion.
Definition at line 318 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromMatrix | ( | Quaternion< T_Scalar > & | q, |
const Matrix3< T_Scalar > & | m | ||
) | [inline, static] |
Converts the given rotation matrix into a quaternion.
Definition at line 324 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromMatrix().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerXYZ | ( | T_Scalar | degX, |
T_Scalar | degY, | ||
T_Scalar | degZ | ||
) |
Definition at line 527 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromEulerXYZ().
static Quaternion vl::Quaternion< T_Scalar >::getFromEulerXYZ | ( | T_Scalar | degX, |
T_Scalar | degY, | ||
T_Scalar | degZ | ||
) | [inline, static] |
Definition at line 331 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromEulerXYZ | ( | Quaternion< T_Scalar > & | q, |
T_Scalar | degX, | ||
T_Scalar | degY, | ||
T_Scalar | degZ | ||
) | [inline, static] |
Definition at line 336 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromEulerXYZ().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerZYX | ( | T_Scalar | degZ, |
T_Scalar | degY, | ||
T_Scalar | degX | ||
) |
Definition at line 534 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromEulerZYX().
static Quaternion vl::Quaternion< T_Scalar >::getFromEulerZYX | ( | T_Scalar | degZ, |
T_Scalar | degY, | ||
T_Scalar | degX | ||
) | [inline, static] |
Definition at line 343 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromEulerZYX | ( | Quaternion< T_Scalar > & | q, |
T_Scalar | degZ, | ||
T_Scalar | degY, | ||
T_Scalar | degX | ||
) | [inline, static] |
Definition at line 348 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromEulerZYX().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromAxisAngle | ( | const Vector3< T_Scalar > & | axis, |
T_Scalar | degrees | ||
) |
Definition at line 596 of file Quaternion.hpp.
References vl::cos(), vl::dDEG_TO_RAD, vl::Vector3< T_Scalar >::normalize(), vl::sin(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::getFromAxisAngle(), and vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion vl::Quaternion< T_Scalar >::getFromAxisAngle | ( | const Vector3< T_Scalar > & | axis, |
T_Scalar | degrees | ||
) | [inline, static] |
Definition at line 355 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
static Quaternion& vl::Quaternion< T_Scalar >::getFromAxisAngle | ( | Quaternion< T_Scalar > & | q, |
const Vector3< T_Scalar > & | axis, | ||
T_Scalar | degrees | ||
) | [inline, static] |
Definition at line 360 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromAxisAngle().
void vl::Quaternion< T_Scalar >::toAxisAngle | ( | Vector3< T_Scalar > & | axis, |
T_Scalar & | degrees | ||
) | const |
Converts a quaternion to an axis-angle representation.
Definition at line 610 of file Quaternion.hpp.
References vl::acos(), vl::clamp(), vl::dRAD_TO_DEG, vl::sqrt(), VL_CHECK, vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
Matrix4< T_Scalar > vl::Quaternion< T_Scalar >::toMatrix4 | ( | ) | const |
Converts a quaternion to a 4x4 rotation matrix.
Definition at line 653 of file Quaternion.hpp.
Matrix4< T_Scalar > & vl::Quaternion< T_Scalar >::toMatrix4 | ( | Matrix4< T_Scalar > & | out ) | const |
Converts a quaternion to a 4x4 rotation matrix.
Definition at line 633 of file Quaternion.hpp.
Matrix3< T_Scalar > vl::Quaternion< T_Scalar >::toMatrix3 | ( | ) | const |
Converts a quaternion to a 3x3 rotation matrix.
Definition at line 679 of file Quaternion.hpp.
Matrix3< T_Scalar > & vl::Quaternion< T_Scalar >::toMatrix3 | ( | Matrix3< T_Scalar > & | out ) | const |
Converts a quaternion to a 3x3 rotation matrix.
Definition at line 660 of file Quaternion.hpp.
T_Scalar vl::Quaternion< T_Scalar >::dot | ( | const Quaternion< T_Scalar > & | q ) | const [inline] |
Returns the dot product between a quaternion and the given quaternion.
Definition at line 381 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::getSlerp().
T_Scalar vl::Quaternion< T_Scalar >::length | ( | ) | const [inline] |
Returns the length of a quaternion.
Definition at line 387 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Quaternion& vl::Quaternion< T_Scalar >::normalize | ( | T_Scalar * | len = NULL ) |
[inline] |
Normalizes a quaternion.
len
returns the original length of the quaternion.
Definition at line 391 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getNlerp(), and vl::Quaternion< T_Scalar >::getNormalized().
Quaternion vl::Quaternion< T_Scalar >::getNormalized | ( | T_Scalar * | len = NULL ) |
const [inline] |
Returns the normalized version of a quaternion.
len
returns the original length of the quaternion.
Definition at line 395 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
Quaternion& vl::Quaternion< T_Scalar >::getNormalized | ( | Quaternion< T_Scalar > & | q, |
T_Scalar * | len = NULL |
||
) | const [inline] |
Returns the normalized version of a quaternion.
len
returns the original length of the quaternion.
Definition at line 399 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
T_Scalar vl::Quaternion< T_Scalar >::lengthSquared | ( | ) | const [inline] |
Returns the squared length of a quaternion.
Definition at line 402 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::getInverse().
Quaternion vl::Quaternion< T_Scalar >::getConjugate | ( | ) | const [inline] |
Returns the conjugate of a quaternion.
Definition at line 408 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion(), vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::getInverse().
Quaternion& vl::Quaternion< T_Scalar >::getConjugate | ( | Quaternion< T_Scalar > & | q ) | const [inline] |
Returns the conjugate of a quaternion.
Definition at line 414 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion(), vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
Quaternion vl::Quaternion< T_Scalar >::getInverse | ( | ) | const [inline] |
Returns the inverse of a quaternion.
Definition at line 421 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getConjugate(), and vl::Quaternion< T_Scalar >::lengthSquared().
Quaternion& vl::Quaternion< T_Scalar >::getInverse | ( | Quaternion< T_Scalar > & | q ) | const [inline] |
Returns the inverse of a quaternion.
Definition at line 427 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getConjugate(), and vl::Quaternion< T_Scalar >::lengthSquared().
Quaternion< T_Scalar > vl::Quaternion< T_Scalar >::getSlerp | ( | T_Scalar | t, |
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | b | ||
) | [static] |
Spherical linear interpolation of two quaternions.
See also http://www.gamasutra.com/features/19980703/quaternions_01.htm
Properties: NO commutative, YES torque-minimal, YES constant velocity.
Definition at line 686 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getSquad().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::getSlerp | ( | Quaternion< T_Scalar > & | out, |
T_Scalar | t, | ||
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | b | ||
) | [static] |
Spherical linear interpolation of two quaternions.
See also http://www.gamasutra.com/features/19980703/quaternions_01.htm
Properties: NO commutative, YES torque-minimal, YES constant velocity.
Definition at line 694 of file Quaternion.hpp.
References vl::acos(), vl::Quaternion< T_Scalar >::dot(), vl::sin(), and VL_CHECK.
static Quaternion vl::Quaternion< T_Scalar >::getSquad | ( | T_Scalar | t, |
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | p, | ||
const Quaternion< T_Scalar > & | q, | ||
const Quaternion< T_Scalar > & | b | ||
) | [inline, static] |
Spherical cubic interpolation of two quaternions.
Definition at line 444 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getSlerp().
static Quaternion& vl::Quaternion< T_Scalar >::getSquad | ( | Quaternion< T_Scalar > & | out, |
T_Scalar | t, | ||
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | p, | ||
const Quaternion< T_Scalar > & | q, | ||
const Quaternion< T_Scalar > & | b | ||
) | [inline, static] |
Spherical cubic interpolation of two quaternions.
Definition at line 450 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getSlerp().
static Quaternion vl::Quaternion< T_Scalar >::getNlerp | ( | T_Scalar | t, |
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | b | ||
) | [inline, static] |
Normalized spherical interpolation of two quaternions.
See also http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/
Properties: YES commutative, YES torque-minimal, NO constant velocity.
Definition at line 458 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
static Quaternion& vl::Quaternion< T_Scalar >::getNlerp | ( | Quaternion< T_Scalar > & | out, |
T_Scalar | t, | ||
const Quaternion< T_Scalar > & | a, | ||
const Quaternion< T_Scalar > & | b | ||
) | [inline, static] |
Normalized spherical interpolation of two quaternions.
See also http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/
Properties: YES commutative, YES torque-minimal, NO constant velocity.
Definition at line 468 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
Vector4<T_Scalar> vl::Quaternion< T_Scalar >::mXYZW [protected] |
Definition at line 477 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::length(), vl::Quaternion< T_Scalar >::normalize(), vl::Quaternion< T_Scalar >::operator=(), vl::Quaternion< T_Scalar >::Quaternion(), vl::Quaternion< T_Scalar >::setNoRotation(), vl::Quaternion< T_Scalar >::setZero(), vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::xyzw(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().