0.9.9 API documenation
Functions
GLM_GTC_quaternion

Defines a templated quaternion type and several quaternion operations. More...

Functions

template<typename T , qualifier P>
GLM_FUNC_DECL T angle (tquat< T, P > const &x)
 Returns the quaternion rotation angle. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > angleAxis (T const &angle, vec< 3, T, P > const &axis)
 Build a quaternion from an angle and a normalized axis. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 3, T, P > axis (tquat< T, P > const &x)
 Returns the q rotation axis. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > conjugate (tquat< T, P > const &q)
 Returns the q conjugate. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL T dot (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ... More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > equal (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison of result x == y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 3, T, P > eulerAngles (tquat< T, P > const &x)
 Returns euler angles, pitch as x, yaw as y, roll as z. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > greaterThan (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison of result x > y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > greaterThanEqual (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison of result x >= y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > inverse (tquat< T, P > const &q)
 Returns the q inverse. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > isinf (tquat< T, P > const &x)
 Returns true if x holds a positive infinity or negative infinity representation in the underlying implementation's set of floating point representations. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > isnan (tquat< T, P > const &x)
 Returns true if x holds a NaN (not a number) representation in the underlying implementation's set of floating point representations. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL T length (tquat< T, P > const &q)
 Returns the length of the quaternion. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > lerp (tquat< T, P > const &x, tquat< T, P > const &y, T a)
 Linear interpolation of two quaternions. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > lessThan (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison result of x < y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > lessThanEqual (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison of result x <= y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL mat< 3, 3, T, P > mat3_cast (tquat< T, P > const &x)
 Converts a quaternion to a 3 * 3 matrix. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL mat< 4, 4, T, P > mat4_cast (tquat< T, P > const &x)
 Converts a quaternion to a 4 * 4 matrix. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > mix (tquat< T, P > const &x, tquat< T, P > const &y, T a)
 Spherical linear interpolation of two quaternions. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > normalize (tquat< T, P > const &q)
 Returns the normalized quaternion. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL vec< 4, bool, P > notEqual (tquat< T, P > const &x, tquat< T, P > const &y)
 Returns the component-wise comparison of result x != y. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL T pitch (tquat< T, P > const &x)
 Returns pitch value of euler angles expressed in radians. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > quat_cast (mat< 3, 3, T, P > const &x)
 Converts a 3 * 3 matrix to a quaternion. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > quat_cast (mat< 4, 4, T, P > const &x)
 Converts a 4 * 4 matrix to a quaternion. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL T roll (tquat< T, P > const &x)
 Returns roll value of euler angles expressed in radians. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > rotate (tquat< T, P > const &q, T const &angle, vec< 3, T, P > const &axis)
 Rotates a quaternion from a vector of 3 components axis and an angle. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL tquat< T, P > slerp (tquat< T, P > const &x, tquat< T, P > const &y, T a)
 Spherical linear interpolation of two quaternions. More...
 
template<typename T , qualifier P>
GLM_FUNC_DECL T yaw (tquat< T, P > const &x)
 Returns yaw value of euler angles expressed in radians. More...
 

Detailed Description

Defines a templated quaternion type and several quaternion operations.

<glm/gtc/quaternion.hpp> need to be included to use these functionalities.

Function Documentation

GLM_FUNC_DECL T glm::angle ( tquat< T, P > const &  x)

Returns the quaternion rotation angle.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::angleAxis ( T const &  angle,
vec< 3, T, P > const &  axis 
)

Build a quaternion from an angle and a normalized axis.

Parameters
angleAngle expressed in radians.
axisAxis of the quaternion, must be normalized.
Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<3, T, P> glm::axis ( tquat< T, P > const &  x)

Returns the q rotation axis.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::conjugate ( tquat< T, P > const &  q)

Returns the q conjugate.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL T glm::dot ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

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

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::equal ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison of result x == y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<3, T, P> glm::eulerAngles ( tquat< T, P > const &  x)

Returns euler angles, pitch as x, yaw as y, roll as z.

The result is expressed in radians.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::greaterThan ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison of result x > y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::greaterThanEqual ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison of result x >= y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::inverse ( tquat< T, P > const &  q)

Returns the q inverse.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::isinf ( tquat< T, P > const &  x)

Returns true if x holds a positive infinity or negative infinity representation in the underlying implementation's set of floating point representations.

Returns false otherwise, including for implementations with no infinity representations.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::isnan ( tquat< T, P > const &  x)

Returns true if x holds a NaN (not a number) representation in the underlying implementation's set of floating point representations.

Returns false otherwise, including for implementations with no NaN representations.

/!\ When using compiler fast math, this function may fail.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL T glm::length ( tquat< T, P > const &  q)

Returns the length of the quaternion.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::lerp ( tquat< T, P > const &  x,
tquat< T, P > const &  y,
a 
)

Linear interpolation of two quaternions.

The interpolation is oriented.

Parameters
xA quaternion
yA quaternion
aInterpolation factor. The interpolation is defined in the range [0, 1].
Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::lessThan ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison result of x < y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::lessThanEqual ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison of result x <= y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL mat<3, 3, T, P> glm::mat3_cast ( tquat< T, P > const &  x)

Converts a quaternion to a 3 * 3 matrix.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion

Referenced by glm::toMat3().

GLM_FUNC_DECL mat<4, 4, T, P> glm::mat4_cast ( tquat< T, P > const &  x)

Converts a quaternion to a 4 * 4 matrix.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion

Referenced by glm::toMat4().

GLM_FUNC_DECL tquat<T, P> glm::mix ( tquat< T, P > const &  x,
tquat< T, P > const &  y,
a 
)

Spherical linear interpolation of two quaternions.

The interpolation is oriented and the rotation is performed at constant speed. For short path spherical linear interpolation, use the slerp function.

Parameters
xA quaternion
yA quaternion
aInterpolation factor. The interpolation is defined beyond the range [0, 1].
Template Parameters
TFloating-point scalar types.
See also
- slerp(tquat<T, P> const & x, tquat<T, P> const & y, T const & a)
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::normalize ( tquat< T, P > const &  q)

Returns the normalized quaternion.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL vec<4, bool, P> glm::notEqual ( tquat< T, P > const &  x,
tquat< T, P > const &  y 
)

Returns the component-wise comparison of result x != y.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL T glm::pitch ( tquat< T, P > const &  x)

Returns pitch value of euler angles expressed in radians.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::quat_cast ( mat< 3, 3, T, P > const &  x)

Converts a 3 * 3 matrix to a quaternion.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion

Referenced by glm::toQuat().

GLM_FUNC_DECL tquat<T, P> glm::quat_cast ( mat< 4, 4, T, P > const &  x)

Converts a 4 * 4 matrix to a quaternion.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL T glm::roll ( tquat< T, P > const &  x)

Returns roll value of euler angles expressed in radians.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::rotate ( tquat< T, P > const &  q,
T const &  angle,
vec< 3, T, P > const &  axis 
)

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

Parameters
qSource orientation
angleAngle expressed in radians.
axisAxis of the rotation
Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL tquat<T, P> glm::slerp ( tquat< T, P > const &  x,
tquat< T, P > const &  y,
a 
)

Spherical linear interpolation of two quaternions.

The interpolation always take the short path and the rotation is performed at constant speed.

Parameters
xA quaternion
yA quaternion
aInterpolation factor. The interpolation is defined beyond the range [0, 1].
Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion
GLM_FUNC_DECL T glm::yaw ( tquat< T, P > const &  x)

Returns yaw value of euler angles expressed in radians.

Template Parameters
TFloating-point scalar types.
See also
GLM_GTC_quaternion