#include <BALL/MATHS/quaternion.h>
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) | |
virtual | ~TQuaternion () |
virtual 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) |
TQuaternion & | operator= (const TQuaternion &q) |
TQuaternion & | operator= (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 |
T | 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 |
Generic Quaternion Class.
Representing a rotation in three dimensional space.
BALL::TQuaternion< T >::TQuaternion | ( | ) | [inline] |
Default constructor. This method creates a new TQuaternion object. The quaternion is set to an identity quaternion.
References BALL::TQuaternion< T >::setIdentity().
BALL::TQuaternion< T >::TQuaternion | ( | const TQuaternion< T > & | q | ) | [inline] |
Copy constructor. Create a new TQuaternion object from another.
TQuaternion | the TQuaternion object to be copied |
BALL::TQuaternion< T >::TQuaternion | ( | const boost::math::quaternion< T > & | q | ) | [inline] |
Detailed constructor. Create a new TQuaternion object from a boost::math::quaternion.
boost::math::quaternion<T> |
BALL::TQuaternion< T >::TQuaternion | ( | const T & | w, | |
const T & | i, | |||
const T & | j, | |||
const T & | k | |||
) | [inline] |
Detailed constructor. Create a new TQuaternion object from four values of type T.
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 |
BALL::TQuaternion< T >::TQuaternion | ( | const TVector3< T > & | axis, | |
const T & | angle | |||
) | [inline] |
Detailed constructor. Create a new TQuaternion object from a variable of type TVector3 and an angle.
axis | assigned to the axis | |
angle | assigned to the angle |
References BALL::TQuaternion< T >::fromAxisAngle().
BALL::TQuaternion< T >::~TQuaternion | ( | ) | [inline, virtual] |
Destructor. Destructs the TQuaternion object. As there are no dynamic data structures, nothing happens.
void BALL::TQuaternion< T >::clear | ( | ) | [inline, virtual] |
Clear method. The values are set to the identity quaternion.
References BALL::TQuaternion< T >::setIdentity().
void BALL::TQuaternion< T >::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [inline] |
Internal state dump. Dump the current internal state of {*this} to the output ostream s with dumping depth depth .
s | - output stream where to output the internal state of {*this} | |
depth | - the dumping depth |
References BALL_DUMP_DEPTH, BALL_DUMP_HEADER, BALL_DUMP_STREAM_PREFIX, BALL_DUMP_STREAM_SUFFIX, BALL::TQuaternion< T >::i(), BALL::TQuaternion< T >::j(), BALL::TQuaternion< T >::k(), and BALL::TQuaternion< T >::w().
void BALL::TQuaternion< T >::fromAxisAngle | ( | const TVector3< T > & | axis, | |
const T & | angle | |||
) | [inline] |
Assign the TQuaternion from an rotation axis and an angle.
axis | the rotation axis | |
angle | the rotation angle |
References BALL::Constants::c, 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().
void BALL::TQuaternion< T >::fromEulerAngles | ( | const T & | yaw, | |
const T & | pitch, | |||
const T & | roll | |||
) | [inline] |
Assign the TQuaternion from Euler angles. Assume the following rotation order:. q' = roll( pitch( yaw(q) ) ).
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::c.
BALL_INLINE void BALL::TQuaternion< T >::get | ( | TQuaternion< T > & | q | ) | const [inline] |
Assign to another TQuaternion. Assigns the components to another TQuaternion.
q | the TQuaternion to be assigned to |
References BALL::TQuaternion< T >::set().
T BALL::TQuaternion< T >::getAngle | ( | ) | const [inline] |
Get the positive angle rotation.
References BALL::Constants::c, and BALL::Maths::isEqual().
TVector3< T > BALL::TQuaternion< T >::getAxis | ( | ) | [inline] |
Get the normalized direction vector of the rotation axis.
References BALL::Constants::c, and BALL::Maths::isEqual().
BALL_INLINE TQuaternion< T > BALL::TQuaternion< T >::getConjugate | ( | ) | const [inline] |
Return the conjugate TQuaternion. (The axis components are negated.)
BALL_INLINE TQuaternion< T > BALL::TQuaternion< T >::getInverse | ( | ) | const [inline] |
Get the inverse TQuaternion.
TMatrix4x4< T > & BALL::TQuaternion< T >::getRotationMatrix | ( | TMatrix4x4< T > & | m | ) | const [inline] |
Get the rotation matrix.
m | the matrix to compute from |
References BALL::Constants::c, and BALL::TMatrix4x4< T >::set().
Referenced by BALL::TQuaternion< T >::toEulerAngles().
const T & BALL::TQuaternion< T >::i | ( | ) | const [inline] |
Get the constant axis component i.
T & BALL::TQuaternion< T >::i | ( | ) | [inline] |
Get the axis component i.
Referenced by BALL::TQuaternion< T >::dump(), and BALL::operator>>().
const T & BALL::TQuaternion< T >::j | ( | ) | const [inline] |
Get the constant axis component j.
References BALL::Constants::c.
T & BALL::TQuaternion< T >::j | ( | ) | [inline] |
Get the axis component j.
References BALL::Constants::c.
Referenced by BALL::TQuaternion< T >::dump(), and BALL::operator>>().
const T & BALL::TQuaternion< T >::k | ( | ) | const [inline] |
Get the constant axis component k.
T & BALL::TQuaternion< T >::k | ( | ) | [inline] |
Get the axis component k.
Referenced by BALL::TQuaternion< T >::dump(), and BALL::operator>>().
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::normalize | ( | ) | [inline] |
Normalize the quaternion. The quaternion is scaled with its norm:
References BALL::Constants::c, and BALL::Maths::isEqual().
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::operator= | ( | const boost::math::quaternion< T > & | q | ) | [inline] |
Assignment operator Assign the TQuaternion components from a boost::math::quaternion.
BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::operator= | ( | const TQuaternion< T > & | q | ) | [inline] |
Assignment operator. Assign the TQuaternion components form another TQuaternion.
Referenced by BALL::TQuaternion< T >::set().
BALL_INLINE void BALL::TQuaternion< T >::set | ( | const T & | w, | |
const T & | i, | |||
const T & | j, | |||
const T & | k | |||
) | [inline] |
Assign the TQuaternion components.
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 |
References BALL::Constants::c.
BALL_INLINE void BALL::TQuaternion< T >::set | ( | const TVector3< T > & | axis, | |
const T & | angle | |||
) | [inline] |
Assign the TQuaternion components.
axis | the new axis component | |
angle | the new angle component |
References BALL::TQuaternion< T >::fromAxisAngle().
void BALL::TQuaternion< T >::set | ( | const boost::math::quaternion< T > & | q | ) | [inline] |
References BALL::TQuaternion< T >::operator=().
void BALL::TQuaternion< T >::set | ( | const TQuaternion< T > & | q | ) | [inline] |
References BALL::TQuaternion< T >::operator=().
Referenced by BALL::TQuaternion< T >::get().
BALL_INLINE void BALL::TQuaternion< T >::setIdentity | ( | ) | [inline] |
Set to an identity matrix. angular component w = 1; axis components i,j,k are set to 0;
References BALL::Constants::c.
Referenced by BALL::TQuaternion< T >::clear(), and BALL::TQuaternion< T >::TQuaternion().
void BALL::TQuaternion< T >::swap | ( | TQuaternion< T > & | q | ) | [inline] |
Swap the contents of two TQuaternion.
q | the TQuaternion to swap contents with |
References BALL::Constants::c.
void BALL::TQuaternion< T >::toAxisAngle | ( | TVector3< T > & | axis, | |
T & | angle | |||
) | [inline] |
Assign the TQuaternion to an axis and an angle. the rotation axis is normalized.
axis | the rotation axis | |
angle | the rotation angle |
References BALL::Constants::c, BALL::Maths::isEqual(), BALL::TVector3< T >::x, BALL::TVector3< T >::y, and BALL::TVector3< T >::z.
void BALL::TQuaternion< T >::toEulerAngles | ( | T & | yaw, | |
T & | pitch, | |||
T & | roll | |||
) | [inline] |
Assign the TQuaternion to Euler angles. Assume the following rotation order:. q' = roll( pitch( yaw(q) ) ).
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().
const T & BALL::TQuaternion< T >::w | ( | ) | const [inline] |
Get the constant angular component w.
T & BALL::TQuaternion< T >::w | ( | ) | [inline] |
Get the angular component w.
Referenced by BALL::TQuaternion< T >::dump(), and BALL::operator>>().