# GLM: glm::gtc::quaternion Namespace Reference

# glm::gtc::quaternion Namespace Reference

GLM_GTC_quaternion extension: Quaternion types and functions. More...

## Typedefs

typedef detail::tquat< float > | quat
| Quaternion of floating-point numbers.

## Functions

template<typename valType >
detail::tquat< valType > | conjugate (detail::tquat< valType > const &q)
| Returns the q conjugate.
template<typename valType >
detail::tquat< valType > | cross (detail::tquat< valType > const &q1, detail::tquat< valType > const &q2)
| Returns the cross product of q1 and q2.
template<typename valType >
valType | dot (detail::tquat< valType > const &q1, detail::tquat< valType > const &q2)
| Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + .
template<typename valType >
detail::tquat< valType > | inverse (detail::tquat< valType > const &q)
| Returns the q inverse.
template<typename valType >
valType | length (detail::tquat< valType > const &q)
| Returns the length of the quaternion x.
template<typename valType >
detail::tmat3x3< valType > | mat3_cast (detail::tquat< valType > const &x)
| Converts a quaternion to a 3 * 3 matrix.
template<typename valType >
detail::tmat4x4< valType > | mat4_cast (detail::tquat< valType > const &x)
| Converts a quaternion to a 4 * 4 matrix.
template<typename valType >
detail::tquat< valType > | mix (detail::tquat< valType > const &x, detail::tquat< valType > const &y, valType const &a)
| Returns a LERP interpolated quaternion of x and y according a.
template<typename valType >
detail::tquat< valType > | normalize (detail::tquat< valType > const &q)
| Returns the normalized quaternion of from x.
template<typename valType >
detail::tquat< valType > | quat_cast (detail::tmat4x4< valType > const &x)
| Converts a 4 * 4 matrix to a quaternion.
template<typename valType >
detail::tquat< valType > | quat_cast (detail::tmat3x3< valType > const &x)
| Converts a 3 * 3 matrix to a quaternion.
template<typename valType >
detail::tquat< valType > | rotate (detail::tquat< valType > const &q, valType const &angle, detail::tvec3< valType > const &v)
| Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees.

## Detailed Description

GLM_GTC_quaternion extension: Quaternion types and functions.

## Typedef Documentation

typedef detail::tquat<float> quat

Quaternion of floating-point numbers.

From GLM_GTC_quaternion extension.

Definition at line 185 of file gtc/quaternion.hpp.

## Function Documentation

detail::tquat<valType> glm::gtc::quaternion::conjugate | ( | detail::tquat< valType > const & | q | ) |

Returns the q conjugate.

From GLM_GTC_quaternion extension.

detail::tquat<valType> glm::gtc::quaternion::cross | ( | detail::tquat< valType > const & | q1,
|  | detail::tquat< valType > const & | q2 |
| ) |  |  |

Returns the cross product of q1 and q2.

From GLM_GTC_quaternion extension.

valType glm::gtc::quaternion::dot | ( | detail::tquat< valType > const & | q1,
|  | detail::tquat< valType > const & | q2 |
| ) |  |  |

Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + .

.. From GLM_GTC_quaternion extension.

detail::tquat<valType> glm::gtc::quaternion::inverse | ( | detail::tquat< valType > const & | q | ) |

Returns the q inverse.

From GLM_GTC_quaternion extension.

valType glm::gtc::quaternion::length | ( | detail::tquat< valType > const & | q | ) |

Returns the length of the quaternion x.

From GLM_GTC_quaternion extension.

detail::tmat3x3<valType> glm::gtc::quaternion::mat3_cast | ( | detail::tquat< valType > const & | x | ) |

Converts a quaternion to a 3 * 3 matrix.

From GLM_GTC_quaternion extension.

Referenced by glm::gtx::quaternion::toMat3().

detail::tmat4x4<valType> glm::gtc::quaternion::mat4_cast | ( | detail::tquat< valType > const & | x | ) |

Converts a quaternion to a 4 * 4 matrix.

From GLM_GTC_quaternion extension.

Referenced by glm::gtx::quaternion::toMat4().

detail::tquat<valType> glm::gtc::quaternion::mix | ( | detail::tquat< valType > const & | x,
|  | detail::tquat< valType > const & | y,
|  | valType const & | a |
| ) |  |  |

Returns a LERP interpolated quaternion of x and y according a.

From GLM_GTC_quaternion extension.

detail::tquat<valType> glm::gtc::quaternion::normalize | ( | detail::tquat< valType > const & | q | ) |

Returns the normalized quaternion of from x.

From GLM_GTC_quaternion extension.

detail::tquat<valType> glm::gtc::quaternion::quat_cast | ( | detail::tmat4x4< valType > const & | x | ) |

Converts a 4 * 4 matrix to a quaternion.

From GLM_GTC_quaternion extension.

detail::tquat<valType> glm::gtc::quaternion::quat_cast | ( | detail::tmat3x3< valType > const & | x | ) |

Converts a 3 * 3 matrix to a quaternion.

From GLM_GTC_quaternion extension.

Referenced by glm::gtx::quaternion::toQuat().

detail::tquat<valType> glm::gtc::quaternion::rotate | ( | detail::tquat< valType > const & | q,
|  | valType const & | angle,
|  | detail::tvec3< valType > const & | v |
| ) |  |  |

Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees.

From GLM_GTC_quaternion extension.