Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
vl::Quaternion< T_Scalar > Class Template Reference

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...
 
Quaternionoperator= (const Quaternion &q)
 Assignment operator. More...
 
Quaternionoperator= (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
 
Quaternionoperator*= (T_Scalar val)
 
Quaternion operator/ (T_Scalar val) const
 
Quaternionoperator/= (T_Scalar val)
 
Quaternion operator+ (const Quaternion &q) const
 
Quaternionoperator+= (const Quaternion &q)
 
Quaternion operator- (const Quaternion &q) const
 
Quaternionoperator-= (const Quaternion &q)
 
Quaternion operator- () const
 Returns the negated quaternion. More...
 
QuaternionsetZero ()
 Sets all the components of the quaternion to zero. More...
 
QuaternionsetNoRotation ()
 Set the quaternion to no-rotation, i.e. Quaternion(0,0,0,1). More...
 
QuaternionsetFromVectors (const Vector3< T_Scalar > &from, const Vector3< T_Scalar > &to)
 Sets the quaternion to represent the rotation transforming from into to. More...
 
QuaternionsetFromMatrix (const Matrix4< T_Scalar > &m)
 Creates a quaternion representing the given rotation matrix. More...
 
QuaternionsetFromMatrix (const Matrix3< T_Scalar > &m)
 Creates a quaternion representing the given rotation matrix. More...
 
QuaternionsetFromEulerXYZ (T_Scalar degX, T_Scalar degY, T_Scalar degZ)
 
QuaternionsetFromEulerZYX (T_Scalar degZ, T_Scalar degY, T_Scalar degX)
 
QuaternionsetFromAxisAngle (const Vector3< T_Scalar > &axis, T_Scalar degrees)
 
void toAxisAngle (Vector3< T_Scalar > &axis, T_Scalar &degrees) 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...
 
Quaternionnormalize (T_Scalar *len=NULL)
 Normalizes a quaternion. More...
 
Quaternion getNormalized (T_Scalar *len=NULL) const
 Returns the normalized version of a quaternion. More...
 
QuaterniongetNormalized (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...
 
QuaterniongetConjugate (Quaternion &q) const
 Returns the conjugate of a quaternion. More...
 
Quaternion getInverse () const
 Returns the inverse of a quaternion. More...
 
QuaterniongetInverse (Quaternion &q) const
 Returns the inverse of a quaternion. More...
 

Static Public Member Functions

static Quaternion getZero ()
 Returns the zero quaternion. More...
 
static QuaterniongetZero (Quaternion &q)
 Returns the zero quaternion. More...
 
static Quaternion getNoRotation ()
 Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1). More...
 
static QuaterniongetNoRotation (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 QuaterniongetFromVectors (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 QuaterniongetFromMatrix (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 QuaterniongetFromMatrix (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 QuaterniongetFromEulerXYZ (Quaternion &q, T_Scalar degX, T_Scalar degY, T_Scalar degZ)
 
static Quaternion getFromEulerZYX (T_Scalar degZ, T_Scalar degY, T_Scalar degX)
 
static QuaterniongetFromEulerZYX (Quaternion &q, T_Scalar degZ, T_Scalar degY, T_Scalar degX)
 
static Quaternion getFromAxisAngle (const Vector3< T_Scalar > &axis, T_Scalar degrees)
 
static QuaterniongetFromAxisAngle (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 QuaterniongetSlerp (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 QuaterniongetSquad (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 QuaterniongetNlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b)
 Normalized spherical interpolation of two quaternions. More...
 

Protected Attributes

Vector4< T_Scalar > mXYZW
 

Detailed Description

template<typename T_Scalar>
class vl::Quaternion< T_Scalar >

Implements a Quaternion usually used to represent rotations and orientations.

Definition at line 44 of file Quaternion.hpp.

Member Typedef Documentation

◆ scalar_type

template<typename T_Scalar>
typedef T_Scalar vl::Quaternion< T_Scalar >::scalar_type

Definition at line 47 of file Quaternion.hpp.

Constructor & Destructor Documentation

◆ Quaternion() [1/6]

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( )
inline

◆ Quaternion() [2/6]

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( const Quaternion< T_Scalar > &  quat)
inline

Copy-constructor.

Definition at line 56 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::operator=().

◆ Quaternion() [3/6]

template<typename T_Scalar>
template<typename T >
vl::Quaternion< T_Scalar >::Quaternion ( const Quaternion< T > &  q)
inlineexplicit

◆ Quaternion() [4/6]

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( T_Scalar  x,
T_Scalar  y,
T_Scalar  z,
T_Scalar  w 
)
inlineexplicit

◆ Quaternion() [5/6]

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( T_Scalar  degrees,
const Vector3< T_Scalar > &  axis 
)
inlineexplicit

Axis-angle constructor.

Definition at line 80 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::setFromAxisAngle().

◆ Quaternion() [6/6]

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( const Vector4< T_Scalar > &  v)
inlineexplicit

Member Function Documentation

◆ dot()

template<typename T_Scalar>
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 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().

◆ getConjugate() [1/2]

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::getConjugate ( ) const
inline

◆ getConjugate() [2/2]

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::getConjugate ( Quaternion< T_Scalar > &  q) const
inline

◆ getFromAxisAngle() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromAxisAngle ( const Vector3< T_Scalar > &  axis,
T_Scalar  degrees 
)
inlinestatic

Definition at line 360 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getFromAxisAngle() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromAxisAngle ( Quaternion< T_Scalar > &  q,
const Vector3< T_Scalar > &  axis,
T_Scalar  degrees 
)
inlinestatic

◆ getFromEulerXYZ() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromEulerXYZ ( T_Scalar  degX,
T_Scalar  degY,
T_Scalar  degZ 
)
inlinestatic

Definition at line 336 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getFromEulerXYZ() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromEulerXYZ ( Quaternion< T_Scalar > &  q,
T_Scalar  degX,
T_Scalar  degY,
T_Scalar  degZ 
)
inlinestatic

◆ getFromEulerZYX() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromEulerZYX ( T_Scalar  degZ,
T_Scalar  degY,
T_Scalar  degX 
)
inlinestatic

Definition at line 348 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getFromEulerZYX() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromEulerZYX ( Quaternion< T_Scalar > &  q,
T_Scalar  degZ,
T_Scalar  degY,
T_Scalar  degX 
)
inlinestatic

◆ getFromMatrix() [1/4]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromMatrix ( const Matrix4< T_Scalar > &  m)
inlinestatic

Converts the given rotation matrix into a quaternion.

Definition at line 307 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getFromMatrix() [2/4]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromMatrix ( Quaternion< T_Scalar > &  q,
const Matrix4< T_Scalar > &  m 
)
inlinestatic

Converts the given rotation matrix into a quaternion.

Definition at line 313 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::setFromMatrix().

◆ getFromMatrix() [3/4]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromMatrix ( const Matrix3< T_Scalar > &  m)
inlinestatic

Converts the given rotation matrix into a quaternion.

Definition at line 323 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getFromMatrix() [4/4]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromMatrix ( Quaternion< T_Scalar > &  q,
const Matrix3< T_Scalar > &  m 
)
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().

◆ getFromVectors() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getFromVectors ( const Vector3< T_Scalar > &  from,
const Vector3< T_Scalar > &  to 
)
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().

◆ getFromVectors() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getFromVectors ( Quaternion< T_Scalar > &  q,
const Vector3< T_Scalar > &  from,
const Vector3< T_Scalar > &  to 
)
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().

◆ getInverse() [1/2]

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::getInverse ( ) const
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().

◆ getInverse() [2/2]

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::getInverse ( Quaternion< T_Scalar > &  q) const
inline

◆ getNlerp() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getNlerp ( T_Scalar  t,
const Quaternion< T_Scalar > &  a,
const Quaternion< T_Scalar > &  b 
)
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().

◆ getNlerp() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getNlerp ( Quaternion< T_Scalar > &  out,
T_Scalar  t,
const Quaternion< T_Scalar > &  a,
const Quaternion< T_Scalar > &  b 
)
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().

◆ getNormalized() [1/2]

template<typename T_Scalar>
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 400 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::normalize().

◆ getNormalized() [2/2]

template<typename T_Scalar>
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 404 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::normalize().

◆ getNoRotation() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getNoRotation ( )
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().

◆ getNoRotation() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getNoRotation ( Quaternion< T_Scalar > &  q)
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().

◆ getSlerp() [1/2]

template<typename T_Scalar >
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 691 of file Quaternion.hpp.

Referenced by vl::Quaternion< T_Scalar >::getInverse(), and vl::Quaternion< T_Scalar >::getSquad().

◆ getSlerp() [2/2]

template<typename T_Scalar >
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 699 of file Quaternion.hpp.

References vl::acos(), vl::Quaternion< T_Scalar >::dot(), vl::sin(), and VL_CHECK.

◆ getSquad() [1/2]

template<typename T_Scalar>
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 
)
inlinestatic

Spherical cubic interpolation of two quaternions.

Definition at line 449 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::getSlerp().

◆ getSquad() [2/2]

template<typename T_Scalar>
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 
)
inlinestatic

Spherical cubic interpolation of two quaternions.

Definition at line 455 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::getSlerp().

◆ getZero() [1/2]

template<typename T_Scalar>
static Quaternion vl::Quaternion< T_Scalar >::getZero ( )
inlinestatic

Returns the zero quaternion.

Definition at line 254 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::Quaternion().

◆ getZero() [2/2]

template<typename T_Scalar>
static Quaternion& vl::Quaternion< T_Scalar >::getZero ( Quaternion< T_Scalar > &  q)
inlinestatic

Returns the zero quaternion.

Definition at line 260 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::setZero().

◆ length()

template<typename T_Scalar>
T_Scalar vl::Quaternion< T_Scalar >::length ( ) const
inline

Returns the length of a quaternion.

Definition at line 392 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

◆ lengthSquared()

template<typename T_Scalar>
T_Scalar vl::Quaternion< T_Scalar >::lengthSquared ( ) const
inline

◆ normalize()

template<typename T_Scalar>
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 396 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

Referenced by vl::Quaternion< T_Scalar >::getNlerp(), and vl::Quaternion< T_Scalar >::getNormalized().

◆ operator!=()

template<typename T_Scalar>
bool vl::Quaternion< T_Scalar >::operator!= ( const Quaternion< T_Scalar > &  q) const
inline

Definition at line 119 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::operator==().

◆ operator*()

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator* ( T_Scalar  val) const
inline

◆ operator*=()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator*= ( T_Scalar  val)
inline

◆ operator+()

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator+ ( const Quaternion< T_Scalar > &  q) const
inline

◆ operator+=()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator+= ( const Quaternion< T_Scalar > &  q)
inline

◆ operator-() [1/2]

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator- ( const Quaternion< T_Scalar > &  q) const
inline

◆ operator-() [2/2]

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator- ( ) const
inline

◆ operator-=()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator-= ( const Quaternion< T_Scalar > &  q)
inline

◆ operator/()

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator/ ( T_Scalar  val) const
inline

◆ operator/=()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator/= ( T_Scalar  val)
inline

◆ operator<()

template<typename T_Scalar>
bool vl::Quaternion< T_Scalar >::operator< ( const Quaternion< T_Scalar > &  other) const
inline

◆ operator=() [1/2]

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator= ( const Quaternion< T_Scalar > &  q)
inline

◆ operator=() [2/2]

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator= ( const Vector4< T_Scalar > &  v)
inline

◆ operator==()

template<typename T_Scalar>
bool vl::Quaternion< T_Scalar >::operator== ( const Quaternion< T_Scalar > &  q) const
inline

◆ setFromAxisAngle()

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromAxisAngle ( const Vector3< T_Scalar > &  axis,
T_Scalar  degrees 
)

◆ setFromEulerXYZ()

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerXYZ ( T_Scalar  degX,
T_Scalar  degY,
T_Scalar  degZ 
)

◆ setFromEulerZYX()

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromEulerZYX ( T_Scalar  degZ,
T_Scalar  degY,
T_Scalar  degX 
)

◆ setFromMatrix() [1/2]

template<typename T_Scalar >
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().

◆ setFromMatrix() [2/2]

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromMatrix ( const Matrix3< T_Scalar > &  m)

◆ setFromVectors()

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromVectors ( const Vector3< T_Scalar > &  from,
const Vector3< T_Scalar > &  to 
)

◆ setNoRotation()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::setNoRotation ( )
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().

◆ setZero()

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::setZero ( )
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().

◆ toAxisAngle()

template<typename T_Scalar >
void vl::Quaternion< T_Scalar >::toAxisAngle ( Vector3< T_Scalar > &  axis,
T_Scalar &  degrees 
) const

◆ toMatrix3() [1/2]

template<typename T_Scalar >
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().

◆ toMatrix3() [2/2]

template<typename T_Scalar >
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().

◆ toMatrix4() [1/2]

template<typename T_Scalar >
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().

◆ toMatrix4() [2/2]

template<typename T_Scalar >
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().

◆ w() [1/2]

template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::w ( )
inline

◆ w() [2/2]

template<typename T_Scalar>
const T_Scalar& vl::Quaternion< T_Scalar >::w ( ) const
inline

Definition at line 157 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

◆ x() [1/2]

template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::x ( )
inline

◆ x() [2/2]

template<typename T_Scalar>
const T_Scalar& vl::Quaternion< T_Scalar >::x ( ) const
inline

Definition at line 151 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

◆ xyzw() [1/2]

template<typename T_Scalar>
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 138 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

◆ xyzw() [2/2]

template<typename T_Scalar>
Vector4<T_Scalar>& vl::Quaternion< T_Scalar >::xyzw ( )
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.

◆ y() [1/2]

template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::y ( )
inline

◆ y() [2/2]

template<typename T_Scalar>
const T_Scalar& vl::Quaternion< T_Scalar >::y ( ) const
inline

Definition at line 153 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

◆ z() [1/2]

template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::z ( )
inline

◆ z() [2/2]

template<typename T_Scalar>
const T_Scalar& vl::Quaternion< T_Scalar >::z ( ) const
inline

Definition at line 155 of file Quaternion.hpp.

References vl::Quaternion< T_Scalar >::mXYZW.

Member Data Documentation

◆ mXYZW

template<typename T_Scalar>
Vector4<T_Scalar> vl::Quaternion< T_Scalar >::mXYZW
protected

The documentation for this class was generated from the following file: