BALL::TQuaternion< T > Class Template Reference
[Quaternion]

Generic Quaternion Class. More...

#include <quaternion.h>

Inheritance diagram for BALL::TQuaternion< T >:
Inheritance graph
[legend]

List of all members.


Public Member Functions

Constructors and Destructors
TQuaternion ()
Default constructor.
TQuaternion (const TQuaternion &q)
Copy constructor.
TQuaternion (const boost::math::quaternion< T > &q)
Detailed constructor.
TQuaternion (const T &w, const T &i, const T &j, const T &k)
Detailed constructor.
TQuaternion (const TVector3< T > &axis, const T &angle)
Detailed constructor.
virtual ~TQuaternion ()
Destructor.
virtual void clear ()
Clear method.
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)
Assign the TQuaternion components.
void set (const T &w, const T &i, const T &j, const T &k)
Assign the TQuaternion components.
TQuaternion & operator= (const TQuaternion &q)
Assignment operator.
TQuaternion & operator= (const boost::math::quaternion< T > &q)
Assignment operator Assign the TQuaternion components from a boost::math::quaternion.
void setIdentity ()
Set to an identity matrix.
TQuaternion< T > & normalize ()
Normalize the quaternion.
void swap (TQuaternion &q)
Swap the contents of two TQuaternion.
void fromAxisAngle (const TVector3< T > &axis, const T &angle)
Assign the TQuaternion from an rotation axis and an angle.
void fromEulerAngles (const T &yaw, const T &pitch, const T &roll)
Assign the TQuaternion from Euler angles.
void toAxisAngle (TVector3< T > &axis, T &angle)
Assign the TQuaternion to an axis and an angle.
void toEulerAngles (T &yaw, T &pitch, T &roll)
Assign the TQuaternion to Euler angles.
void get (TQuaternion &q) const
Assign to another TQuaternion.
T getAngle () const
Get the positive angle rotation.
TVector3< T > getAxis ()
Get the normalized direction vector of the rotation axis.
TMatrix4x4< T > & getRotationMatrix (TMatrix4x4< T > &m) const
Get the rotation matrix.
TQuaternion getInverse () const
Get the inverse TQuaternion.
TQuaternion getConjugate () const
Return the conjugate TQuaternion.
Accessors
T & w ()
Get the angular component w.
const T & w () const
Get the constant angular component w.
T & i ()
Get the axis component i.
const T & i () const
Get the constant axis component i.
T & j ()
Get the axis component j.
const T & j () const
Get the constant axis component j.
T & k ()
Get the axis component k.
const T & k () const
Get the constant axis component k.
Debugging and Diagnostics
void dump (std::ostream &s=std::cout, Size depth=0) const
Internal state dump.

Detailed Description

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

Generic Quaternion Class.

Representing a rotation in three dimensional space.


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.

References BALL::TQuaternion< T >::setIdentity().

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

Copy constructor.

Create a new TQuaternion object from another.

Parameters:
TQuaternion the TQuaternion object to be copied

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>

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:
w assigned to the angular component w
i assigned to the vector component i
j assigned to the vector component j
k assigned to the vector component k

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:
axis assigned to the axis
angle assigned to the angle

References BALL::TQuaternion< T >::fromAxisAngle().

template<typename T >
BALL::TQuaternion< T >::~TQuaternion ( ) [virtual]

Destructor.

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


Member Function Documentation

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

Clear method.

The values are set to the identity quaternion.

References BALL::TQuaternion< T >::setIdentity().

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

References BALL::TQuaternion< T >::i(), BALL::TQuaternion< T >::j(), BALL::TQuaternion< T >::k(), and BALL::TQuaternion< T >::w().

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:
axis the rotation axis
angle the rotation angle

References BALL::TVector3< T >::getLength(), BALL::Maths::isEqual(), BALL::TVector3< T >::x, BALL::TVector3< T >::y, and BALL::TVector3< T >::z.

Referenced by BALL::TQuaternion< T >::set(), and BALL::TQuaternion< T >::TQuaternion().

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:
yaw the rotation about the yaw axis z-axis()
pitch the rotation about the pitch axis (y-axis)
roll the nrotation about the roll axis (x-axis)

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

Assign to another TQuaternion.

Assigns the components to another TQuaternion.

Parameters:
q the TQuaternion to be assigned to

References BALL::TQuaternion< T >::set().

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

Get the positive angle rotation.

Returns:
T the angle value

References BALL::Maths::isEqual().

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

Get the normalized direction vector of the rotation axis.

Returns:
TVector3 the axis

References BALL::Maths::isEqual().

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

Return the conjugate TQuaternion.

(The axis components are negated.)

Returns:
TQuaternion the conjugate TQuaternion

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

Get the inverse TQuaternion.

Returns:
TQuaternion the inverse TQuaternion

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

Get the rotation matrix.

Parameters:
m the matrix to compute from
Returns:
TMatrix4x4 the rotation matrix

References BALL::TMatrix4x4< T >::set().

Referenced by BALL::TQuaternion< T >::toEulerAngles().

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

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

Get the axis component i.

Returns:
get a reference to the axis component i

Referenced by BALL::TQuaternion< T >::dump().

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

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

Get the axis component j.

Returns:
get a reference to the axis component j

Referenced by BALL::TQuaternion< T >::dump().

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

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

Get the axis component k.

Returns:
get a reference to the axis component k

Referenced by BALL::TQuaternion< T >::dump().

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

Normalize the quaternion.

The quaternion is scaled with its norm:

Returns:
TQuaternion&, a reference to the normalized quaternion

References BALL::Maths::isEqual().

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

Assignment operator.

Assign the TQuaternion components form another TQuaternion.

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

Assign the TQuaternion components.

Parameters:
w assigned to the angular component w
i assigned to the vector component i
j assigned to the vector component j
k assigned to the vector component k

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

Assign the TQuaternion components.

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

References BALL::TQuaternion< T >::fromAxisAngle().

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

Set to an identity matrix.

angular component w = 1; axis components i,j,k are set to 0;

Referenced by BALL::TQuaternion< T >::clear(), and BALL::TQuaternion< T >::TQuaternion().

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

Swap the contents of two TQuaternion.

Parameters:
q the TQuaternion to swap contents with

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:
axis the rotation axis
angle the rotation angle

References BALL::Maths::isEqual(), BALL::TVector3< T >::x, BALL::TVector3< T >::y, and BALL::TVector3< T >::z.

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:
yaw the rotation about the yaw axis z-axis()
pitch the rotation about the pitch axis (y-axis)
roll the nrotation about the roll axis (x-axis)

References BALL::Constants::EPSILON, and BALL::TQuaternion< T >::getRotationMatrix().

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

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

Get the angular component w.

Returns:
get a reference to the angular component w

Referenced by BALL::TQuaternion< T >::dump().


Generated on Thu Aug 6 18:30:35 2009 for BALL by doxygen 1.5.8