#include <quaternion.h>

Public Member Functions | |
| quaternion (void) | |
| Default Constructor. | |
| quaternion (const math::vector3 &v_, real_t w_) | |
| Constructor to set x y z w. | |
| quaternion (real_t x_, real_t y_, real_t z_, real_t w_) | |
| Constructor to set a x y z w. | |
| quaternion (const math::quaternion &p) | |
| Copy Constructor. | |
| math::quaternion & | operator= (const math::quaternion &p) |
| Assignment Operator. | |
| real_t | w (void) const |
| Returns a copy of w. | |
| real_t | x (void) const |
| Returns a copy of x. | |
| real_t | y (void) const |
| Returns a copy of y. | |
| real_t | z (void) const |
| Returns a copy of z. | |
| math::vector3 | v (void) const |
| Returns a copy of x y z. | |
| math::vector3 | vec (void) const |
| Returns a copy of x y z. | |
| real_t | scalar (void) const |
| Returns a copy of w. | |
| void | set (real_t x_, real_t y_, real_t z_, real_t w_) |
| Sets the quaternion. | |
| void | set (const math::vector3 &v_, real_t w_) |
| Sets the quaternion. | |
| math::quaternion | conjugate (void) const |
| Returns the conjugate of the quaternion. | |
| math::quaternion | operator! (void) const |
| Returns the inverse of the quaternion. | |
| double | magnitude (void) const |
| Returns the magnitude of the quaternion. | |
| void | normalize (void) |
| Normalizes the quaternion. | |
| void | set_identity (void) |
| Sets the quaternion to the identity quaternion. | |
| math::matrix4 | get_rotation_matrix (void) const |
| Returns the rotation matrix that describes this quaternion. | |
| void | get_rotation_matrix (math::matrix4 &m) const |
| Sets a rotation matrix that describes this quaternion. | |
| math::matrix4 | get_transposed_rotation_matrix (void) const |
| Returns the transposed rotation matrix that describes this quaternion. | |
| void | get_transposed_rotation_matrix (math::matrix4 &m) const |
| Sets transposed rotation matrix that describes this quaternion. | |
| math::quaternion | operator* (const math::quaternion &rhs) const |
| Quaternion Multiplication. | |
| math::vector3 | operator* (const math::vector3 &rhs) const |
| Quaternion Vector Multiplication. | |
| void | from_angle_axis (real_t radians, const math::vector3 &axis) |
| Creates a rotation matrix given around an arbitrary axis. | |
| void | get_angle_axis (real_t &radians, math::vector3 &axis) const |
| Returns the angle and axis the quaternion describes. | |
| void | from_angles (real_t x_rad, real_t y_rad, real_t z_rad) |
| Creates a unit length quaternion from three Euler angles. | |
| void | from_matrix3 (const real_t *mat) |
| Creates a unit length quaternion from a 3x3 rotation matrix. | |
| void | from_matrix4 (const real_t *mat) |
| Creates a unit length quaternion from a 4x4 rotation matrix. | |
Static Public Member Functions | |
| static math::quaternion | slerp (real_t percent, const math::quaternion &qa, math::quaternion qb) |
| Spherical Linear Interpretation. | |
Static Public Attributes | |
| static const math::quaternion | IDENTITY |
| The identity quaternion. | |
Friends | |
| std::ostream & | math::operator<< (std::ostream &o, const math::quaternion &vec) |
stream output operator. | |
Quaternions take on the form:
Definition at line 46 of file quaternion.h.
| math::quaternion::quaternion | ( | void | ) | [inline] |
Default Constructor.
Sets quaternion to
.
Definition at line 62 of file quaternion.h.
Referenced by conjugate(), operator!(), operator*(), and slerp().
| math::quaternion::quaternion | ( | const math::vector3 & | v_, | |
| real_t | w_ | |||
| ) | [inline] |
Constructor to set x y z w.
| v_ | vector which defines the quaternion's x y z. | |
| w_ | real_t which define the quaternion's w. |
Definition at line 70 of file quaternion.h.
Constructor to set a x y z w.
| x_ | real_t which defines the quaternion's x. | |
| y_ | real_t which defines the quaternion's y. | |
| z_ | real_t which defines the quaternion's z. | |
| w_ | real_t which defines the quaternion's w. |
Definition at line 80 of file quaternion.h.
| math::quaternion math::quaternion::conjugate | ( | void | ) | const [inline] |
Returns the conjugate of the quaternion.
The conjugate of the quaternion is defined as:
Definition at line 170 of file quaternion.h.
References quaternion().
| void math::quaternion::from_angle_axis | ( | real_t | radians, | |
| const math::vector3 & | axis | |||
| ) |
Creates a rotation matrix given around an arbitrary axis.
Given an axis and an angle, this method will create a set this quaternion as the quaternion that describes the rotation around the axis by angle.
| radians | A real number in radians. | |
| axis | A unit length vector describing the axis to rotate around. |
Definition at line 164 of file quaternion.cpp.
References math::equals(), and math::vector3::length().
Referenced by from_angles().
Creates a unit length quaternion from three Euler angles.
| x_rad | Rotation around x axis in radians. | |
| y_rad | Rotation around y axis in radians. | |
| z_rad | Rotation around z axis in radians. |
Definition at line 203 of file quaternion.cpp.
References from_angle_axis(), normalize(), math::vector3::X_AXIS, math::vector3::Y_AXIS, and math::vector3::Z_AXIS.
| void math::quaternion::from_matrix3 | ( | const real_t * | mat | ) |
Creates a unit length quaternion from a 3x3 rotation matrix.
| mat | Pointer to an real_t[ 9 ] representing a rotation matrix. Matrix is assumed to be stored in row major format. |
Definition at line 221 of file quaternion.cpp.
References math::vector3::x(), math::vector3::y(), and math::vector3::z().
| void math::quaternion::from_matrix4 | ( | const real_t * | mat | ) |
Creates a unit length quaternion from a 4x4 rotation matrix.
| mat | Pointer to an real_t[ 16 ] representing a rotation matrix. Matrix is assumed to be stored in row major format. |
Definition at line 262 of file quaternion.cpp.
References math::vector3::x(), math::vector3::y(), and math::vector3::z().
| void math::quaternion::get_angle_axis | ( | real_t & | radians, | |
| math::vector3 & | axis | |||
| ) | const |
Returns the angle and axis the quaternion describes.
| radians | The angle about axis in radians (output). | |
| axis | The axis the quaternion's rotation is aroiund (output). |
Definition at line 176 of file quaternion.cpp.
References math::equals(), magnitude(), math::vector3::set(), math::vector3::x(), math::vector3::y(), and math::vector3::z().
| void math::quaternion::get_rotation_matrix | ( | math::matrix4 & | m | ) | const |
Sets a rotation matrix that describes this quaternion.
| m | A matrix4 where the rotation matrix will be written. |
Definition at line 37 of file quaternion.cpp.
References math::matrix4::set(), math::vector3::x(), math::vector3::y(), and math::vector3::z().
| math::matrix4 math::quaternion::get_rotation_matrix | ( | void | ) | const |
Returns the rotation matrix that describes this quaternion.
matrix4 that describes the rotation this quaternion represents. Definition at line 78 of file quaternion.cpp.
Referenced by operator*().
| void math::quaternion::get_transposed_rotation_matrix | ( | math::matrix4 & | m | ) | const |
Sets transposed rotation matrix that describes this quaternion.
| m | A matrix4 where the rotation matrix will be written. |
Definition at line 87 of file quaternion.cpp.
References math::matrix4::set(), math::vector3::x(), math::vector3::y(), and math::vector3::z().
| math::matrix4 math::quaternion::get_transposed_rotation_matrix | ( | void | ) | const |
Returns the transposed rotation matrix that describes this quaternion.
matrix4 that describes the rotation this quaternion represents. Definition at line 128 of file quaternion.cpp.
| double math::quaternion::magnitude | ( | void | ) | const [inline] |
Returns the magnitude of the quaternion.
The magnitude of the quaternion is defined as:
Definition at line 190 of file quaternion.h.
Referenced by get_angle_axis(), and normalize().
| void math::quaternion::normalize | ( | void | ) | [inline] |
Normalizes the quaternion.
Definition at line 199 of file quaternion.h.
References magnitude(), math::vector3::x(), math::vector3::y(), and math::vector3::z().
Referenced by from_angles().
| math::quaternion math::quaternion::operator! | ( | void | ) | const [inline] |
Returns the inverse of the quaternion.
The inverse of a normalized quaternion is defined as:
Definition at line 180 of file quaternion.h.
References quaternion().
| math::vector3 math::quaternion::operator* | ( | const math::vector3 & | rhs | ) | const |
Quaternion Vector Multiplication.
Multiplies the matrix that this quaternion describes by the vector rhs.
Definition at line 154 of file quaternion.cpp.
References get_rotation_matrix().
| real_t math::quaternion::scalar | ( | void | ) | const [inline] |
| void math::quaternion::set | ( | const math::vector3 & | v_, | |
| real_t | w_ | |||
| ) | [inline] |
Sets the quaternion.
| v_ | vector which defines the quaternion's x y z. | |
| w_ | real_t which define the quaternion's w. |
Definition at line 159 of file quaternion.h.
Sets the quaternion.
| x_ | real_t which defines the quaternion's x. | |
| y_ | real_t which defines the quaternion's y. | |
| z_ | real_t which defines the quaternion's z. | |
| w_ | real_t which defines the quaternion's w. |
Definition at line 148 of file quaternion.h.
References math::vector3::set().
| void math::quaternion::set_identity | ( | void | ) | [inline] |
Sets the quaternion to the identity quaternion.
The identity quaternion is defined as:
Definition at line 213 of file quaternion.h.
References math::vector3::set().
| math::quaternion math::quaternion::slerp | ( | real_t | percent, | |
| const math::quaternion & | qa, | |||
| math::quaternion | qb | |||
| ) | [static] |
Spherical Linear Interpretation.
Interprets the between the two rotations that qa and qb describe.
| percent | A real_t between [0-1] descibing how much to interpret between qa and qb. | |
| qa | Initial orientation. | |
| qb | Ending orientation. |
Definition at line 301 of file quaternion.cpp.
References math::equals(), m_v, m_w, math::vector3::negate(), quaternion(), v(), w(), x(), y(), and z().
| math::vector3 math::quaternion::v | ( | void | ) | const [inline] |
Returns a copy of x y z.
vector containing x y z. Definition at line 120 of file quaternion.h.
Referenced by slerp().
| math::vector3 math::quaternion::vec | ( | void | ) | const [inline] |
Returns a copy of x y z.
vector containing x y z. Definition at line 129 of file quaternion.h.
Referenced by fob::bird::get_quaternion().
| std::ostream& math::operator<< | ( | std::ostream & | o, | |
| const math::quaternion & | vec | |||
| ) | [friend] |
stream output operator.
Outputs quaternion as x y z w.
const math::quaternion math::quaternion::IDENTITY [static] |
The identity quaternion.
The identity quaternion is described as:
Definition at line 321 of file quaternion.h.
1.5.7.1