18 #include "../gtc/constants.hpp"
19 #include "../gtc/quaternion.hpp"
20 #include "../ext/quaternion_exponential.hpp"
21 #include "../gtx/norm.hpp"
23 #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
24 # ifndef GLM_ENABLE_EXPERIMENTAL
25 # pragma message("GLM: GLM_GTX_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.")
27 # pragma message("GLM: GLM_GTX_quaternion extension included")
39 template<
typename T, qualifier Q>
45 template<
typename T, qualifier Q>
46 GLM_FUNC_DECL vec<3, T, Q>
cross(
48 vec<3, T, Q>
const& v);
53 template<
typename T, qualifier Q>
54 GLM_FUNC_DECL vec<3, T, Q>
cross(
55 vec<3, T, Q>
const& v,
62 template<
typename T, qualifier Q>
63 GLM_FUNC_DECL qua<T, Q>
squad(
73 template<
typename T, qualifier Q>
75 qua<T, Q>
const& prev,
76 qua<T, Q>
const& curr,
77 qua<T, Q>
const& next);
89 template<
typename T, qualifier Q>
90 GLM_FUNC_DECL vec<3, T, Q>
rotate(
92 vec<3, T, Q>
const& v);
97 template<
typename T, qualifier Q>
98 GLM_FUNC_DECL vec<4, T, Q>
rotate(
100 vec<4, T, Q>
const& v);
105 template<
typename T, qualifier Q>
112 template<
typename T, qualifier Q>
114 qua<T, Q>
const& x){
return mat3_cast(x);}
119 template<
typename T, qualifier Q>
121 qua<T, Q>
const& x){
return mat4_cast(x);}
126 template<
typename T, qualifier Q>
128 mat<3, 3, T, Q>
const& x){
return quat_cast(x);}
133 template<
typename T, qualifier Q>
135 mat<4, 4, T, Q>
const& x){
return quat_cast(x);}
140 template<
typename T, qualifier Q>
149 template<
typename T, qualifier Q>
150 GLM_FUNC_DECL qua<T, Q>
fastMix(
160 template<
typename T, qualifier Q>
162 vec<3, T, Q>
const& orig,
163 vec<3, T, Q>
const& dest);
168 template<
typename T, qualifier Q>
169 GLM_FUNC_DECL T
length2(qua<T, Q>
const& q);
174 #include "quaternion.inl"
GLM_FUNC_DECL mat< 4, 4, T, Q > mat4_cast(qua< T, Q > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL qua< T, Q > shortMix(qua< T, Q > const &x, qua< T, Q > const &y, T const &a)
Quaternion interpolation using the rotation short path.
GLM_FUNC_DECL qua< T, Q > quat_identity()
Create an identity quaternion.
GLM_FUNC_DECL qua< T, Q > quat_cast(mat< 3, 3, T, Q > const &x)
Converts a pure rotation 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL qua< T, Q > intermediate(qua< T, Q > const &prev, qua< T, Q > const &curr, qua< T, Q > const &next)
Returns an intermediate control point for squad interpolation.
GLM_FUNC_DECL mat< 3, 3, T, Q > mat3_cast(qua< T, Q > const &x)
Converts a quaternion to a 3 * 3 matrix.
GLM_FUNC_DECL mat< 4, 4, T, Q > toMat4(qua< T, Q > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL T extractRealComponent(qua< T, Q > const &q)
Extract the real component of a quaternion.
GLM_FUNC_DECL mat< 3, 3, T, Q > toMat3(qua< T, Q > const &x)
Converts a quaternion to a 3 * 3 matrix.
GLM_FUNC_DECL qua< T, Q > squad(qua< T, Q > const &q1, qua< T, Q > const &q2, qua< T, Q > const &s1, qua< T, Q > const &s2, T const &h)
Compute a point on a path according squad equation.
GLM_FUNC_DECL vec< 3, T, Q > cross(vec< 3, T, Q > const &v, qua< T, Q > const &q)
Compute a cross product between a vector and a quaternion.
GLM_FUNC_DECL qua< T, Q > toQuat(mat< 4, 4, T, Q > const &x)
Converts a 4 * 4 matrix to a quaternion.
GLM_FUNC_DECL qua< T, Q > rotation(vec< 3, T, Q > const &orig, vec< 3, T, Q > const &dest)
Compute the rotation between two vectors.
GLM_FUNC_DECL vec< 4, T, Q > rotate(qua< T, Q > const &q, vec< 4, T, Q > const &v)
Rotates a 4 components vector by a quaternion.
GLM_FUNC_DECL qua< T, Q > fastMix(qua< T, Q > const &x, qua< T, Q > const &y, T const &a)
Quaternion normalized linear interpolation.
GLM_FUNC_DECL T length2(qua< T, Q > const &q)
Returns the squared length of x.