Public Member Functions | Private Attributes | Friends
karto::Quaternion Class Reference

#include <Geometry.h>

List of all members.

Public Member Functions

void FromAngleAxis (kt_double angleInRadians, const karto::Vector3d &rAxis)
void FromEulerAngles (kt_double yaw, kt_double pitch, kt_double roll)
const Vector4d GetAsVector4 () const
kt_double GetW () const
kt_double GetX () const
kt_double GetY () const
kt_double GetZ () const
kt_double Length () const
kt_double Norm () const
void Normalize ()
kt_bool operator!= (const Quaternion &rOther) const
const Quaternion operator* (const Quaternion &rOther) const
karto::Vector3d operator* (const karto::Vector3d &rVector) const
Quaternionoperator= (const Quaternion &rOther)
kt_bool operator== (const Quaternion &rOther) const
 Quaternion ()
 Quaternion (kt_double x, kt_double y, kt_double z, kt_double w)
 Quaternion (const Vector4d &rVector)
 Quaternion (const Quaternion &rOther)
void SetW (kt_double w)
void SetX (kt_double x)
void SetY (kt_double y)
void SetZ (kt_double z)
void ToAngleAxis (kt_double &rAngle, karto::Vector3d &rAxis) const
void ToEulerAngles (kt_double &rYaw, kt_double &rPitch, kt_double &rRoll) const
const String ToString () const

Private Attributes

kt_double m_Values [4]


KARTO_FORCEINLINE 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
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)
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 1307 of file Geometry.h.

Constructor & Destructor Documentation

Quaternion with default (x=0, y=0, z=0, w=1) values

Definition at line 1313 of file Geometry.h.

Quaternion using given x, y, z, w values.


Definition at line 1328 of file Geometry.h.

karto::Quaternion::Quaternion ( const Vector4d rVector) [inline]

Quaternion from given Vector4d

Definition at line 1339 of file Geometry.h.

karto::Quaternion::Quaternion ( const Quaternion rOther) [inline]

Copy constructor

Definition at line 1350 of file Geometry.h.

Member Function Documentation

void karto::Quaternion::FromAngleAxis ( kt_double  angleInRadians,
const karto::Vector3d rAxis 

Computes the equivalent quaternion from the given angle-axis form

Definition at line 118 of file Geometry.cpp.

Set x,y,z,w values of the quaternion based on Euler angles. Source:


Definition at line 170 of file Geometry.cpp.

const Vector4d karto::Quaternion::GetAsVector4 ( ) const [inline]

This quaternion as a 4D vector

4D vector representation of this quaternion

Definition at line 1435 of file Geometry.h.

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

Returns the w-value

the w-value of this quaternion

Definition at line 1417 of file Geometry.h.

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

Returns the x-value

the x-value of this quaternion

Definition at line 1363 of file Geometry.h.

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

Returns the y-value

the y-value of this quaternion

Definition at line 1381 of file Geometry.h.

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

Returns the z-value

the z-value of this quaternion

Definition at line 1399 of file Geometry.h.

Length of this quaternion

length of this quaternion

Definition at line 1474 of file Geometry.h.

kt_double karto::Quaternion::Norm ( ) const [inline]

Returns the norm of this quaternion

norm of this quaternion

Definition at line 1483 of file Geometry.h.

void karto::Quaternion::Normalize ( ) [inline]

Normalize the quaternion

Definition at line 1491 of file Geometry.h.

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

Inequality operator

Definition at line 1548 of file Geometry.h.

const Quaternion karto::Quaternion::operator* ( const Quaternion rOther) const [inline]

Quaternion multiplication; note that quaternion multiplication is not commutative (a * b != b * a)

Definition at line 1528 of file Geometry.h.

karto::Vector3d karto::Quaternion::operator* ( const karto::Vector3d rVector) const [inline]

Rotate a vector by this quaternion

result of multiplying this quaternion by the given vector

Definition at line 1558 of file Geometry.h.

Quaternion& karto::Quaternion::operator= ( const Quaternion rOther) [inline]

Assignment operator

Definition at line 1515 of file Geometry.h.

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

Equality operator

Definition at line 1540 of file Geometry.h.

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

Sets the w-value


Definition at line 1426 of file Geometry.h.

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

Sets the x-value


Definition at line 1372 of file Geometry.h.

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

Sets the y-value


Definition at line 1390 of file Geometry.h.

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

Sets the z-value


Definition at line 1408 of file Geometry.h.

void karto::Quaternion::ToAngleAxis ( kt_double rAngle,
karto::Vector3d rAxis 
) const

This quaternion in angle-axis form

rAngleoutput parameter angle
rAxisoutput parameter axis

Definition at line 94 of file Geometry.cpp.

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

Converts this quaternion into Euler angles Source:


Definition at line 140 of file Geometry.cpp.

String representation of this quaternion

string representation of this quaternion

Definition at line 192 of file Geometry.cpp.

Friends And Related Function Documentation

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

Write this quaternion onto output stream

Definition at line 1576 of file Geometry.h.

Member Data Documentation

Definition at line 1583 of file Geometry.h.

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

Author(s): Sebastian Kasperski
autogenerated on Sun Apr 2 2017 03:53:09