Visualization Library 2.1.0
A 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. More... | |
Quaternion (const Quaternion &quat) | |
Copy-constructor. More... | |
template<typename T > | |
Quaternion (const Quaternion< T > &q) | |
Quaternion (T_Scalar x, T_Scalar y, T_Scalar z, T_Scalar w) | |
Constructor. More... | |
Quaternion (T_Scalar degrees, const Vector3< T_Scalar > &axis) | |
Axis-angle constructor. More... | |
Quaternion (const Vector4< T_Scalar > &v) | |
Constructor from vec4. More... | |
Quaternion & | operator= (const Quaternion &q) |
Assignment operator. More... | |
Quaternion & | operator= (const Vector4< T_Scalar > &v) |
Assignment operator for vec4. More... | |
bool | operator== (const Quaternion &q) const |
bool | operator!= (const Quaternion &q) const |
bool | operator< (const Quaternion &other) const |
Lexicographic ordering. More... | |
const Vector4< T_Scalar > & | xyzw () const |
Returns the internal vec4 used to contain the xyzw the quaternion components. More... | |
Vector4< T_Scalar > & | xyzw () |
Returns the internal vec4 used to contain the xyzw the quaternion components. More... | |
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. More... | |
Quaternion & | setZero () |
Sets all the components of the quaternion to zero. More... | |
Quaternion & | setNoRotation () |
Set the quaternion to no-rotation, i.e. Quaternion(0,0,0,1). More... | |
Quaternion & | setFromVectors (const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to) |
Sets the quaternion to represent the rotation transforming from into to . More... | |
Quaternion & | setFromMatrix (const Matrix4< T_Scalar > &m) |
Creates a quaternion representing the given rotation matrix. More... | |
Quaternion & | setFromMatrix (const Matrix3< T_Scalar > &m) |
Creates a quaternion representing the given rotation matrix. More... | |
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. More... | |
Matrix4< T_Scalar > | toMatrix4 () const |
Converts a quaternion to a 4x4 rotation matrix. More... | |
Matrix4< T_Scalar > & | toMatrix4 (Matrix4< T_Scalar > &) const |
Converts a quaternion to a 4x4 rotation matrix. More... | |
Matrix3< T_Scalar > | toMatrix3 () const |
Converts a quaternion to a 3x3 rotation matrix. More... | |
Matrix3< T_Scalar > & | toMatrix3 (Matrix3< T_Scalar > &) const |
Converts a quaternion to a 3x3 rotation matrix. More... | |
T_Scalar | dot (const Quaternion &q) const |
Returns the dot product between a quaternion and the given quaternion. More... | |
T_Scalar | length () const |
Returns the length of a quaternion. More... | |
Quaternion & | normalize (T_Scalar *len=NULL) |
Normalizes a quaternion. More... | |
Quaternion | getNormalized (T_Scalar *len=NULL) const |
Returns the normalized version of a quaternion. More... | |
Quaternion & | getNormalized (Quaternion &q, T_Scalar *len=NULL) const |
Returns the normalized version of a quaternion. More... | |
T_Scalar | lengthSquared () const |
Returns the squared length of a quaternion. More... | |
Quaternion | getConjugate () const |
Returns the conjugate of a quaternion. More... | |
Quaternion & | getConjugate (Quaternion &q) const |
Returns the conjugate of a quaternion. More... | |
Quaternion | getInverse () const |
Returns the inverse of a quaternion. More... | |
Quaternion & | getInverse (Quaternion &q) const |
Returns the inverse of a quaternion. More... | |
Static Public Member Functions | |
static Quaternion | getZero () |
Returns the zero quaternion. More... | |
static Quaternion & | getZero (Quaternion &q) |
Returns the zero quaternion. More... | |
static Quaternion | getNoRotation () |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1). More... | |
static Quaternion & | getNoRotation (Quaternion &q) |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1). More... | |
static Quaternion | getFromVectors (const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to) |
Sets the quaternion to represent the rotation transforming from into to . More... | |
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 . More... | |
static Quaternion | getFromMatrix (const Matrix4< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. More... | |
static Quaternion & | getFromMatrix (Quaternion &q, const Matrix4< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. More... | |
static Quaternion | getFromMatrix (const Matrix3< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. More... | |
static Quaternion & | getFromMatrix (Quaternion &q, const Matrix3< T_Scalar > &m) |
Converts the given rotation matrix into a quaternion. More... | |
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. More... | |
static Quaternion & | getSlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b) |
Spherical linear interpolation of two quaternions. More... | |
static Quaternion | getSquad (T_Scalar t, const Quaternion &a, const Quaternion &p, const Quaternion &q, const Quaternion &b) |
Spherical cubic interpolation of two quaternions. More... | |
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. More... | |
static Quaternion | getNlerp (T_Scalar t, const Quaternion &a, const Quaternion &b) |
Normalized spherical interpolation of two quaternions. More... | |
static Quaternion & | getNlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b) |
Normalized spherical interpolation of two quaternions. More... | |
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.
|
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-().
|
inline |
Copy-constructor.
Definition at line 56 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::operator=().
|
inlineexplicit |
Definition at line 62 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().
|
inlineexplicit |
Constructor.
Definition at line 71 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().
|
inlineexplicit |
Axis-angle constructor.
Definition at line 80 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromAxisAngle().
|
inlineexplicit |
Constructor from vec4.
Definition at line 86 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().
|
inline |
Returns the dot product between a quaternion and the given quaternion.
Definition at line 386 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().
|
inline |
Returns the conjugate of a quaternion.
Definition at line 413 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().
|
inline |
Returns the conjugate of a quaternion.
Definition at line 419 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().
|
inlinestatic |
Definition at line 360 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Definition at line 365 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromAxisAngle(), vl::Quaternion< T_Scalar >::toAxisAngle(), vl::Quaternion< T_Scalar >::toMatrix3(), and vl::Quaternion< T_Scalar >::toMatrix4().
|
inlinestatic |
Definition at line 336 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Definition at line 341 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromEulerXYZ(), and vl::Quaternion< T_Scalar >::setFromEulerZYX().
|
inlinestatic |
Definition at line 348 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Definition at line 353 of file Quaternion.hpp.
References vl::degrees(), vl::Quaternion< T_Scalar >::setFromAxisAngle(), and vl::Quaternion< T_Scalar >::setFromEulerZYX().
|
inlinestatic |
Converts the given rotation matrix into a quaternion.
Definition at line 307 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Converts the given rotation matrix into a quaternion.
Definition at line 313 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromMatrix().
|
inlinestatic |
Converts the given rotation matrix into a quaternion.
Definition at line 323 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Converts the given rotation matrix into a quaternion.
Definition at line 329 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromEulerXYZ(), and vl::Quaternion< T_Scalar >::setFromMatrix().
|
inlinestatic |
Sets the quaternion to represent the rotation transforming from
into to
.
Definition at line 291 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Sets the quaternion to represent the rotation transforming from
into to
.
Definition at line 297 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromMatrix(), and vl::Quaternion< T_Scalar >::setFromVectors().
|
inline |
Returns the inverse of a quaternion.
Definition at line 426 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getConjugate(), and vl::Quaternion< T_Scalar >::lengthSquared().
|
inline |
Returns the inverse of a quaternion.
Definition at line 432 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getConjugate(), vl::Quaternion< T_Scalar >::getSlerp(), and vl::Quaternion< T_Scalar >::lengthSquared().
|
inlinestatic |
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 463 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
|
inlinestatic |
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 473 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
|
inline |
Returns the normalized version of a quaternion.
len
returns the original length of the quaternion.
Definition at line 400 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
|
inline |
Returns the normalized version of a quaternion.
len
returns the original length of the quaternion.
Definition at line 404 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::normalize().
|
inlinestatic |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1).
Definition at line 276 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1).
Definition at line 282 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setFromVectors(), and vl::Quaternion< T_Scalar >::setNoRotation().
|
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 691 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getInverse(), and vl::Quaternion< T_Scalar >::getSquad().
|
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 699 of file Quaternion.hpp.
References vl::acos(), vl::Quaternion< T_Scalar >::dot(), vl::sin(), and VL_CHECK.
|
inlinestatic |
Spherical cubic interpolation of two quaternions.
Definition at line 449 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getSlerp().
|
inlinestatic |
Spherical cubic interpolation of two quaternions.
Definition at line 455 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::getSlerp().
|
inlinestatic |
Returns the zero quaternion.
Definition at line 254 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::Quaternion().
|
inlinestatic |
Returns the zero quaternion.
Definition at line 260 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::setZero().
|
inline |
Returns the length of a quaternion.
Definition at line 392 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Returns the squared length of a quaternion.
Definition at line 407 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().
|
inline |
Normalizes a quaternion.
len
returns the original length of the quaternion.
Definition at line 396 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getNlerp(), and vl::Quaternion< T_Scalar >::getNormalized().
|
inline |
Definition at line 119 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::operator==().
|
inline |
Definition at line 159 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().
|
inline |
Definition at line 169 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().
|
inline |
Definition at line 199 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().
|
inline |
Definition at line 209 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().
|
inline |
Definition at line 218 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().
|
inline |
Returns the negated quaternion.
Definition at line 238 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().
|
inline |
Definition at line 228 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().
|
inline |
Definition at line 178 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().
|
inline |
Definition at line 189 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().
|
inline |
Lexicographic ordering.
Definition at line 125 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().
|
inline |
Assignment operator.
Definition at line 95 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().
Referenced by vl::Quaternion< T_Scalar >::Quaternion().
|
inline |
Assignment operator for vec4.
Definition at line 105 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().
|
inline |
Definition at line 114 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!=().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromAxisAngle | ( | const Vector3< T_Scalar > & | axis, |
T_Scalar | degrees | ||
) |
Definition at line 601 of file Quaternion.hpp.
References vl::cos(), vl::dDEG_TO_RAD, vl::Quaternion< T_Scalar >::mXYZW, 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(), vl::Quaternion< T_Scalar >::getFromEulerZYX(), vl::Quaternion< T_Scalar >::Quaternion(), and vl::Quaternion< T_Scalar >::setFromVectors().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerXYZ | ( | T_Scalar | degX, |
T_Scalar | degY, | ||
T_Scalar | degZ | ||
) |
Definition at line 532 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromEulerXYZ(), and vl::Quaternion< T_Scalar >::getFromMatrix().
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerZYX | ( | T_Scalar | degZ, |
T_Scalar | degY, | ||
T_Scalar | degX | ||
) |
Definition at line 539 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromEulerXYZ(), and vl::Quaternion< T_Scalar >::getFromEulerZYX().
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 546 of file Quaternion.hpp.
References vl::Matrix4< T_Scalar >::get3x3().
Referenced by vl::Quaternion< T_Scalar >::getFromMatrix(), and vl::Quaternion< T_Scalar >::getFromVectors().
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 552 of file Quaternion.hpp.
References vl::Matrix3< T_Scalar >::e(), vl::sqrt(), vl::Quaternion< T_Scalar >::w(), vl::Quaternion< T_Scalar >::x(), vl::Quaternion< T_Scalar >::y(), and vl::Quaternion< T_Scalar >::z().
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 734 of file Quaternion.hpp.
References vl::acos(), vl::clamp(), vl::cross(), vl::dot(), vl::dRAD_TO_DEG, vl::Vector3< T_Scalar >::normalize(), vl::Quaternion< T_Scalar >::setFromAxisAngle(), and vl::Quaternion< T_Scalar >::setNoRotation().
Referenced by vl::Quaternion< T_Scalar >::getFromVectors(), and vl::Quaternion< T_Scalar >::getNoRotation().
|
inline |
Set the quaternion to no-rotation, i.e. Quaternion(0,0,0,1).
Definition at line 266 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getNoRotation(), vl::Quaternion< T_Scalar >::Quaternion(), and vl::Quaternion< T_Scalar >::setFromVectors().
|
inline |
Sets all the components of the quaternion to zero.
Definition at line 244 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
Referenced by vl::Quaternion< T_Scalar >::getZero().
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 615 of file Quaternion.hpp.
References vl::acos(), vl::clamp(), vl::dRAD_TO_DEG, vl::sqrt(), VL_CHECK, vl::Quaternion< T_Scalar >::w(), vl::Vector3< T_Scalar >::x(), vl::Quaternion< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), vl::Quaternion< T_Scalar >::y(), vl::Vector3< T_Scalar >::z(), and vl::Quaternion< T_Scalar >::z().
Referenced by vl::Quaternion< T_Scalar >::getFromAxisAngle().
Matrix3< T_Scalar > vl::Quaternion< T_Scalar >::toMatrix3 | ( | ) | const |
Converts a quaternion to a 3x3 rotation matrix.
Definition at line 684 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromAxisAngle().
Matrix3< T_Scalar > & vl::Quaternion< T_Scalar >::toMatrix3 | ( | Matrix3< T_Scalar > & | out | ) | const |
Converts a quaternion to a 3x3 rotation matrix.
Definition at line 665 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().
Matrix4< T_Scalar > vl::Quaternion< T_Scalar >::toMatrix4 | ( | ) | const |
Converts a quaternion to a 4x4 rotation matrix.
Definition at line 658 of file Quaternion.hpp.
Referenced by vl::Quaternion< T_Scalar >::getFromAxisAngle().
Matrix4< T_Scalar > & vl::Quaternion< T_Scalar >::toMatrix4 | ( | Matrix4< T_Scalar > & | out | ) | const |
Converts a quaternion to a 4x4 rotation matrix.
Definition at line 638 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().
|
inline |
Definition at line 149 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::Quaternion< T_Scalar >::operator*(), 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 >::Quaternion(), vl::Quaternion< T_Scalar >::setFromMatrix(), vl::Quaternion< T_Scalar >::toAxisAngle(), vl::Quaternion< T_Scalar >::toMatrix3(), and vl::Quaternion< T_Scalar >::toMatrix4().
|
inline |
Definition at line 157 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Definition at line 143 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::Quaternion< T_Scalar >::operator*(), 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 >::Quaternion(), vl::Quaternion< T_Scalar >::setFromMatrix(), vl::Quaternion< T_Scalar >::toAxisAngle(), vl::Quaternion< T_Scalar >::toMatrix3(), and vl::Quaternion< T_Scalar >::toMatrix4().
|
inline |
Definition at line 151 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Returns the internal vec4 used to contain the xyzw the quaternion components.
Definition at line 138 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Returns the internal vec4 used to contain the xyzw the quaternion components.
Definition at line 141 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Definition at line 145 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::Quaternion< T_Scalar >::operator*(), 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 >::Quaternion(), vl::Quaternion< T_Scalar >::setFromMatrix(), vl::Quaternion< T_Scalar >::toAxisAngle(), vl::Quaternion< T_Scalar >::toMatrix3(), and vl::Quaternion< T_Scalar >::toMatrix4().
|
inline |
Definition at line 153 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
inline |
Definition at line 147 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::Quaternion< T_Scalar >::operator*(), 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 >::Quaternion(), vl::Quaternion< T_Scalar >::setFromMatrix(), vl::Quaternion< T_Scalar >::toAxisAngle(), vl::Quaternion< T_Scalar >::toMatrix3(), and vl::Quaternion< T_Scalar >::toMatrix4().
|
inline |
Definition at line 155 of file Quaternion.hpp.
References vl::Quaternion< T_Scalar >::mXYZW.
|
protected |
Definition at line 482 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 >::setFromAxisAngle(), 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().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:53.
© Copyright Michele Bosi. All rights reserved.