Hermes
hermes::Quaternion< T > Class Template Reference

Quaternion representation v.x i + v.y j + v.z k + r. More...

Public Member Functions

HERMES_DEVICE_CALLABLE Quaternion ()
 Default constructor.
 
HERMES_DEVICE_CALLABLE Quaternion (T x, T y, T z, T w)
 Construct from component values. More...
 
HERMES_DEVICE_CALLABLE Quaternion (const hermes::Vector3< T > &v, T r=0)
 Construct from part values. More...
 
HERMES_DEVICE_CALLABLE const T & operator[] (int i) const
 Get i-th component. More...
 
HERMES_DEVICE_CALLABLE T & operator[] (int i)
 Get i-th component reference. More...
 
HERMES_DEVICE_CALLABLE Matrix4x4< T > matrix () const
 
HERMES_DEVICE_CALLABLE Quaternion inverse () const
 Computes inverse of this quaternion. More...
 
HERMES_DEVICE_CALLABLE Quaternion conjugate () const
 Computes conjugate of this quaternion. More...
 
HERMES_DEVICE_CALLABLElength2 () const
 Computes the squared norm. More...
 
HERMES_DEVICE_CALLABLElength () const
 Computes the norm. More...
 
HERMES_DEVICE_CALLABLE Quaternion normalized () const
 Computes normalized copy. More...
 

Static Public Member Functions

static HERMES_DEVICE_CALLABLE Quaternion< T > I ()
 Creates an identity quaternion (0,0,0,1) More...
 

Public Attributes

hermes::Vector3< T > v
 vector part
 
r {0}
 scalar part
 

Detailed Description

template<typename T>
class hermes::Quaternion< T >

Quaternion representation v.x i + v.y j + v.z k + r.

Template Parameters
Tdata type

Constructor & Destructor Documentation

◆ Quaternion() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Quaternion< T >::Quaternion ( x,
y,
z,
w 
)
inline

Construct from component values.

Parameters
x
y
z
w

◆ Quaternion() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE hermes::Quaternion< T >::Quaternion ( const hermes::Vector3< T > &  v,
r = 0 
)
inline

Construct from part values.

Parameters
vvector part
rscalar part

Member Function Documentation

◆ conjugate()

template<typename T >
HERMES_DEVICE_CALLABLE Quaternion hermes::Quaternion< T >::conjugate ( ) const
inline

Computes conjugate of this quaternion.

Returns

◆ I()

template<typename T >
static HERMES_DEVICE_CALLABLE Quaternion<T> hermes::Quaternion< T >::I ( )
inlinestatic

Creates an identity quaternion (0,0,0,1)

Returns

◆ inverse()

template<typename T >
HERMES_DEVICE_CALLABLE Quaternion hermes::Quaternion< T >::inverse ( ) const
inline

Computes inverse of this quaternion.

Returns

◆ length()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Quaternion< T >::length ( ) const
inline

Computes the norm.

Returns

◆ length2()

template<typename T >
HERMES_DEVICE_CALLABLE T hermes::Quaternion< T >::length2 ( ) const
inline

Computes the squared norm.

Returns

◆ matrix()

template<typename T >
HERMES_DEVICE_CALLABLE Matrix4x4<T> hermes::Quaternion< T >::matrix ( ) const
inline
Returns

◆ normalized()

template<typename T >
HERMES_DEVICE_CALLABLE Quaternion hermes::Quaternion< T >::normalized ( ) const
inline

Computes normalized copy.

Returns

◆ operator[]() [1/2]

template<typename T >
HERMES_DEVICE_CALLABLE T& hermes::Quaternion< T >::operator[] ( int  i)
inline

Get i-th component reference.

Warning
i is not checked
Parameters
icomponent index in [0, 1]
Returns

◆ operator[]() [2/2]

template<typename T >
HERMES_DEVICE_CALLABLE const T& hermes::Quaternion< T >::operator[] ( int  i) const
inline

Get i-th component.

Warning
i is not checked
Parameters
icomponent index in [0, 1]
Returns

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