WFMath
1.0.1
|
A normalized quaterion. More...
#include <quaternion.h>
Public Member Functions | |
Quaternion () | |
Construct a Quatertion. | |
Quaternion (CoordType w_in, CoordType x_in, CoordType y_in, CoordType z_in) | |
Construct a Quaternion from (w, x, y, z) components. | |
Quaternion (int axis, CoordType angle) | |
Construct a Quaternion giving a rotation around axis by angle. | |
Quaternion (const Vector< 3 > &axis, CoordType angle) | |
Construct a Quaternion giving a rotation around the Vector axis by angle. | |
Quaternion (const Vector< 3 > &axis) | |
Construct a Quaternion giving a rotation around the Vector axis. | |
Quaternion (const Quaternion &p) | |
Construct a copy of a Quaternion. | |
Quaternion (const AtlasInType &a) | |
Construct a Quaternion from an Atlas::Message::Object. | |
AtlasOutType | toAtlas () const |
Create an Atlas object from the Quaternion. | |
void | fromAtlas (const AtlasInType &a) |
Set the Quaternion's value to that given by an Atlas object. | |
Quaternion & | identity () |
Set the Quaternion to the identity rotation. | |
bool | fromRotMatrix (const RotMatrix< 3 > &m) |
set a Quaternion's value from a RotMatrix | |
Quaternion | inverse () const |
returns the inverse of the Quaternion | |
Quaternion & | rotate (const RotMatrix< 3 > &) |
Rotate quaternion using the matrix. | |
Quaternion & | rotate (const Quaternion &q) |
rotate the quaternion using another quaternion | |
Quaternion & | rotation (int axis, CoordType angle) |
sets the Quaternion to a rotation by angle around axis | |
Quaternion & | rotation (const Vector< 3 > &axis, CoordType angle) |
sets the Quaternion to a rotation by angle around the Vector axis | |
Quaternion & | rotation (const Vector< 3 > &axis) |
sets the Quaternion to a rotation around the Vector axis | |
Quaternion & | rotation (const Vector< 3 > &from, const Vector< 3 > &to) |
sets the Quaternion to rotate 'from' to be parallel to 'to' | |
CoordType | scalar () const |
returns the scalar (w) part of the Quaternion | |
const Vector< 3 > & | vector () const |
returns the Vector (x, y, z) part of the quaternion | |
void | normalize () |
normalize to remove accumulated round-off error | |
unsigned | age () const |
current round-off age |
A normalized quaterion.
Construct a Quaternion from (w, x, y, z) components.
This normalizes the components so the sum of their squares is one.
|
inlineexplicit |
Construct a Quaternion giving a rotation around the Vector axis.
The angle of rotating is equal to the magnitude of the Vector
References rotation().
bool WFMath::Quaternion::fromRotMatrix | ( | const RotMatrix< 3 > & | m | ) |
set a Quaternion's value from a RotMatrix
Since a Quaternion can only represent an even-parity RotMatrix, this function returns false if the parity of m is odd. In this case, the quaternion is set to the value of m multiplied by a fixed parity-odd RotMatrix, so the full RotMatrix can be recovered by passing the Quaternion and the value of 'not_flip' returned by this function to RotMatrix::fromQuaternion().
Quaternion& WFMath::Quaternion::rotation | ( | const Vector< 3 > & | axis | ) |
sets the Quaternion to a rotation around the Vector axis
The rotation angle is given by the magnitude of the Vector