Helper class for exchanging Rotations/Orientations. More...
#include <InstantIO/Rotation.h>
Public Member Functions | |
Rotation () | |
Creates a new Rotation object. | |
Rotation (float q1, float q2, float q3, float q4) | |
Constructor that initializes the Rotation object with the given quaternions. | |
Rotation (const float *quat) | |
Constructor that initializes the Rotation object with the values of a given float array. | |
Rotation (const Rotation &rot) | |
Constructor that initializes the Rotation object with another Rotation object. | |
Rotation (const Vec3f &axis, float angle) | |
Constructor that initializes the Rotation object with a rotation axis and a rotation angle. | |
const Rotation & | operator= (const Rotation &rot) |
Assigns the components of another Rotation object to this object's components. | |
const float * | operator= (const float *quat) |
Assigns an array of floats to this object's components. | |
void | setQ1 (float q1) |
Sets the first quaternion of the rotation. | |
float | getQ1 () const |
Returns the first quaternion of the rotation. | |
void | setQ2 (float q2) |
Sets the second quaternion of the rotation. | |
float | getQ2 () const |
Returns the second quaternion of the rotation. | |
void | setQ3 (float q3) |
Sets the third quaternion of the rotation. | |
float | getQ3 () const |
Returns the third quaternion of the rotation. | |
void | setQ4 (float q4) |
Sets the fourth quaternion of the rotation. | |
float | getQ4 () const |
Returns the fourth quaternion of the rotation. | |
void | set (float q1, float q2, float q3, float q4) |
Sets the rotation by setting the four quaternions. | |
void | set (const float *quat) |
Sets the rotation with the values of a given float array. | |
void | set (const Rotation &rot) |
Sets the rotation to the rotation of another Rotation object. | |
void | set (const Vec3f &axis, float angle) |
Sets the rotation by a rotation axis and a rotation angle. | |
void | get (float &q1, float &q2, float &q3, float &q4) const |
Returns the four components of the quaternion representation of the rotation. | |
void | get (float *quat) const |
Returns the quaternions of the rotation. | |
void | get (Rotation &rot) const |
Returns the rotation. | |
float | get (Vec3f &axis) const |
Returns the rotation axis and the rotation angle. | |
const float * | get () const |
Returns the quaternions of the rotation. | |
float * | get () |
Returns the quaternions of the rotation. | |
float | operator[] (int i) const |
Get a component of the quaternion representation of the rotation by an index. | |
float & | operator[] (int i) |
Get a component of the quaternion representation of the rotation by an index. | |
operator float * () | |
Transforms the rotation to an array of four float values that contain the four components of the quaternion representation of the rotation. | |
operator const float * () const | |
Transforms the rotation to an array of four float values that contain the four components of the quaternion representation of the rotation. | |
Rotation & | operator*= (const Rotation &rot) |
Multiplies the rotation by another rotation to get the product of both rotations. |
Helper class for exchanging Rotations/Orientations.
Rotation is a basic helper class for exchanging rotations resp. orientations between different software components. It does not contain any means for rotation arithmetics, only methods for setting and getting the rotation. It is not meant to be used directly by software components for rotation representation. Instead, software components should use their own, appropriate classes for handling rotations. Only when sending rotations to an OutSlot, or when receiving rotations from an InSlot, the internal representation of rotations should be converted to Rotation's. This ensures the interoperability between different software components that use different internal representations for rotations.
Rotations are internally stored as quaternions. You can access these quaternions directly, or you can use methods that convert a rotation axis and a rotation angle to and from the quaternions.
InstantIO::Rotation::Rotation | ( | float | q1, | |
float | q2, | |||
float | q3, | |||
float | q4 | |||
) | [inline] |
Constructor that initializes the Rotation object with the given quaternions.
q1 | The first quaternion | |
q2 | The second quaternion | |
q3 | The third quaternion | |
q4 | The fourth quaternion |
InstantIO::Rotation::Rotation | ( | const float * | quat | ) | [inline] |
Constructor that initializes the Rotation object with the values of a given float array.
quat | An array of at least four float values. The first four values must contain the quaternions that specify the rotation. |
InstantIO::Rotation::Rotation | ( | const Rotation & | rot | ) | [inline] |
Constructor that initializes the Rotation object with another Rotation object.
rot | The other Rotation object used to initialize this Rotation object. |
InstantIO::Rotation::Rotation | ( | const Vec3f & | axis, | |
float | angle | |||
) | [inline] |
Constructor that initializes the Rotation object with a rotation axis and a rotation angle.
axis | The rotation axis | |
angle | The rotation angle in radians |
Assigns the components of another Rotation object to this object's components.
rot | The other Rotation object |
const float* InstantIO::Rotation::operator= | ( | const float * | quat | ) | [inline] |
Assigns an array of floats to this object's components.
quat | An array of at least four float values. The first four values must contain the quaternions that specify the rotation. |
void InstantIO::Rotation::setQ1 | ( | float | q1 | ) | [inline] |
Sets the first quaternion of the rotation.
q1 | The new first quaternion. |
float InstantIO::Rotation::getQ1 | ( | ) | const [inline] |
Returns the first quaternion of the rotation.
void InstantIO::Rotation::setQ2 | ( | float | q2 | ) | [inline] |
Sets the second quaternion of the rotation.
q2 | The new second quaternion. |
float InstantIO::Rotation::getQ2 | ( | ) | const [inline] |
Returns the second quaternion of the rotation.
void InstantIO::Rotation::setQ3 | ( | float | q3 | ) | [inline] |
Sets the third quaternion of the rotation.
q3 | The new third quaternion. |
float InstantIO::Rotation::getQ3 | ( | ) | const [inline] |
Returns the third quaternion of the rotation.
void InstantIO::Rotation::setQ4 | ( | float | q4 | ) | [inline] |
Sets the fourth quaternion of the rotation.
q4 | The new fourth quaternion. |
float InstantIO::Rotation::getQ4 | ( | ) | const [inline] |
Returns the fourth quaternion of the rotation.
void InstantIO::Rotation::set | ( | float | q1, | |
float | q2, | |||
float | q3, | |||
float | q4 | |||
) | [inline] |
Sets the rotation by setting the four quaternions.
q1 | The first quaternion | |
q2 | The second quaternion | |
q3 | The third quaternion | |
q4 | The fourth quaternion |
void InstantIO::Rotation::set | ( | const float * | quat | ) | [inline] |
Sets the rotation with the values of a given float array.
quat | An array of at least four float values. The first four values must contain the quaternions that specify the rotation. |
void InstantIO::Rotation::set | ( | const Rotation & | rot | ) | [inline] |
Sets the rotation to the rotation of another Rotation object.
rot | The other Rotation object. |
void InstantIO::Rotation::set | ( | const Vec3f & | axis, | |
float | angle | |||
) |
Sets the rotation by a rotation axis and a rotation angle.
axis | The rotation axis | |
angle | The rotation angle in radians |
void InstantIO::Rotation::get | ( | float & | q1, | |
float & | q2, | |||
float & | q3, | |||
float & | q4 | |||
) | const [inline] |
Returns the four components of the quaternion representation of the rotation.
q1 | Returns the first component | |
q2 | Returns the second component | |
q3 | Returns the third component | |
q4 | Returns the fourth component |
void InstantIO::Rotation::get | ( | float * | quat | ) | const [inline] |
Returns the quaternions of the rotation.
quat | An array of at least four float values that gets filled with the quaternions of the rotation. |
void InstantIO::Rotation::get | ( | Rotation & | rot | ) | const [inline] |
Returns the rotation.
rot | The Rotation object that is set to the rotation of this Rotation object. |
float InstantIO::Rotation::get | ( | Vec3f & | axis | ) | const |
Returns the rotation axis and the rotation angle.
axis | The vector that gets filled with the rotation axis. |
const float* InstantIO::Rotation::get | ( | ) | const [inline] |
Returns the quaternions of the rotation.
float* InstantIO::Rotation::get | ( | ) | [inline] |
Returns the quaternions of the rotation.
float InstantIO::Rotation::operator[] | ( | int | i | ) | const [inline] |
Get a component of the quaternion representation of the rotation by an index.
i | The index |
float& InstantIO::Rotation::operator[] | ( | int | i | ) | [inline] |
Get a component of the quaternion representation of the rotation by an index.
i | The index |
InstantIO::Rotation::operator float * | ( | ) | [inline] |
Transforms the rotation to an array of four float values that contain the four components of the quaternion representation of the rotation.
InstantIO::Rotation::operator const float * | ( | ) | const [inline] |
Transforms the rotation to an array of four float values that contain the four components of the quaternion representation of the rotation.
Multiplies the rotation by another rotation to get the product of both rotations.
rot | The other rotation |