This class represents a Quaternion. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion | inv () const |
Inversion. | |
Quaternion & | inv_IP () |
Inversion. | |
float | norm () const |
Quaternion & | normalize () |
Quaternion | normalized () const |
const float & | operator() (unsigned int i) const |
float & | operator() (unsigned int i) |
Quaternion | operator* (const Quaternion &other) const |
Quaternion multiplication. | |
Quaternion | operator* (const Vector3 &v) const |
Quaternion multiplication with extended vector. | |
void | operator/= (float x) |
Quaternion & | operator= (const Quaternion &other) |
bool | operator== (const Quaternion &other) const |
Quaternion () | |
Default constructor. | |
Quaternion (const Quaternion &other) | |
Copy constructor. | |
Quaternion (float u, float x, float y, float z) | |
Constructor. | |
Quaternion (const Vector3 &other) | |
Constructor. | |
Quaternion (double roll, double pitch, double yaw) | |
Constructor from Euler angles. | |
Quaternion (const Vector3 &axis, double angle) | |
Constructs a Unit Quaternion from a rotation angle and axis. | |
std::istream & | read (std::istream &s) |
std::istream & | readBinary (std::istream &s) |
Vector3 | rotate (const Vector3 &v) const |
Rotate a vector. | |
Vector3 | toEuler () const |
Conversion to Euler angles. | |
void | toRotMatrix (std::vector< double > &rot_matrix_3_3) const |
float & | u () |
const float & | u () const |
std::ostream & | write (std::ostream &s) const |
std::ostream & | writeBinary (std::ostream &s) const |
float & | x () |
const float & | x () const |
float & | y () |
const float & | y () const |
float & | z () |
const float & | z () const |
Protected Attributes | |
float | data [4] |
Friends | |
Quaternion | operator* (const Vector3 &v, const Quaternion &q) |
Quaternion multiplication with extended vector. |
This class represents a Quaternion.
The Unit Quaternion is one possible representation of the attitude of an object in tree-dimensional space.
This Quaternion class is implemented according to Diebel, James. Representing Attitude: Euler Angle, Unit Quaternions, and Rotation Vectors. Stanford University. 2006. - Technical Report.
Definition at line 56 of file Quaternion.h.
octomath::Quaternion::Quaternion | ( | ) | [inline] |
Default constructor.
Constructs the (1,0,0,0) Unit Quaternion representing the identity rotation.
Definition at line 66 of file Quaternion.h.
octomath::Quaternion::Quaternion | ( | const Quaternion & | other | ) |
Copy constructor.
Definition at line 47 of file Quaternion.cpp.
octomath::Quaternion::Quaternion | ( | float | u, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Constructor.
Constructs a Quaternion from four single values
Definition at line 54 of file Quaternion.cpp.
octomath::Quaternion::Quaternion | ( | const Vector3 & | other | ) |
Constructor.
other | a vector containing euler angles |
Definition at line 61 of file Quaternion.cpp.
octomath::Quaternion::Quaternion | ( | double | roll, |
double | pitch, | ||
double | yaw | ||
) |
Constructor from Euler angles.
Constructs a Unit Quaternion from Euler angles / Tait Bryan angles (in radians) according to the 1-2-3 convention.
roll | phi/roll angle (rotation about x-axis) |
pitch | theta/pitch angle (rotation about y-axis) |
yaw | psi/yaw angle (rotation about z-axis) |
Definition at line 65 of file Quaternion.cpp.
octomath::Quaternion::Quaternion | ( | const Vector3 & | axis, |
double | angle | ||
) |
Constructs a Unit Quaternion from a rotation angle and axis.
Definition at line 89 of file Quaternion.cpp.
Quaternion octomath::Quaternion::inv | ( | ) | const [inline] |
Inversion.
Inverts this Quaternion
Definition at line 247 of file Quaternion.cpp.
float octomath::Quaternion::norm | ( | ) | const |
Definition at line 98 of file Quaternion.cpp.
Definition at line 233 of file Quaternion.cpp.
Quaternion octomath::Quaternion::normalized | ( | ) | const |
Definition at line 240 of file Quaternion.cpp.
const float& octomath::Quaternion::operator() | ( | unsigned int | i | ) | const [inline] |
Definition at line 116 of file Quaternion.h.
float& octomath::Quaternion::operator() | ( | unsigned int | i | ) | [inline] |
Definition at line 117 of file Quaternion.h.
Quaternion octomath::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Quaternion multiplication.
Standard Quaternion multiplication which is not commutative.
Definition at line 218 of file Quaternion.cpp.
Quaternion octomath::Quaternion::operator* | ( | const Vector3 & | v | ) | const |
Quaternion multiplication with extended vector.
Definition at line 225 of file Quaternion.cpp.
void octomath::Quaternion::operator/= | ( | float | x | ) |
Definition at line 106 of file Quaternion.cpp.
Quaternion & octomath::Quaternion::operator= | ( | const Quaternion & | other | ) |
Definition at line 210 of file Quaternion.cpp.
bool octomath::Quaternion::operator== | ( | const Quaternion & | other | ) | const |
Definition at line 112 of file Quaternion.cpp.
std::istream & octomath::Quaternion::read | ( | std::istream & | s | ) |
Definition at line 260 of file Quaternion.cpp.
std::istream & octomath::Quaternion::readBinary | ( | std::istream & | s | ) |
Definition at line 278 of file Quaternion.cpp.
Vector3 octomath::Quaternion::rotate | ( | const Vector3 & | v | ) | const |
Rotate a vector.
Rotates a vector to the body fixed coordinate system according to the attitude represented by this Quaternion.
v | a vector represented in world coordinates |
Definition at line 254 of file Quaternion.cpp.
Vector3 octomath::Quaternion::toEuler | ( | ) | const |
Conversion to Euler angles.
Converts the attitude represented by this to Euler angles (roll, pitch, yaw).
Definition at line 123 of file Quaternion.cpp.
void octomath::Quaternion::toRotMatrix | ( | std::vector< double > & | rot_matrix_3_3 | ) | const |
Definition at line 166 of file Quaternion.cpp.
float& octomath::Quaternion::u | ( | ) | [inline] |
Definition at line 178 of file Quaternion.h.
const float& octomath::Quaternion::u | ( | ) | const [inline] |
Definition at line 183 of file Quaternion.h.
std::ostream & octomath::Quaternion::write | ( | std::ostream & | s | ) | const |
Definition at line 269 of file Quaternion.cpp.
std::ostream & octomath::Quaternion::writeBinary | ( | std::ostream & | s | ) | const |
Definition at line 290 of file Quaternion.cpp.
float& octomath::Quaternion::x | ( | ) | [inline] |
Definition at line 179 of file Quaternion.h.
const float& octomath::Quaternion::x | ( | ) | const [inline] |
Definition at line 184 of file Quaternion.h.
float& octomath::Quaternion::y | ( | ) | [inline] |
Definition at line 180 of file Quaternion.h.
const float& octomath::Quaternion::y | ( | ) | const [inline] |
Definition at line 185 of file Quaternion.h.
float& octomath::Quaternion::z | ( | ) | [inline] |
Definition at line 181 of file Quaternion.h.
const float& octomath::Quaternion::z | ( | ) | const [inline] |
Definition at line 186 of file Quaternion.h.
Quaternion operator* | ( | const Vector3 & | v, |
const Quaternion & | q | ||
) | [friend] |
Quaternion multiplication with extended vector.
Definition at line 229 of file Quaternion.cpp.
float octomath::Quaternion::data[4] [protected] |
Definition at line 194 of file Quaternion.h.