Public Member Functions | Private Attributes | Friends | List of all members
karto::Quaternion Class Reference

#include <Karto.h>

Public Member Functions

void FromEulerAngles (kt_double yaw, kt_double pitch, kt_double roll)
 
kt_double GetW () const
 
kt_double GetX () const
 
kt_double GetY () const
 
kt_double GetZ () const
 
kt_bool operator!= (const Quaternion &rOther) const
 
Quaternionoperator= (const Quaternion &rQuaternion)
 
kt_bool operator== (const Quaternion &rOther) const
 
 Quaternion ()
 
 Quaternion (const Quaternion &rQuaternion)
 
 Quaternion (kt_double x, kt_double y, kt_double z, kt_double w)
 
void SetW (kt_double w)
 
void SetX (kt_double x)
 
void SetY (kt_double y)
 
void SetZ (kt_double z)
 
void ToEulerAngles (kt_double &rYaw, kt_double &rPitch, kt_double &rRoll) const
 

Private Attributes

kt_double m_Values [4]
 

Friends

std::ostream & operator<< (std::ostream &rStream, const Quaternion &rQuaternion)
 

Detailed Description

Defines an orientation as a quaternion rotation using the positive Z axis as the zero reference.
Q = w + ix + jy + kz
w = c_1 * c_2 * c_3 - s_1 * s_2 * s_3
x = s_1 * s_2 * c_3 + c_1 * c_2 * s_3
y = s_1 * c_2 * c_3 + c_1 * s_2 * s_3
z = c_1 * s_2 * c_3 - s_1 * c_2 * s_3
where
c_1 = cos(theta/2)
c_2 = cos(phi/2)
c_3 = cos(psi/2)
s_1 = sin(theta/2)
s_2 = sin(phi/2)
s_3 = sin(psi/2)
and
theta is the angle of rotation about the Y axis measured from the Z axis.
phi is the angle of rotation about the Z axis measured from the X axis.
psi is the angle of rotation about the X axis measured from the Y axis.
(All angles are right-handed.)

Definition at line 1579 of file Karto.h.

Constructor & Destructor Documentation

◆ Quaternion() [1/3]

karto::Quaternion::Quaternion ( )
inline

Create a quaternion with default (x=0, y=0, z=0, w=1) values

Definition at line 1585 of file Karto.h.

◆ Quaternion() [2/3]

karto::Quaternion::Quaternion ( kt_double  x,
kt_double  y,
kt_double  z,
kt_double  w 
)
inline

Create a quaternion using x, y, z, w values.

Parameters
x
y
z
w

Definition at line 1600 of file Karto.h.

◆ Quaternion() [3/3]

karto::Quaternion::Quaternion ( const Quaternion rQuaternion)
inline

Copy constructor

Definition at line 1611 of file Karto.h.

Member Function Documentation

◆ FromEulerAngles()

void karto::Quaternion::FromEulerAngles ( kt_double  yaw,
kt_double  pitch,
kt_double  roll 
)
inline

Set x,y,z,w values of the quaternion based on Euler angles. Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm

Parameters
yaw
pitch
roll

Definition at line 1736 of file Karto.h.

◆ GetW()

kt_double karto::Quaternion::GetW ( ) const
inline

Returns the W-value

Returns
Return the W-value of the quaternion

Definition at line 1678 of file Karto.h.

◆ GetX()

kt_double karto::Quaternion::GetX ( ) const
inline

Returns the X-value

Returns
Return the X-value of the quaternion

Definition at line 1624 of file Karto.h.

◆ GetY()

kt_double karto::Quaternion::GetY ( ) const
inline

Returns the Y-value

Returns
Return the Y-value of the quaternion

Definition at line 1642 of file Karto.h.

◆ GetZ()

kt_double karto::Quaternion::GetZ ( ) const
inline

Returns the Z-value

Returns
Return the Z-value of the quaternion

Definition at line 1660 of file Karto.h.

◆ operator!=()

kt_bool karto::Quaternion::operator!= ( const Quaternion rOther) const
inline

Inequality operator returns true if any of the corresponding x, y, z, w values of each quaternion not the same.

Parameters
rOther

Definition at line 1788 of file Karto.h.

◆ operator=()

Quaternion& karto::Quaternion::operator= ( const Quaternion rQuaternion)
inline

Assignment operator

Parameters
rQuaternion

Definition at line 1762 of file Karto.h.

◆ operator==()

kt_bool karto::Quaternion::operator== ( const Quaternion rOther) const
inline

Equality operator returns true if the corresponding x, y, z, w values of each quaternion are the same values.

Parameters
rOther

Definition at line 1776 of file Karto.h.

◆ SetW()

void karto::Quaternion::SetW ( kt_double  w)
inline

Sets the W-value

Parameters
wW-value of the quaternion

Definition at line 1687 of file Karto.h.

◆ SetX()

void karto::Quaternion::SetX ( kt_double  x)
inline

Sets the X-value

Parameters
xX-value of the quaternion

Definition at line 1633 of file Karto.h.

◆ SetY()

void karto::Quaternion::SetY ( kt_double  y)
inline

Sets the Y-value

Parameters
yY-value of the quaternion

Definition at line 1651 of file Karto.h.

◆ SetZ()

void karto::Quaternion::SetZ ( kt_double  z)
inline

Sets the Z-value

Parameters
zZ-value of the quaternion

Definition at line 1669 of file Karto.h.

◆ ToEulerAngles()

void karto::Quaternion::ToEulerAngles ( kt_double rYaw,
kt_double rPitch,
kt_double rRoll 
) const
inline

Converts this quaternion into Euler angles Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm

Parameters
rYaw
rPitch
rRoll

Definition at line 1699 of file Karto.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  rStream,
const Quaternion rQuaternion 
)
friend

Write this quaternion onto output stream

Parameters
rStreamoutput stream
rQuaternion

Definition at line 1801 of file Karto.h.

Member Data Documentation

◆ m_Values

kt_double karto::Quaternion::m_Values[4]
private

Definition at line 1811 of file Karto.h.


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


slam_toolbox
Author(s): Steve Macenski
autogenerated on Thu Jan 11 2024 03:37:56