Loading...
Searching...
No Matches
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 Eigen::Quaternion< T > &q)
| TQuaternion (const T &a, const T &b, const T &c, const T &d)
| TQuaternion (const TVector3< T > &axis, const T &angle)
| ~TQuaternion ()
void | clear ()
Assignment
void | set (const TQuaternion &q)
void | set (const Eigen::Quaternion< T > &q)
void | set (const T &a, const T &b, const T &c, const T &d)
TQuaternion & | operator= (const TQuaternion &q)
TQuaternion & | operator= (const Eigen::Quaternion< T > &q)
bool | operator== (const TQuaternion< T > &q)
| Equality operator Returns true if the given Quaternion q is equal to this.
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

## Detailed Description

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

Generic Quaternion Class.

Representing a rotation in three dimensional space.

Definition at line 23 of file quaternion.h.

## Constructor & Destructor Documentation

## TQuaternion() [1/5]

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 294 of file quaternion.h.

## TQuaternion() [2/5]

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

Definition at line 301 of file quaternion.h.

## TQuaternion() [3/5]

template<typename T>

BALL::TQuaternion< T >::TQuaternion | ( | const Eigen::Quaternion< T > & | q | ) |

Detailed constructor. Create a new TQuaternion object from an Eigen::Quaternion<T>.

Parameters

  Eigen::Quaternion<T> |

Definition at line 307 of file quaternion.h.

## TQuaternion() [4/5]

template<typename T>

BALL::TQuaternion< T >::TQuaternion | ( | const T & | a,
|  | const T & | b,
|  | const T & | c,
|  | const T & | d )

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

Definition at line 313 of file quaternion.h.

## TQuaternion() [5/5]

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

Definition at line 319 of file quaternion.h.

## ~TQuaternion()

template<typename T>

BALL::TQuaternion< T >::~TQuaternion | ( |  | ) |

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

Definition at line 326 of file quaternion.h.

## Member Function Documentation

## clear()

template<typename T>

void BALL::TQuaternion< T >::clear | ( |  | ) |

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

Definition at line 331 of file quaternion.h.

## dump()

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 605 of file quaternion.h.

## fromAxisAngle()

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

Definition at line 407 of file quaternion.h.

## fromEulerAngles()

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)

Definition at line 419 of file quaternion.h.

## get()

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

  q | the TQuaternion to be assigned to

Definition at line 488 of file quaternion.h.

## getAngle()

template<typename T>

T BALL::TQuaternion< T >::getAngle | ( |  | ) | const

Get the positive angle rotation.

Returns
  T the angle value

Definition at line 494 of file quaternion.h.

## getAxis()

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 502 of file quaternion.h.

## getConjugate()

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 534 of file quaternion.h.

## getInverse()

template<typename T>

BALL_INLINE TQuaternion< T > BALL::TQuaternion< T >::getInverse | ( |  | ) | const

Get the inverse TQuaternion.

Returns
  TQuaternion the inverse TQuaternion

Definition at line 527 of file quaternion.h.

## getRotationMatrix()

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

Definition at line 511 of file quaternion.h.

## i() [1/2]

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 558 of file quaternion.h.

## i() [2/2]

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 552 of file quaternion.h.

## j() [1/2]

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 570 of file quaternion.h.

## j() [2/2]

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 564 of file quaternion.h.

## k() [1/2]

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 582 of file quaternion.h.

## k() [2/2]

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 576 of file quaternion.h.

## normalize()

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 390 of file quaternion.h.

## operator=() [1/2]

template<typename T>

BALL_INLINE TQuaternion< T > & BALL::TQuaternion< T >::operator= | ( | const Eigen::Quaternion< T > & | q | ) |

Assignment operator Assign the TQuaternion components from an Eigen::Quaternion.

Definition at line 360 of file quaternion.h.

## operator=() [2/2]

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 368 of file quaternion.h.

## operator==()

template<typename T>

BALL_INLINE bool BALL::TQuaternion< T >::operator== | ( | const TQuaternion< T > & | q | ) |

Equality operator Returns true if the given Quaternion q is equal to this.

Definition at line 376 of file quaternion.h.

## set() [1/3]

template<typename T>

void BALL::TQuaternion< T >::set | ( | const Eigen::Quaternion< T > & | q | ) |

Assign coefficients of q to this quaternion

Parameters

  q | the Eigen::Quaternion<T> to copy coefficients from

Definition at line 343 of file quaternion.h.

## set() [2/3]

template<typename T>

BALL_INLINE void BALL::TQuaternion< T >::set | ( | const T & | a,
|  | const T & | b,
|  | const T & | c,
|  | const T & | d )

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

Definition at line 350 of file quaternion.h.

## set() [3/3]

template<typename T>

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

Assign coefficients of q to this quaternion

Parameters

  q | the Quaternion to copy coefficients from

Definition at line 337 of file quaternion.h.

## setIdentity()

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 383 of file quaternion.h.

## swap()

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

Definition at line 398 of file quaternion.h.

## toAxisAngle()

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

Definition at line 441 of file quaternion.h.

## toEulerAngles()

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)

Definition at line 452 of file quaternion.h.

## w() [1/2]

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 546 of file quaternion.h.

## w() [2/2]

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 540 of file quaternion.h.