SPH
Public Member Functions | List of all members
Quat Class Reference

Quaternion representing an axis of rotation and a (half of) rotation angle. More...

#include <Quat.h>

Public Member Functions

 Quat ()=default
 
 Quat (const Vector &axis, const Float angle)
 Creates a quaternion given rotation axis and angle of rotation. More...
 
 Quat (const AffineMatrix &m)
 Creates a quaternion given a rotation matrix. More...
 
INLINE Vector axis () const
 Returns the normalized rotational axis. More...
 
INLINE Float angle () const
 Returns the angle of rotation (in radians). More...
 
INLINE Floatoperator[] (const Size idx)
 
INLINE Float operator[] (const Size idx) const
 
AffineMatrix convert () const
 Converts the quaternion into a rotation matrix. More...
 

Detailed Description

Quaternion representing an axis of rotation and a (half of) rotation angle.

Convenient holder of any rotation, as it contains only 4 components and can only represent a rotation, compared to matrix with 9 components, representing any linear transformation.

Definition at line 16 of file Quat.h.

Constructor & Destructor Documentation

◆ Quat() [1/3]

Quat::Quat ( )
default

◆ Quat() [2/3]

Quat::Quat ( const Vector axis,
const Float  angle 
)
inline

Creates a quaternion given rotation axis and angle of rotation.

Axis does not have to be normalized.

Definition at line 26 of file Quat.h.

◆ Quat() [3/3]

Quat::Quat ( const AffineMatrix m)
inlineexplicit

Creates a quaternion given a rotation matrix.

The matrix must be orthogonal with det(matrix) = 1

Definition at line 42 of file Quat.h.

Member Function Documentation

◆ angle()

INLINE Float Quat::angle ( ) const
inline

Returns the angle of rotation (in radians).

Definition at line 60 of file Quat.h.

◆ axis()

INLINE Vector Quat::axis ( ) const
inline

Returns the normalized rotational axis.

Definition at line 54 of file Quat.h.

◆ convert()

AffineMatrix Quat::convert ( ) const
inline

Converts the quaternion into a rotation matrix.

Definition at line 73 of file Quat.h.

◆ operator[]() [1/2]

INLINE Float& Quat::operator[] ( const Size  idx)
inline

Definition at line 64 of file Quat.h.

◆ operator[]() [2/2]

INLINE Float Quat::operator[] ( const Size  idx) const
inline

Definition at line 68 of file Quat.h.


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