octomap 1.5.0
|
This class represents a Quaternion. More...
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 (const Quaternion &other) | |
Copy constructor. | |
Quaternion (const Vector3 &other) | |
Constructor. | |
Quaternion (double roll, double pitch, double yaw) | |
Constructor from Euler angles. | |
Quaternion () | |
Default constructor. | |
Quaternion (const Vector3 &axis, double angle) | |
Constructs a Unit Quaternion from a rotation angle and axis. | |
Quaternion (float u, float x, float y, float z) | |
Constructor. | |
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 |
const float & | x () const |
float & | x () |
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.
octomath::Quaternion::Quaternion | ( | ) | [inline] |
Default constructor.
Constructs the (1,0,0,0) Unit Quaternion representing the identity rotation.
References u(), x(), y(), and z().
Referenced by inv(), operator*(), and Quaternion().
octomath::Quaternion::Quaternion | ( | const Quaternion & | other | ) |
Copy constructor.
References data.
octomath::Quaternion::Quaternion | ( | float | u, |
float | x, | ||
float | y, | ||
float | z | ||
) |
octomath::Quaternion::Quaternion | ( | const Vector3 & | other | ) |
Constructor.
other | a vector containing euler angles |
References operator=(), octomath::Vector3::pitch(), Quaternion(), octomath::Vector3::roll(), and octomath::Vector3::yaw().
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) |
octomath::Quaternion::Quaternion | ( | const Vector3 & | axis, |
double | angle | ||
) |
Constructs a Unit Quaternion from a rotation angle and axis.
References u(), octomath::Vector3::x(), x(), octomath::Vector3::y(), y(), octomath::Vector3::z(), and z().
Quaternion octomath::Quaternion::inv | ( | ) | const [inline] |
Inversion.
References Quaternion(), u(), x(), y(), and z().
Referenced by octomath::Pose6D::inv(), octomath::Pose6D::inv_IP(), and rotate().
Quaternion & octomath::Quaternion::inv_IP | ( | ) |
float octomath::Quaternion::norm | ( | ) | const |
References operator()().
Referenced by normalize(), toEuler(), and toRotMatrix().
Quaternion & octomath::Quaternion::normalize | ( | ) |
References norm().
Referenced by normalized().
Quaternion octomath::Quaternion::normalized | ( | ) | const |
References normalize().
Referenced by octomath::Pose6D::inv(), octomath::Pose6D::inv_IP(), and octomath::Pose6D::operator*().
const float& octomath::Quaternion::operator() | ( | unsigned int | i | ) | const [inline] |
References data.
Referenced by norm(), readBinary(), and writeBinary().
float& octomath::Quaternion::operator() | ( | unsigned int | i | ) | [inline] |
References data.
Quaternion octomath::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Quaternion multiplication.
Standard Quaternion multiplication which is not commutative.
References Quaternion(), u(), x(), y(), and z().
Quaternion octomath::Quaternion::operator* | ( | const Vector3 & | v | ) | const |
void octomath::Quaternion::operator/= | ( | float | x | ) |
Quaternion & octomath::Quaternion::operator= | ( | const Quaternion & | other | ) |
References u(), x(), y(), and z().
Referenced by Quaternion().
bool octomath::Quaternion::operator== | ( | const Quaternion & | other | ) | const |
std::istream & octomath::Quaternion::read | ( | std::istream & | s | ) |
Referenced by octomath::Pose6D::read().
std::istream & octomath::Quaternion::readBinary | ( | std::istream & | s | ) |
References operator()().
Referenced by octomath::Pose6D::readBinary().
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 |
References inv(), x(), y(), and z().
Referenced by octomath::Pose6D::inv(), octomath::Pose6D::inv_IP(), octomath::Pose6D::operator*(), octomath::Pose6D::operator*=(), and octomath::Pose6D::transform().
Vector3 octomath::Quaternion::toEuler | ( | ) | const |
Conversion to Euler angles.
Converts the attitude represented by this to Euler angles (roll, pitch, yaw).
References norm(), u(), x(), y(), and z().
Referenced by octomath::Pose6D::pitch(), octomath::Pose6D::roll(), and octomath::Pose6D::yaw().
void octomath::Quaternion::toRotMatrix | ( | std::vector< double > & | rot_matrix_3_3 | ) | const |
float& octomath::Quaternion::u | ( | ) | [inline] |
References data.
Referenced by inv(), operator*(), octomath::operator<<(), operator=(), Quaternion(), toEuler(), and toRotMatrix().
const float& octomath::Quaternion::u | ( | ) | const [inline] |
References data.
std::ostream & octomath::Quaternion::write | ( | std::ostream & | s | ) | const |
Referenced by octomath::Pose6D::write().
std::ostream & octomath::Quaternion::writeBinary | ( | std::ostream & | s | ) | const |
References operator()().
Referenced by octomath::Pose6D::writeBinary().
float& octomath::Quaternion::x | ( | ) | [inline] |
References data.
Referenced by inv(), inv_IP(), operator*(), octomath::operator<<(), operator=(), Quaternion(), rotate(), toEuler(), and toRotMatrix().
const float& octomath::Quaternion::x | ( | ) | const [inline] |
References data.
const float& octomath::Quaternion::y | ( | ) | const [inline] |
References data.
float& octomath::Quaternion::y | ( | ) | [inline] |
References data.
Referenced by inv(), inv_IP(), operator*(), octomath::operator<<(), operator=(), Quaternion(), rotate(), toEuler(), and toRotMatrix().
const float& octomath::Quaternion::z | ( | ) | const [inline] |
References data.
float& octomath::Quaternion::z | ( | ) | [inline] |
References data.
Referenced by inv(), inv_IP(), operator*(), octomath::operator<<(), operator=(), Quaternion(), rotate(), toEuler(), and toRotMatrix().
Quaternion operator* | ( | const Vector3 & | v, |
const Quaternion & | q | ||
) | [friend] |
Quaternion multiplication with extended vector.
float octomath::Quaternion::data[4] [protected] |
Referenced by operator()(), Quaternion(), u(), x(), y(), and z().