JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
JPL::Quat< Vec3 > Struct Template Reference

Minimal quaternion (w + xi + yj + zk) More...

#include <JPLSpatial/Math/MinimalQuat.h>

Public Types

using Float = Internal::FloatOf< Vec3 >
 

Public Member Functions

bool operator== (const Quat &rhs) const noexcept
 Check if two quaternions are exactly equal.
 
bool operator!= (const Quat &rhs) const noexcept
 
JPL_INLINE Quat Conjugated () const noexcept
 
JPL_INLINE Quat Inversed () const noexcept
 
JPL_INLINE Vec3 Rotate (const Vec3 &vector) const noexcept
 Rotate a vector by this quaternion.
 
JPL_INLINE Float LengthSquared () const noexcept
 
JPL_INLINE Float Length () const noexcept
 
JPL_INLINE Quat Normalized () const noexcept
 
JPL_INLINE bool IsNormalized (Float tolerance=Float(1.0e-5)) const noexcept
 
JPL_INLINE Float GetRotationAngle (const Vec3 &axis) const noexcept
 Get rotation angle around axis.
 
Basis< Vec3 > ToBasis () const noexcept
 Convert to an orthonormal Basis3 (column-major)
 

Static Public Member Functions

static JPL_INLINE Quat Identity () noexcept
 
static JPL_INLINE Quat Rotation (const Vec3 &axis, Float angleRad) noexcept
 
static Quat FromTo (const Vec3 &from, const Vec3 &to) noexcept
 
static Quat FromBasis (const Basis< Vec3 > &basis) noexcept
 Construct quaternian from basis columns X, Y, Z.
 
static JPL_INLINE Quat FromUpAndForward (const Vec3 &up, const Vec3 &forward) noexcept
 
static JPL_INLINE Quat LookAt (const Vec3 &direction, const Vec3 &up) noexcept
 
static JPL_INLINE Quat MakeSlerp (const Vec3 &from, const Vec3 &to, Float t) noexcept
 Create quaternian to slerp direction vector based on 'from' and 'to'.
 

Public Attributes

Vec3 V
 
Float W
 

Friends

JPL_INLINE friend Quat operator* (const Quat &a, const Quat &b) noexcept
 Quaternion multiplication (rotation composition)
 

Detailed Description

template<CVec3 Vec3>
struct JPL::Quat< Vec3 >

Minimal quaternion (w + xi + yj + zk)

Member Typedef Documentation

◆ Float

template<CVec3 Vec3>
using JPL::Quat< Vec3 >::Float = Internal::FloatOf<Vec3>

Member Function Documentation

◆ Conjugated()

template<CVec3 Vec3>
JPL_INLINE Quat JPL::Quat< Vec3 >::Conjugated ( ) const
inlinenoexcept

◆ FromBasis()

template<CVec3 Vec3>
static Quat JPL::Quat< Vec3 >::FromBasis ( const Basis< Vec3 > &  basis)
inlinestaticnoexcept

Construct quaternian from basis columns X, Y, Z.

◆ FromTo()

template<CVec3 Vec3>
static Quat JPL::Quat< Vec3 >::FromTo ( const Vec3 &  from,
const Vec3 &  to 
)
inlinestaticnoexcept

Find quaternian rotation between two unit vectors Input vectors must be normalized

◆ FromUpAndForward()

template<CVec3 Vec3>
static JPL_INLINE Quat JPL::Quat< Vec3 >::FromUpAndForward ( const Vec3 &  up,
const Vec3 &  forward 
)
inlinestaticnoexcept

Construct rotation quaternion from up and forward axis Input parameters must be normalized.

◆ GetRotationAngle()

template<CVec3 Vec3>
JPL_INLINE Float JPL::Quat< Vec3 >::GetRotationAngle ( const Vec3 &  axis) const
inlinenoexcept

Get rotation angle around axis.

◆ Identity()

template<CVec3 Vec3>
static JPL_INLINE Quat JPL::Quat< Vec3 >::Identity ( )
inlinestaticnoexcept

◆ Inversed()

template<CVec3 Vec3>
JPL_INLINE Quat JPL::Quat< Vec3 >::Inversed ( ) const
inlinenoexcept

◆ IsNormalized()

template<CVec3 Vec3>
JPL_INLINE bool JPL::Quat< Vec3 >::IsNormalized ( Float  tolerance = Float(1.0e-5)) const
inlinenoexcept

◆ Length()

template<CVec3 Vec3>
JPL_INLINE Float JPL::Quat< Vec3 >::Length ( ) const
inlinenoexcept

◆ LengthSquared()

template<CVec3 Vec3>
JPL_INLINE Float JPL::Quat< Vec3 >::LengthSquared ( ) const
inlinenoexcept

◆ LookAt()

template<CVec3 Vec3>
static JPL_INLINE Quat JPL::Quat< Vec3 >::LookAt ( const Vec3 &  direction,
const Vec3 &  up 
)
inlinestaticnoexcept

◆ MakeSlerp()

template<CVec3 Vec3>
static JPL_INLINE Quat JPL::Quat< Vec3 >::MakeSlerp ( const Vec3 &  from,
const Vec3 &  to,
Float  t 
)
inlinestaticnoexcept

Create quaternian to slerp direction vector based on 'from' and 'to'.

◆ Normalized()

template<CVec3 Vec3>
JPL_INLINE Quat JPL::Quat< Vec3 >::Normalized ( ) const
inlinenoexcept

◆ operator!=()

template<CVec3 Vec3>
bool JPL::Quat< Vec3 >::operator!= ( const Quat< Vec3 > &  rhs) const
inlinenoexcept

◆ operator==()

template<CVec3 Vec3>
bool JPL::Quat< Vec3 >::operator== ( const Quat< Vec3 > &  rhs) const
inlinenoexcept

Check if two quaternions are exactly equal.

◆ Rotate()

template<CVec3 Vec3>
JPL_INLINE Vec3 JPL::Quat< Vec3 >::Rotate ( const Vec3 &  vector) const
inlinenoexcept

Rotate a vector by this quaternion.

◆ Rotation()

template<CVec3 Vec3>
static JPL_INLINE Quat JPL::Quat< Vec3 >::Rotation ( const Vec3 &  axis,
Float  angleRad 
)
inlinestaticnoexcept

Construct quaternion from the a rotation around the given axis.

Parameters
axis: must be a normalized direction vector

◆ ToBasis()

template<CVec3 Vec3>
Basis< Vec3 > JPL::Quat< Vec3 >::ToBasis ( ) const
inlinenoexcept

Convert to an orthonormal Basis3 (column-major)

Friends And Related Symbol Documentation

◆ operator*

template<CVec3 Vec3>
JPL_INLINE friend Quat operator* ( const Quat< Vec3 > &  a,
const Quat< Vec3 > &  b 
)
friend

Quaternion multiplication (rotation composition)

Member Data Documentation

◆ V

template<CVec3 Vec3>
Vec3 JPL::Quat< Vec3 >::V

◆ W

template<CVec3 Vec3>
Float JPL::Quat< Vec3 >::W

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