SLProject 4.0.000
SLQuat4< T > Class Template Reference

Quaternion class for angle-axis rotation representation. More...

#include <SLQuat4.h>

Public Member Functions

 SLQuat4 ()
 
 SLQuat4 (T x, T y, T z, T w)
 
 SLQuat4 (const SLMat3< T > &m)
 
 SLQuat4 (T angleDEG, const SLVec3< T > &axis)
 
 SLQuat4 (const SLVec3< T > &v0, const SLVec3< T > &v1)
 
 SLQuat4 (const T xRotRAD, const T yRotRAD, const T zRotRAD)
 
x () const
 
y () const
 
z () const
 
w () const
 
void set (T x, T y, T z, T w)
 
void fromMat3 (const SLMat3< T > &m)
 
void fromAngleAxis (T angleRAD, T axisX, T axisY, T axisZ)
 
void fromEulerAngles (const T xRotRAD, const T yRotRAD, const T zRotRAD)
 
void fromVec3 (const SLVec3< T > &v0, const SLVec3< T > &v1)
 
SLMat3< T > toMat3 () const
 
SLMat4< T > toMat4 () const
 
SLVec4< T > toVec4 () const
 
void toAngleAxis (T &angleDEG, SLVec3< T > &axis) const
 
void toEulerAnglesXYZ (T &xRotRAD, T &yRotRAD, T &zRotRAD) const
 
void toEulerAnglesZYX (T &zRotRAD, T &yRotRAD, T &xRotRAD) const
 
void toEulerAnglesZXY (T &zRotRAD, T &xRotRAD, T &yRotRAD) const
 
dot (const SLQuat4< T > &q) const
 
length () const
 
SLQuat4< T > normalized () const
 
normalize ()
 
SLQuat4< T > inverted () const
 
void invert ()
 
SLQuat4< T > conjugated () const
 
void conjugate ()
 
SLQuat4< T > rotated (const SLQuat4< T > &b) const
 
void rotate (const SLQuat4< T > &q)
 
SLVec3< T > rotate (const SLVec3< T > &vec) const
 
SLQuat4< T > scaled (T scale) const
 
void scale (T scale)
 
SLQuat4< T > lerp (const SLQuat4< T > &q2, T t) const
 Linear interpolation. More...
 
void lerp (const SLQuat4< T > &q1, const SLQuat4< T > &q2, T t)
 Linear interpolation. More...
 
SLQuat4< T > slerp (const SLQuat4< T > &q2, T t) const
 Spherical linear interpolation. More...
 
void slerp (const SLQuat4< T > &q1, const SLQuat4< T > &q2, T t)
 Spherical linear interpolation. More...
 
SLQuat4< T > & operator= (SLQuat4< T > q)
 
SLQuat4< T > operator- (const SLQuat4< T > &q) const
 
SLQuat4< T > operator+ (const SLQuat4< T > &q) const
 
SLQuat4< T > operator* (const SLQuat4< T > &q) const
 
SLQuat4< T > operator* (T s) const
 
SLVec3< T > operator* (const SLVec3< T > &v) const
 
SLbool operator== (const SLQuat4< T > &q) const
 
SLbool operator!= (const SLQuat4< T > &q) const
 
SLQuat4< T > & operator*= (const SLQuat4< T > &q2)
 
SLQuat4< T > & operator*= (T s)
 

Static Public Member Functions

static SLQuat4< T > fromLookRotation (const SLVec3< T > &forward, const SLVec3< T > &up)
 

Static Public Attributes

static SLQuat4 IDENTITY = SLQuat4<T>(0.0f, 0.0f, 0.0f, 1.0f)
 

Private Attributes

_x
 
_y
 
_z
 
_w
 

Detailed Description

template<class T>
class SLQuat4< T >

Quaternion class for angle-axis rotation representation.

Quaternion class for angle-axis rotation representation. For rotations quaternions must have unit length. See http://en.wikipedia.org/wiki/Quaternion Quaternions can be interpolated at low cost with the method lerp or slerp.

Todo:
Add more doxygen documentation.

Constructor & Destructor Documentation

◆ SLQuat4() [1/6]

template<class T >
SLQuat4< T >::SLQuat4
inline

◆ SLQuat4() [2/6]

template<class T >
SLQuat4< T >::SLQuat4 ( x,
y,
z,
w 
)
inline

◆ SLQuat4() [3/6]

template<class T >
SLQuat4< T >::SLQuat4 ( const SLMat3< T > &  m)
inlineexplicit

◆ SLQuat4() [4/6]

template<class T >
SLQuat4< T >::SLQuat4 ( angleDEG,
const SLVec3< T > &  axis 
)
inline

◆ SLQuat4() [5/6]

template<class T >
SLQuat4< T >::SLQuat4 ( const SLVec3< T > &  v0,
const SLVec3< T > &  v1 
)
inline

◆ SLQuat4() [6/6]

template<class T >
SLQuat4< T >::SLQuat4 ( const T  xRotRAD,
const T  yRotRAD,
const T  zRotRAD 
)
inline

Member Function Documentation

◆ conjugate()

template<class T >
void SLQuat4< T >::conjugate

◆ conjugated()

template<class T >
SLQuat4< T > SLQuat4< T >::conjugated

◆ dot()

template<class T >
T SLQuat4< T >::dot ( const SLQuat4< T > &  q) const
inline

◆ fromAngleAxis()

template<class T >
void SLQuat4< T >::fromAngleAxis ( angleRAD,
axisX,
axisY,
axisZ 
)

◆ fromEulerAngles()

template<class T >
void SLQuat4< T >::fromEulerAngles ( const T  xRotRAD,
const T  yRotRAD,
const T  zRotRAD 
)

Sets the quaternion from 3 Euler angles in radians Source: Essential Mathematics for Games and Interactive Applications A Programmer's Guide 2nd edition by James M. Van Verth and Lars M. Bishop

◆ fromLookRotation()

template<class T >
SLQuat4< T > SLQuat4< T >::fromLookRotation ( const SLVec3< T > &  forward,
const SLVec3< T > &  up 
)
static

◆ fromMat3()

template<class T >
void SLQuat4< T >::fromMat3 ( const SLMat3< T > &  m)

◆ fromVec3()

template<class T >
void SLQuat4< T >::fromVec3 ( const SLVec3< T > &  v0,
const SLVec3< T > &  v1 
)

◆ invert()

template<class T >
void SLQuat4< T >::invert

◆ inverted()

template<class T >
SLQuat4< T > SLQuat4< T >::inverted

◆ length()

template<class T >
T SLQuat4< T >::length
inline

◆ lerp() [1/2]

template<class T >
void SLQuat4< T >::lerp ( const SLQuat4< T > &  q1,
const SLQuat4< T > &  q2,
t 
)
inline

Linear interpolation.

◆ lerp() [2/2]

template<class T >
SLQuat4< T > SLQuat4< T >::lerp ( const SLQuat4< T > &  q2,
t 
) const
inline

Linear interpolation.

◆ normalize()

template<class T >
T SLQuat4< T >::normalize
inline

◆ normalized()

template<class T >
SLQuat4< T > SLQuat4< T >::normalized

◆ operator!=()

template<class T >
bool SLQuat4< T >::operator!= ( const SLQuat4< T > &  q) const

◆ operator*() [1/3]

template<class T >
SLQuat4< T > SLQuat4< T >::operator* ( const SLQuat4< T > &  q) const

◆ operator*() [2/3]

template<class T >
SLVec3< T > SLQuat4< T >::operator* ( const SLVec3< T > &  v) const

◆ operator*() [3/3]

template<class T >
SLQuat4< T > SLQuat4< T >::operator* ( s) const

◆ operator*=() [1/2]

template<class T >
SLQuat4< T > & SLQuat4< T >::operator*= ( const SLQuat4< T > &  q2)

◆ operator*=() [2/2]

template<class T >
SLQuat4< T > & SLQuat4< T >::operator*= ( s)

◆ operator+()

template<class T >
SLQuat4< T > SLQuat4< T >::operator+ ( const SLQuat4< T > &  q) const

◆ operator-()

template<class T >
SLQuat4< T > SLQuat4< T >::operator- ( const SLQuat4< T > &  q) const

◆ operator=()

template<class T >
SLQuat4< T > & SLQuat4< T >::operator= ( SLQuat4< T >  q)

◆ operator==()

template<class T >
bool SLQuat4< T >::operator== ( const SLQuat4< T > &  q) const

◆ rotate() [1/2]

template<class T >
void SLQuat4< T >::rotate ( const SLQuat4< T > &  q)
inline

◆ rotate() [2/2]

template<class T >
SLVec3< T > SLQuat4< T >::rotate ( const SLVec3< T > &  vec) const
inline

◆ rotated()

template<class T >
SLQuat4< T > SLQuat4< T >::rotated ( const SLQuat4< T > &  b) const
inline

◆ scale()

template<class T >
void SLQuat4< T >::scale ( scale)
inline

◆ scaled()

template<class T >
SLQuat4< T > SLQuat4< T >::scaled ( scale) const
inline

◆ set()

template<class T >
void SLQuat4< T >::set ( x,
y,
z,
w 
)

◆ slerp() [1/2]

template<class T >
void SLQuat4< T >::slerp ( const SLQuat4< T > &  q1,
const SLQuat4< T > &  q2,
t 
)
inline

Spherical linear interpolation.

◆ slerp() [2/2]

template<class T >
SLQuat4< T > SLQuat4< T >::slerp ( const SLQuat4< T > &  q2,
t 
) const
inline

Spherical linear interpolation.

Todo:
clean up the code below and find a working algorithm (or check the original shoemake implementation for errors)

◆ toAngleAxis()

template<typename T >
void SLQuat4< T >::toAngleAxis ( T &  angleDEG,
SLVec3< T > &  axis 
) const

◆ toEulerAnglesXYZ()

template<typename T >
void SLQuat4< T >::toEulerAnglesXYZ ( T &  xRotRAD,
T &  yRotRAD,
T &  zRotRAD 
) const

◆ toEulerAnglesZXY()

template<typename T >
void SLQuat4< T >::toEulerAnglesZXY ( T &  zRotRAD,
T &  xRotRAD,
T &  yRotRAD 
) const

◆ toEulerAnglesZYX()

template<typename T >
void SLQuat4< T >::toEulerAnglesZYX ( T &  zRotRAD,
T &  yRotRAD,
T &  xRotRAD 
) const

◆ toMat3()

template<class T >
SLMat3< T > SLQuat4< T >::toMat3

◆ toMat4()

template<class T >
SLMat4< T > SLQuat4< T >::toMat4

◆ toVec4()

template<class T >
SLVec4< T > SLQuat4< T >::toVec4
inline

◆ w()

template<class T >
T SLQuat4< T >::w ( ) const
inline

◆ x()

template<class T >
T SLQuat4< T >::x ( ) const
inline

◆ y()

template<class T >
T SLQuat4< T >::y ( ) const
inline

◆ z()

template<class T >
T SLQuat4< T >::z ( ) const
inline

Member Data Documentation

◆ _w

template<class T >
T SLQuat4< T >::_w
private

◆ _x

template<class T >
T SLQuat4< T >::_x
private

◆ _y

template<class T >
T SLQuat4< T >::_y
private

◆ _z

template<class T >
T SLQuat4< T >::_z
private

◆ IDENTITY

template<class T >
SLQuat4< T > SLQuat4< T >::IDENTITY = SLQuat4<T>(0.0f, 0.0f, 0.0f, 1.0f)
static

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