Public Member Functions | Protected Attributes | Friends | List of all members
octomath::Quaternion Class Reference

This class represents a Quaternion. More...

#include <Quaternion.h>

Public Member Functions

Quaternion inv () const
 Inversion. More...
 
Quaternioninv_IP ()
 Inversion. More...
 
float norm () const
 
Quaternionnormalize ()
 
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)
 
Quaternionoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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 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.

Parameters
othera 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.

Parameters
rollphi/roll angle (rotation about x-axis)
pitchtheta/pitch angle (rotation about y-axis)
yawpsi/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.

Member Function Documentation

Quaternion octomath::Quaternion::inv ( ) const
inline

Inversion.

Returns
A copy of this Quaterion inverted

Definition at line 156 of file Quaternion.h.

Quaternion & octomath::Quaternion::inv_IP ( )

Inversion.

Inverts this Quaternion

Returns
a reference to 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.

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.

Returns
this * other

Definition at line 219 of file Quaternion.cpp.

Quaternion octomath::Quaternion::operator* ( const Vector3 v) const

Quaternion multiplication with extended vector.

Returns
q * (0, v)

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.

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.

Parameters
va vector represented in world coordinates
Returns
v represented in body-fixed 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.

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 270 of file Quaternion.cpp.

std::ostream & octomath::Quaternion::writeBinary ( std::ostream &  s) const

Definition at line 291 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.

Friends And Related Function Documentation

Quaternion operator* ( const Vector3 v,
const Quaternion q 
)
friend

Quaternion multiplication with extended vector.

Returns
(0, v) * q

Definition at line 230 of file Quaternion.cpp.

Member Data Documentation

float octomath::Quaternion::data[4]
protected

Definition at line 194 of file Quaternion.h.


The documentation for this class was generated from the following files:


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Wed Jun 5 2019 19:26:28