39 #ifndef GLM_GTX_quaternion
40 #define GLM_GTX_quaternion
44 #include "../gtc/constants.hpp"
45 #include "../gtc/quaternion.hpp"
46 #include "../gtx/norm.hpp"
48 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
49 # pragma message("GLM: GLM_GTX_quaternion extension included")
60 template<
typename T, precision P>
61 detail::tvec3<T, P>
cross(
62 detail::tquat<T, P>
const & q,
63 detail::tvec3<T, P>
const & v);
68 template<
typename T, precision P>
69 detail::tvec3<T, P>
cross(
70 detail::tvec3<T, P>
const & v,
71 detail::tquat<T, P>
const & q);
77 template<
typename T, precision P>
78 detail::tquat<T, P>
squad(
79 detail::tquat<T, P>
const & q1,
80 detail::tquat<T, P>
const & q2,
81 detail::tquat<T, P>
const & s1,
82 detail::tquat<T, P>
const & s2,
88 template<
typename T, precision P>
90 detail::tquat<T, P>
const & prev,
91 detail::tquat<T, P>
const & curr,
92 detail::tquat<T, P>
const & next);
97 template<
typename T, precision P>
98 detail::tquat<T, P>
exp(
99 detail::tquat<T, P>
const & q);
104 template<
typename T, precision P>
105 detail::tquat<T, P>
log(
106 detail::tquat<T, P>
const & q);
111 template<
typename T, precision P>
112 detail::tquat<T, P>
pow(
113 detail::tquat<T, P>
const & x,
126 template<
typename T, precision P>
127 detail::tvec3<T, P>
rotate(
128 detail::tquat<T, P>
const & q,
129 detail::tvec3<T, P>
const & v);
134 template<
typename T, precision P>
135 detail::tvec4<T, P>
rotate(
136 detail::tquat<T, P>
const & q,
137 detail::tvec4<T, P>
const & v);
142 template<
typename T, precision P>
144 detail::tquat<T, P>
const & q);
149 template<
typename T, precision P>
151 detail::tquat<T, P>
const & x){
return mat3_cast(x);}
156 template<
typename T, precision P>
158 detail::tquat<T, P>
const & x){
return mat4_cast(x);}
163 template<
typename T, precision P>
165 detail::tmat3x3<T, P>
const & x){
return quat_cast(x);}
170 template<
typename T, precision P>
172 detail::tmat4x4<T, P>
const & x){
return quat_cast(x);}
177 template<
typename T, precision P>
179 detail::tquat<T, P>
const & x,
180 detail::tquat<T, P>
const & y,
186 template<
typename T, precision P>
188 detail::tquat<T, P>
const & x,
189 detail::tquat<T, P>
const & y,
197 template<
typename T, precision P>
199 detail::tvec3<T, P>
const & orig,
200 detail::tvec3<T, P>
const & dest);
205 template<
typename T, precision P>
206 T
length2(detail::tquat<T, P>
const & q);
211 #include "quaternion.inl"
213 #endif//GLM_GTX_quaternion
detail::tquat< T, P > toQuat(detail::tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
T extractRealComponent(detail::tquat< T, P > const &q)
Extract the real component of a quaternion.
GLM_FUNC_DECL detail::tvec3< T, P > cross(detail::tvec3< T, P > const &x, detail::tvec3< T, P > const &y)
Returns the cross product of x and y.
GLM_FUNC_DECL detail::tquat< T, P > quat_cast(detail::tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL detail::tmat4x4< T, P > rotate(detail::tmat4x4< T, P > const &m, T const &angle, detail::tvec3< T, P > const &axis)
Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
detail::tmat4x4< T, P > toMat4(detail::tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL genType exp(genType const &x)
Returns the natural exponentiation of x, i.e., e^x.
detail::tquat< T, P > intermediate(detail::tquat< T, P > const &prev, detail::tquat< T, P > const &curr, detail::tquat< T, P > const &next)
Returns an intermediate control point for squad interpolation.
detail::tquat< T, P > shortMix(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Quaternion interpolation using the rotation short path.
GLM_FUNC_DECL detail::tmat4x4< T, P > mat4_cast(detail::tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
T length2(T const &x)
Returns the squared length of x.
detail::tmat3x3< T, P > toMat3(detail::tquat< T, P > const &x)
Converts a quaternion to a 3 * 3 matrix.
detail::tquat< T, P > squad(detail::tquat< T, P > const &q1, detail::tquat< T, P > const &q2, detail::tquat< T, P > const &s1, detail::tquat< T, P > const &s2, T const &h)
Compute a point on a path according squad equation.
GLM_FUNC_DECL genType pow(genType const &base, genType const &exponent)
Returns 'base' raised to the power 'exponent'.
GLM_FUNC_DECL detail::tmat3x3< T, P > mat3_cast(detail::tquat< T, P > const &x)
Converts a quaternion to a 3 * 3 matrix.
detail::tquat< T, P > fastMix(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Quaternion normalized linear interpolation.
detail::tquat< T, P > rotation(detail::tvec3< T, P > const &orig, detail::tvec3< T, P > const &dest)
Compute the rotation between two vectors.
GLM_FUNC_DECL genType log(genType const &x)
Returns the natural logarithm of x, i.e., returns the value y which satisfies the equation x = e^y...