Public Member Functions | Friends
Quaternion Class Reference

a class to implement a quaternion More...

#include <mia/3d/quaternion.hh>

Public Member Functions

C3DDVector get_euler_angles () const
 
Quaternion inverse () const
 
double norm () const
 
void normalize ()
 normalizes to quaternion More...
 
Quaternionoperator*= (const Quaternion &other)
 
Quaternionoperator+= (const Quaternion &other)
 
Quaternionoperator-= (const Quaternion &other)
 
void print (std::ostream &os) const
 
 Quaternion ()
 
 Quaternion (const Quaternion &other)=default
 
 Quaternion (const C3DDVector &rot)
 
 Quaternion (double w, double x, double y, double z)
 
double w () const
 
double x () const
 
double y () const
 
double z () const
 

Friends

bool operator== (const Quaternion &a, const Quaternion &b)
 

Detailed Description

a class to implement a quaternion

This class implements some operations of a quaternion.

Definition at line 38 of file quaternion.hh.

Constructor & Destructor Documentation

Quaternion::Quaternion ( )

The standard constructor that sets all values of the quaternion to zero.

Quaternion::Quaternion ( const Quaternion other)
default

The copy constructor.

Parameters
other
Quaternion::Quaternion ( const C3DDVector rot)

This constructor creates a quaternion from three Euler angles that are applied with the x-y-z convention.

Parameters
rot
Quaternion::Quaternion ( double  w,
double  x,
double  y,
double  z 
)

Constructor to create a quaternion by directly setting its elements.

Member Function Documentation

C3DDVector Quaternion::get_euler_angles ( ) const
Returns
the Euler angles that correspond to the rotation described by this quaternion
Quaternion Quaternion::inverse ( ) const
Returns
the inverse of the quaternion assuming it is normalized
double Quaternion::norm ( ) const
Returns
the norm of the quaternion
void Quaternion::normalize ( )

normalizes to quaternion

Quaternion& Quaternion::operator*= ( const Quaternion other)

in-place multiplication

Parameters
other
Returns
reference to the updated quaternion
Quaternion& Quaternion::operator+= ( const Quaternion other)

in-place adding

Parameters
other
Returns
reference to the updated quaternion
Quaternion& Quaternion::operator-= ( const Quaternion other)

in-place substraction

Parameters
other
Returns
reference to the updated quaternion
void Quaternion::print ( std::ostream &  os) const

Print the quaternion to an output stream

Parameters
osthe output stream

Referenced by operator<<().

double Quaternion::w ( ) const
inline
Returns
the w- or $x_0$ component of the quaternion

Definition at line 136 of file quaternion.hh.

double Quaternion::x ( ) const
inline
Returns
the x- or $x_1$ component of the quaternion

Definition at line 141 of file quaternion.hh.

References T3DVector< T >::x.

double Quaternion::y ( ) const
inline
Returns
the y- or $x_2$ component of the quaternion

Definition at line 146 of file quaternion.hh.

References T3DVector< T >::y.

double Quaternion::z ( ) const
inline
Returns
the z- or $x_3$ component of the quaternion

Definition at line 151 of file quaternion.hh.

References T3DVector< T >::z.

Friends And Related Function Documentation

bool operator== ( const Quaternion a,
const Quaternion b 
)
friend
Parameters
a
b
Returns
true if the quaternions are element-wise equal

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