Visualization Library v1.0.3

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

vl::Quaternion< T_Scalar > Class Template Reference

Implements a Quaternion usually used to represent rotations and orientations. More...

#include <Quaternion.hpp>

List of all members.

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

Static Public Member Functions

static Quaternion getZero ()
 Returns the zero quaternion.
static QuaterniongetZero (Quaternion &q)
 Returns the zero quaternion.
static Quaternion getNoRotation ()
 Returns the no-rotation quaternion, i.e. Quaternion(0,0,0,1).
static QuaterniongetNoRotation (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 QuaterniongetFromVectors (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 QuaterniongetFromMatrix (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 QuaterniongetFromMatrix (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 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.
static QuaterniongetSlerp (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 QuaterniongetSquad (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 QuaterniongetNlerp (Quaternion &out, T_Scalar t, const Quaternion &a, const Quaternion &b)
 Normalized spherical interpolation of two quaternions.

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

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

Definition at line 47 of file Quaternion.hpp.


Constructor & Destructor Documentation

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion (  ) [inline]
template<typename T_Scalar>
template<typename T >
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().

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( T_Scalar  x,
T_Scalar  y,
T_Scalar  z,
T_Scalar  w 
) [inline, explicit]
template<typename T_Scalar>
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().

template<typename T_Scalar>
vl::Quaternion< T_Scalar >::Quaternion ( const Vector4< T_Scalar > &  v ) [inline, explicit]

Member Function Documentation

template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator= ( const Quaternion< T_Scalar > &  q ) [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator= ( const Vector4< T_Scalar > &  v ) [inline]
template<typename T_Scalar>
bool vl::Quaternion< T_Scalar >::operator== ( const Quaternion< T_Scalar > &  q ) const [inline]
template<typename T_Scalar>
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==().

template<typename T_Scalar>
bool vl::Quaternion< T_Scalar >::operator< ( const Quaternion< T_Scalar > &  other ) const [inline]
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 133 of file Quaternion.hpp.

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

Referenced by vl::Quaternion< T_Scalar >::Quaternion().

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 136 of file Quaternion.hpp.

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

template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::x (  ) [inline]
template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::y (  ) [inline]
template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::z (  ) [inline]
template<typename T_Scalar>
T_Scalar& vl::Quaternion< T_Scalar >::w (  ) [inline]
template<typename T_Scalar>
const T_Scalar& vl::Quaternion< T_Scalar >::x (  ) const [inline]

Definition at line 146 of file Quaternion.hpp.

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

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

Definition at line 148 of file Quaternion.hpp.

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

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

Definition at line 150 of file Quaternion.hpp.

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

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

Definition at line 152 of file Quaternion.hpp.

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

template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator* ( T_Scalar  val ) const [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator*= ( T_Scalar  val ) [inline]
template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator/ ( T_Scalar  val ) const [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator/= ( T_Scalar  val ) [inline]
template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator+ ( const Quaternion< T_Scalar > &  q ) const [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator+= ( const Quaternion< T_Scalar > &  q ) [inline]
template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator- ( const Quaternion< T_Scalar > &  q ) const [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::operator-= ( const Quaternion< T_Scalar > &  q ) [inline]
template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::operator- (  ) const [inline]
template<typename T_Scalar>
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().

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

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

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 261 of file Quaternion.hpp.

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

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

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

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

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

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

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 
) [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().

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 541 of file Quaternion.hpp.

References vl::Matrix4< T_Scalar >::get3x3().

Referenced by vl::Quaternion< T_Scalar >::getFromMatrix().

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

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

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

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

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

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

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

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

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

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

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

template<typename T_Scalar >
Quaternion< T_Scalar > & vl::Quaternion< T_Scalar >::setFromAxisAngle ( const Vector3< T_Scalar > &  axis,
T_Scalar  degrees 
)
template<typename T_Scalar>
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().

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

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

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

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 633 of file Quaternion.hpp.

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

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 660 of file Quaternion.hpp.

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 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().

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

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 391 of file Quaternion.hpp.

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

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

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 395 of file Quaternion.hpp.

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

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 399 of file Quaternion.hpp.

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

template<typename T_Scalar>
T_Scalar vl::Quaternion< T_Scalar >::lengthSquared (  ) const [inline]
template<typename T_Scalar>
Quaternion vl::Quaternion< T_Scalar >::getConjugate (  ) const [inline]
template<typename T_Scalar>
Quaternion& vl::Quaternion< T_Scalar >::getConjugate ( Quaternion< T_Scalar > &  q ) const [inline]
template<typename T_Scalar>
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().

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

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 686 of file Quaternion.hpp.

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

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 694 of file Quaternion.hpp.

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

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 
) [inline, static]

Spherical cubic interpolation of two quaternions.

Definition at line 444 of file Quaternion.hpp.

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

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 
) [inline, static]

Spherical cubic interpolation of two quaternions.

Definition at line 450 of file Quaternion.hpp.

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

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

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 
) [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().


Member Data Documentation

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

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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:07.
Permission is granted to use this page to write and publish articles regarding Visualization Library.