clan::Quaternionx< Type > Class Template Reference - ClanLib SDK
Description: clan::Quaternionx< Type > Class Template Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clan::Quaternionx< Type > Class Template Reference
clanCore Math

Quaternion. More...

`#include <quaternion.h>`

## Public Member Functions
| Quaternionx ()
| Quaternionx (const Angle &euler_x, const Angle &euler_y, const Angle &euler_z, EulerOrder order)
| Quaternionx (const Mat4< Type > &rotation_matrix)
| Quaternionx (const Quaternionx< Type > &copy)
| Quaternionx (const Vec3< Type > &euler, AngleUnit unit, EulerOrder order)
| Quaternionx (Type euler_x, Type euler_y, Type euler_z, AngleUnit unit, EulerOrder order)
| Quaternionx (Type real, const Vec3< Type > &imag)
| Quaternionx (Type real, Type i, Type j, Type k)
Quaternionx< Type > & | inverse ()
| Inverse this quaternion.
Type | magnitude () const
| Get the quaternion magnitude.
Quaternionx< Type > & | normalize ()
| Normalizes this quaternion.
bool | operator!= (const Quaternionx< Type > &other) const
| Not equal operator.
Quaternionx< Type > | operator* (const Mat4< Type > &matrix) const
Quaternionx< Type > | operator* (const Quaternionx< Type > &mult) const
| Multiplication operator.
bool | operator< (const Quaternionx< Type > &other) const
| Less operator.
bool | operator<= (const Quaternionx< Type > &other) const
| Less equal operator.
bool | operator== (const Quaternionx< Type > &other) const
| Equal operator.
bool | operator> (const Quaternionx< Type > &other) const
| Greater operator.
bool | operator>= (const Quaternionx< Type > &other) const
| Greater equal operator.
Quaternionx< Type > & | rotate (const Angle &angle, const Vec3f &axis)
Quaternionx< Type > & | rotate (const Angle &euler_x, const Angle &euler_y, const Angle &euler_z, EulerOrder order)
Vec3< Type > | rotate_vector (const Vec3< Type > &v) const
| Rotates vector by this quaternion.
Vec4< Type > | rotate_vector (const Vec4< Type > &v) const
void | set (const Angle &euler_x, const Angle &euler_y, const Angle &euler_z, EulerOrder order)
void | set (const Vec3< Type > &euler, AngleUnit unit, EulerOrder order)
void | set (Type euler_x, Type euler_y, Type euler_z, AngleUnit unit, EulerOrder order)
Mat4< Type > | to_matrix () const
| Convert the quaternion to a rotation matrix.

## Static Public Member Functions
static Quaternionx< Type > | axis_angle (const Angle &angle, const Vec3f &axis)
static Quaternionx< Type > | inverse (Quaternionx< Type > q)
| Inverse this quaternion.
static Quaternionx< Type > | lerp (const Quaternionx< Type > &quaternion_initial, const Quaternionx< Type > &quaternion_final, Type lerp_time)
| Linear Quaternion Interpolation.
static Quaternionx< Type > | multiply (const Quaternionx< Type > &quaternion_1, const Quaternionx< Type > &quaternion_2)
static Quaternionx< Type > | normalize (Quaternionx< Type > q)
| Normalizes this quaternion.
static Quaternionx< Type > | rotation_between (Vec3< Type > v0, Vec3< Type > v1)
| Calculates the shortest arc quaternion between two vectors.
static Quaternionx< Type > | rotation_between (Vec4< Type > v0, Vec4< Type > v1)
| Calculates the shortest arc quaternion between two vectors.
static Quaternionx< Type > | slerp (const Quaternionx< Type > &quaternion_initial, const Quaternionx< Type > &quaternion_final, Type slerp_time)
| Spherical Quaternion Interpolation.

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

## Detailed Description

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

Quaternion.

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

## Constructor & Destructor Documentation

## ◆ Quaternionx() [1/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( |  | ) |
| inline

References i, j, k, and w.

Referenced by Quaternionx(), axis_angle(), inverse(), inverse(), lerp(), multiply(), normalize(), normalize(), operator!=(), operator*(), operator*(), operator<(), operator<=(), operator==(), operator>(), operator>=(), rotate(), rotate(), rotation_between(), rotation_between(), and slerp().

## ◆ Quaternionx() [2/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | Type | real,
|  | Type | i,
|  | Type | j,
|  | Type | k )
| inlineexplicit

References i, j, k, and w.

## ◆ Quaternionx() [3/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | Type | real,
|  | const Vec3< Type > & | imag )
| inlineexplicit

References i, j, k, w, x, y, and z.

## ◆ Quaternionx() [4/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | const Quaternionx< Type > & | copy | ) |
| inline

References Quaternionx(), i, j, k, and w.

## ◆ Quaternionx() [5/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | Type | euler_x,
|  | Type | euler_y,
|  | Type | euler_z,
|  | AngleUnit | unit,
|  | EulerOrder | order )
| explicit

## ◆ Quaternionx() [6/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | const Vec3< Type > & | euler,
|  | AngleUnit | unit,
|  | EulerOrder | order )
| explicit

## ◆ Quaternionx() [7/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | const Angle & | euler_x,
|  | const Angle & | euler_y,
|  | const Angle & | euler_z,
|  | EulerOrder | order )
| explicit

## ◆ Quaternionx() [8/8]

template<typename Type>

clan::Quaternionx< Type >::Quaternionx | ( | const Mat4< Type > & | rotation_matrix | ) |
| explicit

## Member Function Documentation

## ◆ axis_angle()

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::axis_angle | ( | const Angle & | angle,
|  | const Vec3f & | axis )
| static

References Quaternionx().

## ◆ inverse() [1/2]

template<typename Type>

Quaternionx< Type > & clan::Quaternionx< Type >::inverse | ( |  | ) |

Inverse this quaternion.

This is the same as the conjugate of a quaternion

Returns
  reference to this object

References Quaternionx().

## ◆ inverse() [2/2]

template<typename Type>

Quaternionx< Type > clan::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

References Quaternionx(), and clan::q.

## ◆ lerp()

template<typename Type>

Quaternionx< Type > clan::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

References Quaternionx().

## ◆ magnitude()

template<typename Type>

Type clan::Quaternionx< Type >::magnitude | ( |  | ) | const

Get the quaternion magnitude.

## ◆ multiply()

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::multiply | ( | const Quaternionx< Type > & | quaternion_1,
|  | const Quaternionx< Type > & | quaternion_2 )
| static

References Quaternionx().

Referenced by operator*().

## ◆ normalize() [1/2]

template<typename Type>

Quaternionx< Type > & clan::Quaternionx< Type >::normalize | ( |  | ) |

Normalizes this quaternion.

Returns
  reference to this object

References Quaternionx().

## ◆ normalize() [2/2]

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::normalize | ( | Quaternionx< Type > | q | ) |
| inlinestatic

Normalizes this quaternion.

Returns
  reference to this object

References Quaternionx(), and clan::q.

## ◆ operator!=()

template<typename Type>

bool clan::Quaternionx< Type >::operator!= | ( | const Quaternionx< Type > & | other | ) | const
| inline

Not equal operator.

References Quaternionx(), w, x, y, and z.

## ◆ operator*() [1/2]

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::operator* | ( | const Mat4< Type > & | matrix | ) | const

References Quaternionx().

## ◆ operator*() [2/2]

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::operator* | ( | const Quaternionx< Type > & | mult | ) | const
| inline

Multiplication operator.

References Quaternionx(), and multiply().

## ◆ operator<()

template<typename Type>

bool clan::Quaternionx< Type >::operator< | ( | const Quaternionx< Type > & | other | ) | const
| inline

Less operator.

References Quaternionx(), w, x, y, and z.

## ◆ operator<=()

template<typename Type>

bool clan::Quaternionx< Type >::operator<= | ( | const Quaternionx< Type > & | other | ) | const
| inline

Less equal operator.

References Quaternionx().

## ◆ operator==()

template<typename Type>

bool clan::Quaternionx< Type >::operator== | ( | const Quaternionx< Type > & | other | ) | const
| inline

Equal operator.

References Quaternionx(), w, x, y, and z.

## ◆ operator>()

template<typename Type>

bool clan::Quaternionx< Type >::operator> | ( | const Quaternionx< Type > & | other | ) | const
| inline

Greater operator.

References Quaternionx(), w, x, y, and z.

## ◆ operator>=()

template<typename Type>

bool clan::Quaternionx< Type >::operator>= | ( | const Quaternionx< Type > & | other | ) | const
| inline

Greater equal operator.

References Quaternionx().

## ◆ rotate() [1/2]

template<typename Type>

Quaternionx< Type > & clan::Quaternionx< Type >::rotate | ( | const Angle & | angle,
|  | const Vec3f & | axis )

References Quaternionx().

## ◆ rotate() [2/2]

template<typename Type>

Quaternionx< Type > & clan::Quaternionx< Type >::rotate | ( | const Angle & | euler_x,
|  | const Angle & | euler_y,
|  | const Angle & | euler_z,
|  | EulerOrder | order )

References Quaternionx().

## ◆ rotate_vector() [1/2]

template<typename Type>

Vec3< Type > clan::Quaternionx< Type >::rotate_vector | ( | const Vec3< Type > & | v | ) | const

Rotates vector by this quaternion.

Parameters

  v | = Vertex to rotate

Returns
  rotated vector

## ◆ rotate_vector() [2/2]

template<typename Type>

Vec4< Type > clan::Quaternionx< Type >::rotate_vector | ( | const Vec4< Type > & | v | ) | const

## ◆ rotation_between() [1/2]

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::rotation_between | ( | Vec3< Type > | v0,
|  | Vec3< Type > | v1 )
| static

Calculates the shortest arc quaternion between two vectors.

References Quaternionx().

## ◆ rotation_between() [2/2]

template<typename Type>

Quaternionx< Type > clan::Quaternionx< Type >::rotation_between | ( | Vec4< Type > | v0,
|  | Vec4< Type > | v1 )
| static

Calculates the shortest arc quaternion between two vectors.

References Quaternionx().

## ◆ set() [1/3]

template<typename Type>

void clan::Quaternionx< Type >::set | ( | const Angle & | euler_x,
|  | const Angle & | euler_y,
|  | const Angle & | euler_z,
|  | EulerOrder | order )

## ◆ set() [2/3]

template<typename Type>

void clan::Quaternionx< Type >::set | ( | const Vec3< Type > & | euler,
|  | AngleUnit | unit,
|  | EulerOrder | order )

## ◆ set() [3/3]

template<typename Type>

void clan::Quaternionx< Type >::set | ( | Type | euler_x,
|  | Type | euler_y,
|  | Type | euler_z,
|  | AngleUnit | unit,
|  | EulerOrder | order )

## ◆ slerp()

template<typename Type>

Quaternionx< Type > clan::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

References Quaternionx().

## ◆ to_matrix()

template<typename Type>

Mat4< Type > clan::Quaternionx< Type >::to_matrix | ( |  | ) | const

Convert the quaternion to a rotation matrix.

This function assumes that the quarternion is normalized.

## Member Data Documentation

## ◆ [union]

union { ... } clan::Quaternionx< Type >

## ◆ [union]

union { ... } clan::Quaternionx< Type >

The imaginary vector part.

## ◆ [union]

union { ... } clan::Quaternionx< Type >

## ◆ i

template<typename Type>

Type clan::Quaternionx< Type >::i

Referenced by Quaternionx(), Quaternionx(), Quaternionx(), and Quaternionx().

## ◆ j

template<typename Type>

Type clan::Quaternionx< Type >::j

Referenced by Quaternionx(), Quaternionx(), Quaternionx(), and Quaternionx().

## ◆ k

template<typename Type>

Type clan::Quaternionx< Type >::k

Referenced by Quaternionx(), Quaternionx(), Quaternionx(), and Quaternionx().

## ◆ w

template<typename Type>

Type clan::Quaternionx< Type >::w

The real scalar part.

Referenced by Quaternionx(), Quaternionx(), Quaternionx(), Quaternionx(), operator!=(), operator<(), operator==(), and operator>().

## ◆ x

template<typename Type>

Type clan::Quaternionx< Type >::x

Referenced by Quaternionx(), operator!=(), operator<(), operator==(), and operator>().

## ◆ y

template<typename Type>

Type clan::Quaternionx< Type >::y

Referenced by Quaternionx(), operator!=(), operator<(), operator==(), and operator>().

## ◆ z

template<typename Type>

Type clan::Quaternionx< Type >::z

Referenced by Quaternionx(), operator!=(), operator<(), operator==(), and operator>().

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

- mat4.h
- quaternion.h