ACF $AcfVersion:0$
Public Member Functions | Static Public Member Functions | List of all members
i3d::CQuaternion3d Class Reference

Quaternion for representing rotations in 3D space. More...

#include <CQuaternion3d.h>

Public Member Functions

 CQuaternion3d ()
 Default constructor.
 
 CQuaternion3d (double w, double x, double y, double z)
 Construct quaternion from components.
 
double GetW () const
 Get W component (scalar part).
 
void SetW (double w)
 Set W component.
 
double GetX () const
 Get X component.
 
void SetX (double x)
 Set X component.
 
double GetY () const
 Get Y component.
 
void SetY (double y)
 Set Y component.
 
double GetZ () const
 Get Z component.
 
void SetZ (double z)
 Set Z component.
 
CVector3d GetVectorPart () const
 Get vector part of quaternion.
 
double GetLength () const
 Calculate length (norm) of quaternion.
 
double GetLengthSq () const
 Calculate squared length of quaternion.
 
CQuaternion3d GetNormalized () const
 Get normalized quaternion (unit quaternion).
 
void Normalize ()
 Normalize this quaternion in place.
 
CQuaternion3d GetConjugate () const
 Get conjugate of quaternion.
 
CQuaternion3d GetInverse () const
 Get inverse of quaternion.
 
CMatrix3d ToMatrix () const
 Convert quaternion to rotation matrix.
 
void ToAxisAngle (CVector3d &axis, double &angle) const
 Convert quaternion to axis and angle.
 
CVector3d Rotate (const CVector3d &vector) const
 Rotate vector by this quaternion.
 
double GetDotProduct (const CQuaternion3d &other) const
 Calculate dot product with another quaternion.
 
bool Serialize (iser::IArchive &archive)
 Serialize this quaternion to specified archive.
 
CQuaternion3d operator* (const CQuaternion3d &other) const
 
CQuaternion3d operator* (double scalar) const
 
CQuaternion3d operator+ (const CQuaternion3d &other) const
 
CQuaternion3d operator- (const CQuaternion3d &other) const
 
CQuaternion3doperator*= (const CQuaternion3d &other)
 
CQuaternion3doperator*= (double scalar)
 
bool operator== (const CQuaternion3d &other) const
 
bool operator!= (const CQuaternion3d &other) const
 

Static Public Member Functions

static CQuaternion3d FromAxisAngle (const CVector3d &axis, double angle)
 Construct quaternion from axis and angle.
 
static CQuaternion3d FromMatrix (const CMatrix3d &matrix)
 Construct quaternion from rotation matrix.
 
static CQuaternion3d FromEulerAngles (double roll, double pitch, double yaw)
 Construct quaternion from Euler angles (XYZ order).
 
static CQuaternion3d Slerp (const CQuaternion3d &q1, const CQuaternion3d &q2, double t)
 Spherical linear interpolation (SLERP) between two quaternions.
 

Detailed Description

Quaternion for representing rotations in 3D space.

Stored as (w, x, y, z) where w is the scalar part.

Definition at line 20 of file CQuaternion3d.h.

Constructor & Destructor Documentation

◆ CQuaternion3d() [1/2]

i3d::CQuaternion3d::CQuaternion3d ( )
inline

Default constructor.

Creates identity quaternion (no rotation).

Definition at line 189 of file CQuaternion3d.h.

Referenced by GetConjugate().

◆ CQuaternion3d() [2/2]

i3d::CQuaternion3d::CQuaternion3d ( double  w,
double  x,
double  y,
double  z 
)
inline

Construct quaternion from components.

Parameters
wScalar part.
xX component of vector part.
yY component of vector part.
zZ component of vector part.

Definition at line 198 of file CQuaternion3d.h.

Member Function Documentation

◆ FromAxisAngle()

static CQuaternion3d i3d::CQuaternion3d::FromAxisAngle ( const CVector3d axis,
double  angle 
)
static

Construct quaternion from axis and angle.

Parameters
axisRotation axis (will be normalized).
angleRotation angle in radians.

Referenced by i3d::CAffine3d::CreateRotation().

◆ FromEulerAngles()

static CQuaternion3d i3d::CQuaternion3d::FromEulerAngles ( double  roll,
double  pitch,
double  yaw 
)
static

Construct quaternion from Euler angles (XYZ order).

Parameters
rollRotation around X axis in radians.
pitchRotation around Y axis in radians.
yawRotation around Z axis in radians.

◆ FromMatrix()

static CQuaternion3d i3d::CQuaternion3d::FromMatrix ( const CMatrix3d matrix)
static

Construct quaternion from rotation matrix.

◆ GetConjugate()

CQuaternion3d i3d::CQuaternion3d::GetConjugate ( ) const
inline

Get conjugate of quaternion.

Definition at line 273 of file CQuaternion3d.h.

References CQuaternion3d().

◆ GetDotProduct()

double i3d::CQuaternion3d::GetDotProduct ( const CQuaternion3d other) const
inline

Calculate dot product with another quaternion.

Definition at line 279 of file CQuaternion3d.h.

◆ GetInverse()

CQuaternion3d i3d::CQuaternion3d::GetInverse ( ) const

Get inverse of quaternion.

◆ GetLength()

double i3d::CQuaternion3d::GetLength ( ) const
inline

Calculate length (norm) of quaternion.

Definition at line 267 of file CQuaternion3d.h.

References GetLengthSq().

◆ GetLengthSq()

double i3d::CQuaternion3d::GetLengthSq ( ) const
inline

Calculate squared length of quaternion.

Definition at line 261 of file CQuaternion3d.h.

Referenced by GetLength().

◆ GetNormalized()

CQuaternion3d i3d::CQuaternion3d::GetNormalized ( ) const

Get normalized quaternion (unit quaternion).

◆ GetVectorPart()

CVector3d i3d::CQuaternion3d::GetVectorPart ( ) const
inline

Get vector part of quaternion.

Definition at line 255 of file CQuaternion3d.h.

◆ GetW()

double i3d::CQuaternion3d::GetW ( ) const
inline

Get W component (scalar part).

Definition at line 207 of file CQuaternion3d.h.

◆ GetX()

double i3d::CQuaternion3d::GetX ( ) const
inline

Get X component.

Definition at line 219 of file CQuaternion3d.h.

◆ GetY()

double i3d::CQuaternion3d::GetY ( ) const
inline

Get Y component.

Definition at line 231 of file CQuaternion3d.h.

◆ GetZ()

double i3d::CQuaternion3d::GetZ ( ) const
inline

Get Z component.

Definition at line 243 of file CQuaternion3d.h.

◆ Normalize()

void i3d::CQuaternion3d::Normalize ( )

Normalize this quaternion in place.

◆ operator!=()

bool i3d::CQuaternion3d::operator!= ( const CQuaternion3d other) const
inline

Definition at line 294 of file CQuaternion3d.h.

◆ operator*() [1/2]

CQuaternion3d i3d::CQuaternion3d::operator* ( const CQuaternion3d other) const

◆ operator*() [2/2]

CQuaternion3d i3d::CQuaternion3d::operator* ( double  scalar) const

◆ operator*=() [1/2]

CQuaternion3d & i3d::CQuaternion3d::operator*= ( const CQuaternion3d other)

◆ operator*=() [2/2]

CQuaternion3d & i3d::CQuaternion3d::operator*= ( double  scalar)

◆ operator+()

CQuaternion3d i3d::CQuaternion3d::operator+ ( const CQuaternion3d other) const

◆ operator-()

CQuaternion3d i3d::CQuaternion3d::operator- ( const CQuaternion3d other) const

◆ operator==()

bool i3d::CQuaternion3d::operator== ( const CQuaternion3d other) const
inline

Definition at line 285 of file CQuaternion3d.h.

References I_BIG_EPSILON.

◆ Rotate()

CVector3d i3d::CQuaternion3d::Rotate ( const CVector3d vector) const

Rotate vector by this quaternion.

◆ Serialize()

bool i3d::CQuaternion3d::Serialize ( iser::IArchive archive)

Serialize this quaternion to specified archive.

◆ SetW()

void i3d::CQuaternion3d::SetW ( double  w)
inline

Set W component.

Definition at line 213 of file CQuaternion3d.h.

◆ SetX()

void i3d::CQuaternion3d::SetX ( double  x)
inline

Set X component.

Definition at line 225 of file CQuaternion3d.h.

◆ SetY()

void i3d::CQuaternion3d::SetY ( double  y)
inline

Set Y component.

Definition at line 237 of file CQuaternion3d.h.

◆ SetZ()

void i3d::CQuaternion3d::SetZ ( double  z)
inline

Set Z component.

Definition at line 249 of file CQuaternion3d.h.

◆ Slerp()

static CQuaternion3d i3d::CQuaternion3d::Slerp ( const CQuaternion3d q1,
const CQuaternion3d q2,
double  t 
)
static

Spherical linear interpolation (SLERP) between two quaternions.

Parameters
q1Start quaternion.
q2End quaternion.
tInterpolation parameter (0 to 1).

◆ ToAxisAngle()

void i3d::CQuaternion3d::ToAxisAngle ( CVector3d axis,
double &  angle 
) const

Convert quaternion to axis and angle.

Parameters
axisOutput rotation axis.
angleOutput rotation angle in radians.

◆ ToMatrix()

CMatrix3d i3d::CQuaternion3d::ToMatrix ( ) const

Convert quaternion to rotation matrix.

Referenced by i3d::CAffine3d::CreateRotation().


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