Public Member Functions | Protected Attributes | Friends
octomath::Quaternion Class Reference

This class represents a Quaternion. More...

#include <Quaternion.h>

List of all members.

Public Member Functions

Quaternion inv () const
 Inversion.
Quaternioninv_IP ()
 Inversion.
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.
Quaternion operator* (const Vector3 &v) const
 Quaternion multiplication with extended vector.
void operator/= (float x)
Quaternionoperator= (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.

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

Default constructor.

Constructs the (1,0,0,0) Unit Quaternion representing the identity rotation.

Definition at line 66 of file Quaternion.h.

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.

Constructor.

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

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


Member Function Documentation

Inversion.

Returns:
A copy of this Quaterion inverted

Definition at line 156 of file Quaternion.h.

Inversion.

Inverts this Quaternion

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

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.

Returns:
this * other

Definition at line 218 of file Quaternion.cpp.

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

Quaternion multiplication with extended vector.

Returns:
q * (0, v)

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.

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

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.


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 229 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 Thu Aug 27 2015 14:13:14