uicore::Quaternionx< Type > Class Template Reference

Quaternion. More...

#include <mat4.h>

Public Member Functions

 Quaternionx ()
 Constructs a quaternion. More...
 
 Quaternionx (const Quaternionx &other)
 
 Quaternionx (Type x, Type y, Type z, Type w)
 
 Quaternionx (const Vec4< Type > &quat)
 
 Quaternionx (const Mat4< Type > &rotation_matrix)
 
Quaternionx< Type > & inverse ()
 Inverse this quaternion. More...
 
Type magnitude () const
 Get the quaternion magnitude. More...
 
Quaternionx< Type > & normalize ()
 Normalizes this quaternion. More...
 
 operator Vec4< Type > () const
 
bool operator!= (const Quaternionx< Type > &other) const
 Not equal operator. More...
 
Quaternionx< Type > operator* (const Quaternionx< Type > &mult) const
 Multiplication operator. More...
 
Quaternionx< Type > operator* (const Mat4< Type > &matrix) const
 
Vec3< Type > operator* (const Vec3< Type > &v) const
 
Vec4< Type > operator* (const Vec4< Type > &v) const
 
bool operator< (const Quaternionx< Type > &other) const
 Less operator. More...
 
bool operator<= (const Quaternionx< Type > &other) const
 Less equal operator. More...
 
bool operator== (const Quaternionx< Type > &other) const
 Equal operator. More...
 
bool operator> (const Quaternionx< Type > &other) const
 Greater operator. More...
 
bool operator>= (const Quaternionx< Type > &other) const
 Greater equal operator. More...
 
Quaternionx< Type > & rotate (Type angle, const Vec3f &axis)
 
Quaternionx< Type > & rotate (Type euler_x, Type euler_y, Type euler_z, EulerOrder order)
 
Vec3< Type > rotate_vector (const Vec3< Type > &v) const
 Rotates vector by this quaternion. More...
 
Vec4< Type > rotate_vector (const Vec4< Type > &v) const
 
Mat4< Type > to_matrix () const
 Convert the quaternion to a rotation matrix. More...
 
Vec4< Type > to_vec4 () const
 Return quaternion as a vector. More...
 

Static Public Member Functions

static Quaternionx< Type > axis_angle (Type angle, const Vec3f &axis)
 
static Quaternionx< Type > euler (Type x, Type y, Type z, EulerOrder order=EulerOrder::yxz)
 
static Quaternionx< Type > euler (const Vec3< Type > &xyz, EulerOrder order=EulerOrder::yxz)
 
static Quaternionx< Type > inverse (Quaternionx< Type > q)
 Inverse this quaternion. More...
 
static Quaternionx< Type > lerp (const Quaternionx< Type > &quaternion_initial, const Quaternionx< Type > &quaternion_final, Type lerp_time)
 Linear Quaternion Interpolation. More...
 
static Quaternionx< Type > multiply (const Quaternionx< Type > &quaternion_1, const Quaternionx< Type > &quaternion_2)
 
static Quaternionx< Type > normalize (Quaternionx< Type > q)
 Normalizes this quaternion. More...
 
static Quaternionx< Type > rotation_between (Vec3< Type > v0, Vec3< Type > v1)
 Calculates the shortest arc quaternion between two vectors. More...
 
static Quaternionx< Type > rotation_between (Vec4< Type > v0, Vec4< Type > v1)
 Calculates the shortest arc quaternion between two vectors. More...
 
static Quaternionx< Type > slerp (const Quaternionx< Type > &quaternion_initial, const Quaternionx< Type > &quaternion_final, Type slerp_time)
 Spherical Quaternion Interpolation. More...
 

Public Attributes

Type w = Type(1)
 The real scalar part. More...
 
Type x = Type(0)
 The imaginary vector part. More...
 
Type y = Type(0)
 
Type z = Type(0)
 

Detailed Description

template<typename Type>
class uicore::Quaternionx< Type >

Quaternion.

These quaternion templates are defined for: float (Quaternionf), double (Quaterniond)

Constructor & Destructor Documentation

template<typename Type>
uicore::Quaternionx< Type >::Quaternionx ( )
inline

Constructs a quaternion.

template<typename Type>
uicore::Quaternionx< Type >::Quaternionx ( const Quaternionx< Type > &  other)
inline
template<typename Type>
uicore::Quaternionx< Type >::Quaternionx ( Type  x,
Type  y,
Type  z,
Type  w 
)
inline
template<typename Type>
uicore::Quaternionx< Type >::Quaternionx ( const Vec4< Type > &  quat)
inline
template<typename Type>
uicore::Quaternionx< Type >::Quaternionx ( const Mat4< Type > &  rotation_matrix)
explicit

Member Function Documentation

template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::axis_angle ( Type  angle,
const Vec3f axis 
)
static
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::euler ( Type  x,
Type  y,
Type  z,
EulerOrder  order = EulerOrder::yxz 
)
static
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::euler ( const Vec3< Type > &  xyz,
EulerOrder  order = EulerOrder::yxz 
)
static
template<typename Type>
Quaternionx<Type>& uicore::Quaternionx< Type >::inverse ( )

Inverse this quaternion.

This is the same as the conjugate of a quaternion

Returns
reference to this object
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::inverse ( Quaternionx< Type >  q)
inlinestatic

Inverse this quaternion.

This is the same as the conjugate of a quaternion

Returns
reference to this object
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::lerp ( const Quaternionx< Type > &  quaternion_initial,
const Quaternionx< Type > &  quaternion_final,
Type  lerp_time 
)
static

Linear Quaternion Interpolation.

Parameters
quaternion_initial= Source quaternion
quaternion_final= Destination quaternion
lerp_time= Time in the range of 0.0 to 1.0
template<typename Type>
Type uicore::Quaternionx< Type >::magnitude ( ) const

Get the quaternion magnitude.

template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::multiply ( const Quaternionx< Type > &  quaternion_1,
const Quaternionx< Type > &  quaternion_2 
)
static
template<typename Type>
Quaternionx<Type>& uicore::Quaternionx< Type >::normalize ( )

Normalizes this quaternion.

Returns
reference to this object
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::normalize ( Quaternionx< Type >  q)
inlinestatic

Normalizes this quaternion.

Returns
reference to this object
template<typename Type>
uicore::Quaternionx< Type >::operator Vec4< Type > ( ) const
inline
template<typename Type>
bool uicore::Quaternionx< Type >::operator!= ( const Quaternionx< Type > &  other) const
inline

Not equal operator.

template<typename Type>
Quaternionx<Type> uicore::Quaternionx< Type >::operator* ( const Quaternionx< Type > &  mult) const
inline

Multiplication operator.

References uicore::Quaternionx< Type >::multiply().

template<typename Type>
Quaternionx<Type> uicore::Quaternionx< Type >::operator* ( const Mat4< Type > &  matrix) const
template<typename Type>
Vec3<Type> uicore::Quaternionx< Type >::operator* ( const Vec3< Type > &  v) const
inline
template<typename Type>
Vec4<Type> uicore::Quaternionx< Type >::operator* ( const Vec4< Type > &  v) const
inline
template<typename Type>
bool uicore::Quaternionx< Type >::operator< ( const Quaternionx< Type > &  other) const
inline

Less operator.

template<typename Type>
bool uicore::Quaternionx< Type >::operator<= ( const Quaternionx< Type > &  other) const
inline

Less equal operator.

template<typename Type>
bool uicore::Quaternionx< Type >::operator== ( const Quaternionx< Type > &  other) const
inline

Equal operator.

template<typename Type>
bool uicore::Quaternionx< Type >::operator> ( const Quaternionx< Type > &  other) const
inline

Greater operator.

template<typename Type>
bool uicore::Quaternionx< Type >::operator>= ( const Quaternionx< Type > &  other) const
inline

Greater equal operator.

template<typename Type>
Quaternionx<Type>& uicore::Quaternionx< Type >::rotate ( Type  angle,
const Vec3f axis 
)
template<typename Type>
Quaternionx<Type>& uicore::Quaternionx< Type >::rotate ( Type  euler_x,
Type  euler_y,
Type  euler_z,
EulerOrder  order 
)
template<typename Type>
Vec3<Type> uicore::Quaternionx< Type >::rotate_vector ( const Vec3< Type > &  v) const

Rotates vector by this quaternion.

Parameters
v= Vertex to rotate
Returns
rotated vector

Referenced by uicore::Quaternionx< Type >::operator*().

template<typename Type>
Vec4<Type> uicore::Quaternionx< Type >::rotate_vector ( const Vec4< Type > &  v) const
template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::rotation_between ( Vec3< Type >  v0,
Vec3< Type >  v1 
)
static

Calculates the shortest arc quaternion between two vectors.

template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::rotation_between ( Vec4< Type >  v0,
Vec4< Type >  v1 
)
static

Calculates the shortest arc quaternion between two vectors.

template<typename Type>
static Quaternionx<Type> uicore::Quaternionx< Type >::slerp ( const Quaternionx< Type > &  quaternion_initial,
const Quaternionx< Type > &  quaternion_final,
Type  slerp_time 
)
static

Spherical Quaternion Interpolation.

Parameters
quaternion_initial= Source quaternion
quaternion_final= Destination quaternion
slerp_time= Time in the range of 0.0 to 1.0
template<typename Type>
Mat4<Type> uicore::Quaternionx< Type >::to_matrix ( ) const

Convert the quaternion to a rotation matrix.

This function assumes that the quarternion is normalized.

template<typename Type>
Vec4<Type> uicore::Quaternionx< Type >::to_vec4 ( ) const
inline

Member Data Documentation

template<typename Type>
Type uicore::Quaternionx< Type >::w = Type(1)

The real scalar part.

Referenced by uicore::Quaternionx< Type >::to_vec4().

template<typename Type>
Type uicore::Quaternionx< Type >::x = Type(0)

The imaginary vector part.

Referenced by uicore::Quaternionx< Type >::to_vec4().

template<typename Type>
Type uicore::Quaternionx< Type >::y = Type(0)
template<typename Type>
Type uicore::Quaternionx< Type >::z = Type(0)

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