This class represents a Quaternion. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion | inv () const |
Inversion. More... | |
Quaternion & | inv_IP () |
Inversion. More... | |
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. More... | |
Quaternion | operator* (const Vector3 &v) const |
Quaternion multiplication with extended vector. More... | |
void | operator/= (float x) |
Quaternion & | operator= (const Quaternion &other) |
bool | operator== (const Quaternion &other) const |
Quaternion () | |
Default constructor. More... | |
Quaternion (const Quaternion &other) | |
Copy constructor. More... | |
Quaternion (float u, float x, float y, float z) | |
Constructor. More... | |
Quaternion (const Vector3 &other) | |
Constructor. More... | |
Quaternion (double roll, double pitch, double yaw) | |
Constructor from Euler angles. More... | |
Quaternion (const Vector3 &axis, double angle) | |
Constructs a Unit Quaternion from a rotation angle and axis. More... | |
std::istream & | read (std::istream &s) |
std::istream & | readBinary (std::istream &s) |
Vector3 | rotate (const Vector3 &v) const |
Rotate a vector. More... | |
Vector3 | toEuler () const |
Conversion to Euler angles. More... | |
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. More... | |
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.
|
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 48 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 55 of file Quaternion.cpp.
octomath::Quaternion::Quaternion | ( | const Vector3 & | other | ) |
Constructor.
other | a vector containing euler angles |
Definition at line 62 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 66 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 90 of file Quaternion.cpp.
|
inline |
Quaternion & octomath::Quaternion::inv_IP | ( | ) |
Inversion.
Inverts this Quaternion
Definition at line 248 of file Quaternion.cpp.
float octomath::Quaternion::norm | ( | ) | const |
Definition at line 99 of file Quaternion.cpp.
Quaternion & octomath::Quaternion::normalize | ( | ) |
Definition at line 234 of file Quaternion.cpp.
Quaternion octomath::Quaternion::normalized | ( | ) | const |
Definition at line 241 of file Quaternion.cpp.
|
inline |
Definition at line 116 of file Quaternion.h.
|
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 219 of file Quaternion.cpp.
Quaternion octomath::Quaternion::operator* | ( | const Vector3 & | v | ) | const |
Quaternion multiplication with extended vector.
Definition at line 226 of file Quaternion.cpp.
void octomath::Quaternion::operator/= | ( | float | x | ) |
Definition at line 107 of file Quaternion.cpp.
Quaternion & octomath::Quaternion::operator= | ( | const Quaternion & | other | ) |
Definition at line 211 of file Quaternion.cpp.
bool octomath::Quaternion::operator== | ( | const Quaternion & | other | ) | const |
Definition at line 113 of file Quaternion.cpp.
std::istream & octomath::Quaternion::read | ( | std::istream & | s | ) |
Definition at line 261 of file Quaternion.cpp.
std::istream & octomath::Quaternion::readBinary | ( | std::istream & | s | ) |
Definition at line 279 of file Quaternion.cpp.
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 255 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 124 of file Quaternion.cpp.
void octomath::Quaternion::toRotMatrix | ( | std::vector< double > & | rot_matrix_3_3 | ) | const |
Definition at line 167 of file Quaternion.cpp.
|
inline |
Definition at line 178 of file Quaternion.h.
|
inline |
Definition at line 183 of file Quaternion.h.
std::ostream & octomath::Quaternion::write | ( | std::ostream & | s | ) | const |
Definition at line 270 of file Quaternion.cpp.
std::ostream & octomath::Quaternion::writeBinary | ( | std::ostream & | s | ) | const |
Definition at line 291 of file Quaternion.cpp.
|
inline |
Definition at line 179 of file Quaternion.h.
|
inline |
Definition at line 184 of file Quaternion.h.
|
inline |
Definition at line 180 of file Quaternion.h.
|
inline |
Definition at line 185 of file Quaternion.h.
|
inline |
Definition at line 181 of file Quaternion.h.
|
inline |
Definition at line 186 of file Quaternion.h.
|
friend |
Quaternion multiplication with extended vector.
Definition at line 230 of file Quaternion.cpp.
|
protected |
Definition at line 194 of file Quaternion.h.