BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members
BALL::TQuaternion< T > Class Template Reference

#include <BALL/MATHS/quaternion.h>

Inheritance diagram for BALL::TQuaternion< T >:

Public Member Functions

Constructors and Destructors
 TQuaternion ()
 
 TQuaternion (const TQuaternion &q)
 
 TQuaternion (const boost::math::quaternion< T > &q)
 
 TQuaternion (const T &w, const T &i, const T &j, const T &k)
 
 TQuaternion (const TVector3< T > &axis, const T &angle)
 
 ~TQuaternion ()
 
void clear ()
 
Assignment
void set (const TQuaternion &q)
 
void set (const boost::math::quaternion< T > &q)
 
BALL_DEPRECATED void set (const TVector3< T > &axis, const T &angle)
 
void set (const T &w, const T &i, const T &j, const T &k)
 
TQuaternionoperator= (const TQuaternion &q)
 
TQuaternionoperator= (const boost::math::quaternion< T > &q)
 
void setIdentity ()
 
TQuaternion< T > & normalize ()
 
void swap (TQuaternion &q)
 
void fromAxisAngle (const TVector3< T > &axis, const T &angle)
 
void fromEulerAngles (const T &yaw, const T &pitch, const T &roll)
 
void toAxisAngle (TVector3< T > &axis, T &angle)
 
void toEulerAngles (T &yaw, T &pitch, T &roll)
 
void get (TQuaternion &q) const
 
getAngle () const
 
TVector3< T > getAxis ()
 
TMatrix4x4< T > & getRotationMatrix (TMatrix4x4< T > &m) const
 
TQuaternion getInverse () const
 
TQuaternion getConjugate () const
 
Accessors
T & w ()
 
const T & w () const
 
T & i ()
 
const T & i () const
 
T & j ()
 
const T & j () const
 
T & k ()
 
const T & k () const
 
Debugging and Diagnostics
void dump (std::ostream &s=std::cout, Size depth=0) const
 

Detailed Description

template<typename T>
class BALL::TQuaternion< T >

Generic Quaternion Class.

Representing a rotation in three dimensional space.

Definition at line 30 of file quaternion.h.

Constructor & Destructor Documentation

template<typename T >
BALL::TQuaternion< T >::TQuaternion ( )

Default constructor. This method creates a new TQuaternion object. The quaternion is set to an identity quaternion.

Definition at line 268 of file quaternion.h.

template<typename T >
BALL::TQuaternion< T >::TQuaternion ( const TQuaternion< T > &  q)

Copy constructor. Create a new TQuaternion object from another.

Parameters
TQuaternionthe TQuaternion object to be copied

Definition at line 275 of file quaternion.h.

template<typename T>
BALL::TQuaternion< T >::TQuaternion ( const boost::math::quaternion< T > &  q)

Detailed constructor. Create a new TQuaternion object from a boost::math::quaternion.

Parameters
boost::math::quaternion<T>

Definition at line 281 of file quaternion.h.

template<typename T>
BALL::TQuaternion< T >::TQuaternion ( const T &  w,
const T &  i,
const T &  j,
const T &  k 
)

Detailed constructor. Create a new TQuaternion object from four values of type T.

Parameters
wassigned to the angular component w
iassigned to the vector component i
jassigned to the vector component j
kassigned to the vector component k

Definition at line 287 of file quaternion.h.

template<typename T>
BALL::TQuaternion< T >::TQuaternion ( const TVector3< T > &  axis,
const T &  angle 
)

Detailed constructor. Create a new TQuaternion object from a variable of type TVector3 and an angle.

Parameters
axisassigned to the axis
angleassigned to the angle

Definition at line 293 of file quaternion.h.

template<typename T >
BALL::TQuaternion< T >::~TQuaternion ( )

Destructor. Destructs the TQuaternion object. As there are no dynamic data structures, nothing happens.

Definition at line 300 of file quaternion.h.

Member Function Documentation

template<typename T >
void BALL::TQuaternion< T >::clear ( )

Clear method. The values are set to the identity quaternion.

Definition at line 305 of file quaternion.h.

template<typename T >
void BALL::TQuaternion< T >::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const

Internal state dump. Dump the current internal state of {*this} to the output ostream s with dumping depth depth .

Parameters
s- output stream where to output the internal state of {*this}
depth- the dumping depth

Definition at line 650 of file quaternion.h.

template<typename T>
void BALL::TQuaternion< T >::fromAxisAngle ( const TVector3< T > &  axis,
const T &  angle 
)

Assign the TQuaternion from an rotation axis and an angle.

Parameters
axisthe rotation axis
anglethe rotation angle

Definition at line 401 of file quaternion.h.

template<typename T>
void BALL::TQuaternion< T >::fromEulerAngles ( const T &  yaw,
const T &  pitch,
const T &  roll 
)

Assign the TQuaternion from Euler angles. Assume the following rotation order:. q' = roll( pitch( yaw(q) ) ).

Parameters
yawthe rotation about the yaw axis z-axis()
pitchthe rotation about the pitch axis (y-axis)
rollthe nrotation about the roll axis (x-axis)

Definition at line 423 of file quaternion.h.

template<typename T >
BALL_INLINE void BALL::TQuaternion< T >::get ( TQuaternion< T > &  q) const

Assign to another TQuaternion. Assigns the components to another TQuaternion.

Parameters
qthe TQuaternion to be assigned to

Definition at line 504 of file quaternion.h.

template<typename T >
T BALL::TQuaternion< T >::getAngle ( ) const

Get the positive angle rotation.

Returns
T the angle value

Definition at line 510 of file quaternion.h.

template<typename T >
TVector3< T > BALL::TQuaternion< T >::getAxis ( )

Get the normalized direction vector of the rotation axis.

Returns
TVector3 the axis

Definition at line 524 of file quaternion.h.

template<typename T >
BALL_INLINE TQuaternion< T > BALL::TQuaternion< T >::getConjugate ( ) const

Return the conjugate TQuaternion. (The axis components are negated.)

Returns
TQuaternion the conjugate TQuaternion

Definition at line 577 of file quaternion.h.

template<typename T >
BALL_INLINE TQuaternion< T > BALL::TQuaternion< T >::getInverse ( ) const

Get the inverse TQuaternion.

Returns
TQuaternion the inverse TQuaternion

Definition at line 569 of file quaternion.h.

template<typename T>
TMatrix4x4< T > & BALL::TQuaternion< T >::getRotationMatrix ( TMatrix4x4< T > &  m) const

Get the rotation matrix.

Parameters
mthe matrix to compute from
Returns
TMatrix4x4 the rotation matrix

Definition at line 538 of file quaternion.h.

template<typename T >
T & BALL::TQuaternion< T >::i ( )

Get the axis component i.

Returns
get a reference to the axis component i

Definition at line 601 of file quaternion.h.

template<typename T >
const T & BALL::TQuaternion< T >::i ( ) const

Get the constant axis component i.

Returns
get a const reference to the axis component i

Definition at line 595 of file quaternion.h.

template<typename T >
T & BALL::TQuaternion< T >::j ( )

Get the axis component j.

Returns
get a reference to the axis component j

Definition at line 613 of file quaternion.h.

template<typename T >
const T & BALL::TQuaternion< T >::j ( ) const

Get the constant axis component j.

Returns
get a const reference to the axis component j

Definition at line 607 of file quaternion.h.

template<typename T >
T & BALL::TQuaternion< T >::k ( )

Get the axis component k.

Returns
get a reference to the axis component k

Definition at line 625 of file quaternion.h.

template<typename T >
const T & BALL::TQuaternion< T >::k ( ) const

Get the constant axis component k.

Returns
get a const reference to the axis component k

Definition at line 619 of file quaternion.h.

template<typename T >
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::normalize ( )

Normalize the quaternion. The quaternion is scaled with its norm:

Returns
TQuaternion&, a reference to the normalized quaternion

Definition at line 366 of file quaternion.h.

template<typename T >
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::operator= ( const TQuaternion< T > &  q)

Assignment operator. Assign the TQuaternion components form another TQuaternion.

Definition at line 350 of file quaternion.h.

template<typename T>
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::operator= ( const boost::math::quaternion< T > &  q)

Assignment operator Assign the TQuaternion components from a boost::math::quaternion.

Definition at line 342 of file quaternion.h.

template<typename T >
void BALL::TQuaternion< T >::set ( const TQuaternion< T > &  q)

Definition at line 311 of file quaternion.h.

template<typename T>
void BALL::TQuaternion< T >::set ( const boost::math::quaternion< T > &  q)

Definition at line 317 of file quaternion.h.

template<typename T>
BALL_INLINE void BALL::TQuaternion< T >::set ( const TVector3< T > &  axis,
const T &  angle 
)

Assign the TQuaternion components.

Parameters
axisthe new axis component
anglethe new angle component
Deprecated:
use TQuaternion::fromAxisAngle() instead

Definition at line 324 of file quaternion.h.

template<typename T>
BALL_INLINE void BALL::TQuaternion< T >::set ( const T &  w,
const T &  i,
const T &  j,
const T &  k 
)

Assign the TQuaternion components.

Parameters
wassigned to the angular component w
iassigned to the vector component i
jassigned to the vector component j
kassigned to the vector component k

Definition at line 331 of file quaternion.h.

template<typename T >
BALL_INLINE void BALL::TQuaternion< T >::setIdentity ( )

Set to an identity matrix. angular component w = 1; axis components i,j,k are set to 0;

Definition at line 358 of file quaternion.h.

template<typename T >
void BALL::TQuaternion< T >::swap ( TQuaternion< T > &  q)

Swap the contents of two TQuaternion.

Parameters
qthe TQuaternion to swap contents with

Definition at line 381 of file quaternion.h.

template<typename T>
void BALL::TQuaternion< T >::toAxisAngle ( TVector3< T > &  axis,
T &  angle 
)

Assign the TQuaternion to an axis and an angle. the rotation axis is normalized.

Parameters
axisthe rotation axis
anglethe rotation angle

Definition at line 447 of file quaternion.h.

template<typename T>
void BALL::TQuaternion< T >::toEulerAngles ( T &  yaw,
T &  pitch,
T &  roll 
)

Assign the TQuaternion to Euler angles. Assume the following rotation order:. q' = roll( pitch( yaw(q) ) ).

Parameters
yawthe rotation about the yaw axis z-axis()
pitchthe rotation about the pitch axis (y-axis)
rollthe nrotation about the roll axis (x-axis)

Definition at line 467 of file quaternion.h.

template<typename T >
T & BALL::TQuaternion< T >::w ( )

Get the angular component w.

Returns
get a reference to the angular component w

Definition at line 589 of file quaternion.h.

template<typename T >
const T & BALL::TQuaternion< T >::w ( ) const

Get the constant angular component w.

Returns
get a const reference to the angular component w

Definition at line 583 of file quaternion.h.