GLM  0.9.5
gtx/quaternion.hpp
Go to the documentation of this file.
1 
39 #ifndef GLM_GTX_quaternion
40 #define GLM_GTX_quaternion
41 
42 // Dependency:
43 #include "../glm.hpp"
44 #include "../gtc/constants.hpp"
45 #include "../gtc/quaternion.hpp"
46 #include "../gtx/norm.hpp"
47 
48 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
49 # pragma message("GLM: GLM_GTX_quaternion extension included")
50 #endif
51 
52 namespace glm
53 {
56 
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);
64 
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);
72 
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,
83  T const & h);
84 
88  template<typename T, precision P>
89  detail::tquat<T, P> intermediate(
90  detail::tquat<T, P> const & prev,
91  detail::tquat<T, P> const & curr,
92  detail::tquat<T, P> const & next);
93 
97  template<typename T, precision P>
98  detail::tquat<T, P> exp(
99  detail::tquat<T, P> const & q);
100 
104  template<typename T, precision P>
105  detail::tquat<T, P> log(
106  detail::tquat<T, P> const & q);
107 
111  template<typename T, precision P>
112  detail::tquat<T, P> pow(
113  detail::tquat<T, P> const & x,
114  T const & y);
115 
119  //template<typename T, precision P>
120  //detail::tquat<T, P> sqrt(
121  // detail::tquat<T, P> const & q);
122 
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);
130 
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);
138 
142  template<typename T, precision P>
144  detail::tquat<T, P> const & q);
145 
149  template<typename T, precision P>
150  detail::tmat3x3<T, P> toMat3(
151  detail::tquat<T, P> const & x){return mat3_cast(x);}
152 
156  template<typename T, precision P>
157  detail::tmat4x4<T, P> toMat4(
158  detail::tquat<T, P> const & x){return mat4_cast(x);}
159 
163  template<typename T, precision P>
164  detail::tquat<T, P> toQuat(
165  detail::tmat3x3<T, P> const & x){return quat_cast(x);}
166 
170  template<typename T, precision P>
171  detail::tquat<T, P> toQuat(
172  detail::tmat4x4<T, P> const & x){return quat_cast(x);}
173 
177  template<typename T, precision P>
178  detail::tquat<T, P> shortMix(
179  detail::tquat<T, P> const & x,
180  detail::tquat<T, P> const & y,
181  T const & a);
182 
186  template<typename T, precision P>
187  detail::tquat<T, P> fastMix(
188  detail::tquat<T, P> const & x,
189  detail::tquat<T, P> const & y,
190  T const & a);
191 
197  template<typename T, precision P>
198  detail::tquat<T, P> rotation(
199  detail::tvec3<T, P> const & orig,
200  detail::tvec3<T, P> const & dest);
201 
205  template<typename T, precision P>
206  T length2(detail::tquat<T, P> const & q);
207 
209 }//namespace glm
210 
211 #include "quaternion.inl"
212 
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 &#39;base&#39; raised to the power &#39;exponent&#39;.
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...