NRE::Math::Quaternion< T > Class Template Reference

A quaternion represented by a 3D rotation axis and an angle. More...

#include <NRE_Quaternion.hpp>

Inheritance diagram for NRE::Math::Quaternion< T >:

Public Member Functions

constexpr Quaternion ()=default
 
template<class K , class L , class N , class M >
constexpr Quaternion (K x, L y, N z, M w)
 
template<class K , class L , class N >
 Quaternion (K x, L y, N z, Angle w)
 
template<class K , class L >
constexpr Quaternion (Vector3D< K > const &ax, L an)
 
template<class K >
 Quaternion (Vector3D< K > const &ax, Angle an)
 
constexpr Quaternion (Quaternion const &q)=default
 
constexpr Quaternion (Quaternion &&q)=default
 
template<class K >
constexpr Quaternion (Quaternion< K > const &q)
 
 ~Quaternion ()=default
 
constexpr T getX () const
 
constexpr T getY () const
 
constexpr T getZ () const
 
constexpr T getW () const
 
constexpr Vector3D< T > getAxis () const
 
constexpr Vector4D< T > const & getQuaternion () const
 
template<class K >
constexpr void setX (K x)
 
template<class K >
constexpr void setY (K y)
 
template<class K >
constexpr void setZ (K z)
 
template<class K >
constexpr void setW (K w)
 
template<class K >
void setAngleAxis (Vector3D< K > const &axis, Angle w)
 
constexpr void setIdentity ()
 
long double norm () const
 
constexpr T normSquared () const
 
Quaternion normalize ()
 
constexpr const T * value () const
 
constexpr Quaternionoperator= (Quaternion const &q)=default
 
constexpr Quaternionoperator= (Quaternion &&q)=default
 
template<class K >
constexpr Quaternionoperator= (Quaternion< K > const &q)
 
template<class K >
constexpr Quaternionoperator= (Quaternion< K > &&q)
 
template<class K >
constexpr Quaternionoperator*= (Quaternion< K > const &q)
 
template<class K >
constexpr Quaternion< std::common_type_t< T, K > > operator* (Quaternion< K > const &q) const
 
Utility::String toString () const
 

Detailed Description

template<class T>
class NRE::Math::Quaternion< T >

A quaternion represented by a 3D rotation axis and an angle.

Constructor & Destructor Documentation

template<class T>
constexpr NRE::Math::Quaternion< T >::Quaternion ( )
default

The internal quaternion Construct the identity quaternion

template<class T>
template<class K , class L , class N , class M >
constexpr NRE::Math::Quaternion< T >::Quaternion ( x,
y,
z,
w 
)

Construct a quaternion with direct assignment

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
wthe w coordinate
template<class T>
template<class K , class L , class N >
NRE::Math::Quaternion< T >::Quaternion ( x,
y,
z,
Angle  w 
)

Construct a quaternion from angle-axis construction

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
wthe rotation's angle
template<class T>
template<class K , class L >
constexpr NRE::Math::Quaternion< T >::Quaternion ( Vector3D< K > const &  ax,
an 
)

Construct a quaternion with direct assignment

Parameters
axthe rotation's axis
anthe rotation's angle
template<class T>
template<class K >
NRE::Math::Quaternion< T >::Quaternion ( Vector3D< K > const &  ax,
Angle  an 
)

Construct a quaternion from angle-axis construction

Parameters
axthe rotation's axis
anthe rotation's angle
template<class T>
constexpr NRE::Math::Quaternion< T >::Quaternion ( Quaternion< T > const &  q)
default

Copy q into this

Parameters
qthe object to copy
template<class T>
constexpr NRE::Math::Quaternion< T >::Quaternion ( Quaternion< T > &&  q)
default

Move q into this

Parameters
qthe object to move
template<class T>
template<class K >
constexpr NRE::Math::Quaternion< T >::Quaternion ( Quaternion< K > const &  q)

Convert a K-type quaternion into a T-type quaternion

Parameters
qthe K-type quaternion to convert
template<class T>
NRE::Math::Quaternion< T >::~Quaternion ( )
default

Quaternion Deconstructor

Member Function Documentation

template<class T>
constexpr Vector3D<T> NRE::Math::Quaternion< T >::getAxis ( ) const
Returns
the rotation's axis
template<class T>
constexpr Vector4D<T> const& NRE::Math::Quaternion< T >::getQuaternion ( ) const
Returns
the internal quaternion
template<class T>
constexpr T NRE::Math::Quaternion< T >::getW ( ) const
Returns
the w value
template<class T>
constexpr T NRE::Math::Quaternion< T >::getX ( ) const
Returns
the x value
template<class T>
constexpr T NRE::Math::Quaternion< T >::getY ( ) const
Returns
the y value
template<class T>
constexpr T NRE::Math::Quaternion< T >::getZ ( ) const
Returns
the z value
template<class T>
long double NRE::Math::Quaternion< T >::norm ( ) const
Returns
the quaternion's norm
template<class T>
Quaternion NRE::Math::Quaternion< T >::normalize ( )

Normalize the quaternion

template<class T>
constexpr T NRE::Math::Quaternion< T >::normSquared ( ) const
Returns
the squared quaternion's norm
template<class T>
template<class K >
constexpr Quaternion<std::common_type_t<T, K> > NRE::Math::Quaternion< T >::operator* ( Quaternion< K > const &  q) const

Compute the quaternion resulting in the multiplication of this and q

Parameters
qthe second quaternion
Returns
the computed quaternion
template<class T>
template<class K >
constexpr Quaternion& NRE::Math::Quaternion< T >::operator*= ( Quaternion< K > const &  q)

Multiply 2 quaternions together

Parameters
qthe second quaternion
Returns
the reference of himself
template<class T>
constexpr Quaternion& NRE::Math::Quaternion< T >::operator= ( Quaternion< T > const &  q)
default

Copy q into this

Parameters
qthe object to copy into this
Returns
the reference of himself
template<class T>
constexpr Quaternion& NRE::Math::Quaternion< T >::operator= ( Quaternion< T > &&  q)
default

Move q into this

Parameters
qthe object to move into this
Returns
the reference of himself
template<class T>
template<class K >
constexpr Quaternion& NRE::Math::Quaternion< T >::operator= ( Quaternion< K > const &  q)

Copy q into this

Parameters
qthe object to copy into this
Returns
the reference of himself
template<class T>
template<class K >
constexpr Quaternion& NRE::Math::Quaternion< T >::operator= ( Quaternion< K > &&  q)

Move q into this

Parameters
qthe object to move into this
Returns
the reference of himself
template<class T>
template<class K >
void NRE::Math::Quaternion< T >::setAngleAxis ( Vector3D< K > const &  axis,
Angle  w 
)
inline

Angle axis setter

Parameters
axisthe new rotation's axis
wthe new rotation's angle
template<class T>
constexpr void NRE::Math::Quaternion< T >::setIdentity ( )

Set the quaternion to the identity quaternion

template<class T>
template<class K >
constexpr void NRE::Math::Quaternion< T >::setW ( w)

W setter

Parameters
wthe new value for w
template<class T>
template<class K >
constexpr void NRE::Math::Quaternion< T >::setX ( x)

X setter

Parameters
xthe new value for x
template<class T>
template<class K >
constexpr void NRE::Math::Quaternion< T >::setY ( y)

Y setter

Parameters
ythe new value for y
template<class T>
template<class K >
constexpr void NRE::Math::Quaternion< T >::setZ ( z)

Z setter

Parameters
zthe new value for z
template<class T>
Utility::String NRE::Math::Quaternion< T >::toString ( ) const

Convert the quaternion into a string

Returns
the converted quaternion
template<class T>
constexpr const T* NRE::Math::Quaternion< T >::value ( ) const
Returns
a pointer to the quaternion's data

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