Public Member Functions | Static Public Member Functions | Public Attributes

CL_Quaternionx< Type > Class Template Reference
[clanCore Math]

Quaternion. More...

#include <quaternion.h>

Inheritance diagram for CL_Quaternionx< Type >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CL_Quaternionx ()
 CL_Quaternionx (const CL_Angle &euler_x, const CL_Angle &euler_y, const CL_Angle &euler_z, CL_EulerOrder order)
 CL_Quaternionx (const CL_Vec3< Type > &euler, CL_AngleUnit unit, CL_EulerOrder order)
 CL_Quaternionx (Type euler_x, Type euler_y, Type euler_z, CL_AngleUnit unit, CL_EulerOrder order)
 CL_Quaternionx (const CL_Quaternionx< Type > &copy)
 CL_Quaternionx (Type real, const CL_Vec3< Type > &imag)
 CL_Quaternionx (Type real, Type i, Type j, Type k)
Attributes

CL_Mat4< Type > to_matrix () const
 Convert the quaternion to a rotation matrix.
Type magnitude () const
 Get the quaternion magnitude.
Operations

void set (Type euler_x, Type euler_y, Type euler_z, CL_AngleUnit unit, CL_EulerOrder order)
void set (const CL_Vec3< Type > &euler, CL_AngleUnit unit, CL_EulerOrder order)
void set (const CL_Angle &euler_x, const CL_Angle &euler_y, const CL_Angle &euler_z, CL_EulerOrder order)
CL_Quaternionx< Type > & multiply (const CL_Mat4< Type > &matrix)
 Multiply this quaternion by a specified matrix.
CL_Quaternionx< Type > & multiply (const CL_Quaternionx< Type > &quaternion)
 Multiply this quaternion by another quaternion.
CL_Quaternionx< Type > & rotate (const CL_Angle &angle, const CL_Vec3f &axis)
CL_Quaternionx< Type > & rotate (const CL_Angle &euler_x, const CL_Angle &euler_y, const CL_Angle &euler_z, CL_EulerOrder order)
CL_Quaternionx< Type > & normalize ()
 Normalizes this quaternion.
CL_Quaternionx< Type > & inverse ()
 Inverse this quaternion.
CL_Vec3< Type > rotate_vector (const CL_Vec3< Type > &v)
 Rotates vector by this quaternion.
CL_Vec4< Type > rotate_vector (const CL_Vec4< Type > &v)
Operators

CL_Quaternionx< Type > operator* (const CL_Quaternionx< Type > &mult) const
 Multiplication operator.

Static Public Member Functions

static CL_Quaternionx< Type > axis_angle (const CL_Angle &angle, const CL_Vec3f &axis)
static CL_Quaternionx< Type > lerp (const CL_Quaternionx< Type > &quaternion_initial, const CL_Quaternionx< Type > &quaternion_final, Type lerp_time)
 Linear Quaternion Interpolation.
static CL_Quaternionx< Type > multiply (const CL_Quaternionx< Type > &quaternion_1, const CL_Quaternionx< Type > &quaternion_2)
static CL_Quaternionx< Type > slerp (const CL_Quaternionx< Type > &quaternion_initial, const CL_Quaternionx< Type > &quaternion_final, Type slerp_time)
 Spherical Quaternion Interpolation.

Public Attributes

union {
   Type   i
   Type   x
}; 
 The imaginary vector part.
union {
   Type   j
   Type   y
}; 
union {
   Type   k
   Type   z
}; 
Type w
 The real scalar part.

Detailed Description

template<typename Type>
class CL_Quaternionx< Type >

Quaternion.

These quaternion templates are defined for: float (CL_Quaternionf), double (CL_Quaterniond)


Constructor & Destructor Documentation

template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx (  )  [inline]
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( Type  real,
Type  i,
Type  j,
Type  k 
) [inline]
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( Type  real,
const CL_Vec3< Type > &  imag 
) [inline]
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( const CL_Quaternionx< Type > &  copy  )  [inline]
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( Type  euler_x,
Type  euler_y,
Type  euler_z,
CL_AngleUnit  unit,
CL_EulerOrder  order 
)
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( const CL_Vec3< Type > &  euler,
CL_AngleUnit  unit,
CL_EulerOrder  order 
)
template<typename Type>
CL_Quaternionx< Type >::CL_Quaternionx ( const CL_Angle euler_x,
const CL_Angle euler_y,
const CL_Angle euler_z,
CL_EulerOrder  order 
)

Member Function Documentation

template<typename Type>
static CL_Quaternionx<Type> CL_Quaternionx< Type >::axis_angle ( const CL_Angle angle,
const CL_Vec3f axis 
) [static]
template<typename Type>
CL_Quaternionx<Type>& CL_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 CL_Quaternionx<Type> CL_Quaternionx< Type >::lerp ( const CL_Quaternionx< Type > &  quaternion_initial,
const CL_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 CL_Quaternionx< Type >::magnitude (  )  const

Get the quaternion magnitude.

template<typename Type>
static CL_Quaternionx<Type> CL_Quaternionx< Type >::multiply ( const CL_Quaternionx< Type > &  quaternion_1,
const CL_Quaternionx< Type > &  quaternion_2 
) [static]
template<typename Type>
CL_Quaternionx<Type>& CL_Quaternionx< Type >::multiply ( const CL_Mat4< Type > &  matrix  ) 

Multiply this quaternion by a specified matrix.

Parameters:
matrix = Matrix to multiply
Returns:
reference to this object
template<typename Type>
CL_Quaternionx<Type>& CL_Quaternionx< Type >::multiply ( const CL_Quaternionx< Type > &  quaternion  ) 

Multiply this quaternion by another quaternion.

This multiplies the quaternion as follows: this = quaternion * this

Parameters:
quaternion = Quaternion to multiply
Returns:
reference to this object
template<typename Type>
CL_Quaternionx<Type>& CL_Quaternionx< Type >::normalize (  ) 

Normalizes this quaternion.

Returns:
reference to this object
template<typename Type>
CL_Quaternionx<Type> CL_Quaternionx< Type >::operator* ( const CL_Quaternionx< Type > &  mult  )  const [inline]

Multiplication operator.

template<typename Type>
CL_Quaternionx<Type>& CL_Quaternionx< Type >::rotate ( const CL_Angle euler_x,
const CL_Angle euler_y,
const CL_Angle euler_z,
CL_EulerOrder  order 
)
template<typename Type>
CL_Quaternionx<Type>& CL_Quaternionx< Type >::rotate ( const CL_Angle angle,
const CL_Vec3f axis 
)
template<typename Type>
CL_Vec4<Type> CL_Quaternionx< Type >::rotate_vector ( const CL_Vec4< Type > &  v  ) 
template<typename Type>
CL_Vec3<Type> CL_Quaternionx< Type >::rotate_vector ( const CL_Vec3< Type > &  v  ) 

Rotates vector by this quaternion.

Parameters:
v = Vertex to rotate
Returns:
rotated vector
template<typename Type>
void CL_Quaternionx< Type >::set ( Type  euler_x,
Type  euler_y,
Type  euler_z,
CL_AngleUnit  unit,
CL_EulerOrder  order 
)
template<typename Type>
void CL_Quaternionx< Type >::set ( const CL_Angle euler_x,
const CL_Angle euler_y,
const CL_Angle euler_z,
CL_EulerOrder  order 
)
template<typename Type>
void CL_Quaternionx< Type >::set ( const CL_Vec3< Type > &  euler,
CL_AngleUnit  unit,
CL_EulerOrder  order 
)
template<typename Type>
static CL_Quaternionx<Type> CL_Quaternionx< Type >::slerp ( const CL_Quaternionx< Type > &  quaternion_initial,
const CL_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>
CL_Mat4<Type> CL_Quaternionx< Type >::to_matrix (  )  const

Convert the quaternion to a rotation matrix.

This function assumes that the quarternion is normalized.


Member Data Documentation

union { ... }

The imaginary vector part.

union { ... }
union { ... }
template<typename Type>
Type CL_Quaternionx< Type >::i
template<typename Type>
Type CL_Quaternionx< Type >::j
template<typename Type>
Type CL_Quaternionx< Type >::k
template<typename Type>
Type CL_Quaternionx< Type >::w

The real scalar part.

template<typename Type>
Type CL_Quaternionx< Type >::x
template<typename Type>
Type CL_Quaternionx< Type >::y
template<typename Type>
Type CL_Quaternionx< Type >::z

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