0.9.7
gtx/quaternion.hpp
Go to the documentation of this file.
1 
43 #pragma once
44 
45 // Dependency:
46 #include "../glm.hpp"
47 #include "../gtc/constants.hpp"
48 #include "../gtc/quaternion.hpp"
49 #include "../gtx/norm.hpp"
50 
51 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
52 # pragma message("GLM: GLM_GTX_quaternion extension included")
53 #endif
54 
55 namespace glm
56 {
59 
63  template<typename T, precision P>
64  GLM_FUNC_DECL tvec3<T, P> cross(
65  tquat<T, P> const & q,
66  tvec3<T, P> const & v);
67 
71  template<typename T, precision P>
72  GLM_FUNC_DECL tvec3<T, P> cross(
73  tvec3<T, P> const & v,
74  tquat<T, P> const & q);
75 
80  template<typename T, precision P>
81  GLM_FUNC_DECL tquat<T, P> squad(
82  tquat<T, P> const & q1,
83  tquat<T, P> const & q2,
84  tquat<T, P> const & s1,
85  tquat<T, P> const & s2,
86  T const & h);
87 
91  template<typename T, precision P>
92  GLM_FUNC_DECL tquat<T, P> intermediate(
93  tquat<T, P> const & prev,
94  tquat<T, P> const & curr,
95  tquat<T, P> const & next);
96 
100  template<typename T, precision P>
101  GLM_FUNC_DECL tquat<T, P> exp(
102  tquat<T, P> const & q);
103 
107  template<typename T, precision P>
108  GLM_FUNC_DECL tquat<T, P> log(
109  tquat<T, P> const & q);
110 
114  template<typename T, precision P>
115  GLM_FUNC_DECL tquat<T, P> pow(
116  tquat<T, P> const & x,
117  T const & y);
118 
122  //template<typename T, precision P>
123  //tquat<T, P> sqrt(
124  // tquat<T, P> const & q);
125 
129  template<typename T, precision P>
130  GLM_FUNC_DECL tvec3<T, P> rotate(
131  tquat<T, P> const & q,
132  tvec3<T, P> const & v);
133 
137  template<typename T, precision P>
138  GLM_FUNC_DECL tvec4<T, P> rotate(
139  tquat<T, P> const & q,
140  tvec4<T, P> const & v);
141 
145  template<typename T, precision P>
146  GLM_FUNC_DECL T extractRealComponent(
147  tquat<T, P> const & q);
148 
152  template<typename T, precision P>
153  GLM_FUNC_DECL tmat3x3<T, P> toMat3(
154  tquat<T, P> const & x){return mat3_cast(x);}
155 
159  template<typename T, precision P>
160  GLM_FUNC_DECL tmat4x4<T, P> toMat4(
161  tquat<T, P> const & x){return mat4_cast(x);}
162 
166  template<typename T, precision P>
167  GLM_FUNC_DECL tquat<T, P> toQuat(
168  tmat3x3<T, P> const & x){return quat_cast(x);}
169 
173  template<typename T, precision P>
174  GLM_FUNC_DECL tquat<T, P> toQuat(
175  tmat4x4<T, P> const & x){return quat_cast(x);}
176 
180  template<typename T, precision P>
181  GLM_FUNC_DECL tquat<T, P> shortMix(
182  tquat<T, P> const & x,
183  tquat<T, P> const & y,
184  T const & a);
185 
189  template<typename T, precision P>
190  GLM_FUNC_DECL tquat<T, P> fastMix(
191  tquat<T, P> const & x,
192  tquat<T, P> const & y,
193  T const & a);
194 
200  template<typename T, precision P>
201  GLM_FUNC_DECL tquat<T, P> rotation(
202  tvec3<T, P> const & orig,
203  tvec3<T, P> const & dest);
204 
208  template<typename T, precision P>
209  GLM_FUNC_DECL T length2(tquat<T, P> const & q);
210 
212 }//namespace glm
213 
214 #include "quaternion.inl"
GLM_FUNC_DECL tquat< T, P > intermediate(tquat< T, P > const &prev, tquat< T, P > const &curr, tquat< T, P > const &next)
Returns an intermediate control point for squad interpolation.
GLM_FUNC_DECL T extractRealComponent(tquat< T, P > const &q)
Extract the real component of a quaternion.
GLM_FUNC_DECL tmat3x3< T, P > toMat3(tquat< T, P > const &x)
Converts a quaternion to a 3 * 3 matrix.
GLM_FUNC_DECL tquat< T, P > exp(tquat< T, P > const &q)
Returns a exp of a quaternion.
GLM_FUNC_DECL tquat< T, P > fastMix(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Quaternion normalized linear interpolation.
GLM_FUNC_DECL tquat< T, P > squad(tquat< T, P > const &q1, tquat< T, P > const &q2, tquat< T, P > const &s1, tquat< T, P > const &s2, T const &h)
Compute a point on a path according squad equation.
GLM_FUNC_DECL tmat4x4< T, P > toMat4(tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL tmat4x4< T, P > mat4_cast(tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
GLM_FUNC_DECL tquat< T, P > shortMix(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Quaternion interpolation using the rotation short path.
GLM_FUNC_DECL tquat< T, P > toQuat(tmat4x4< T, P > const &x)
Converts a 4 * 4 matrix to a quaternion.
GLM_FUNC_DECL tvec3< T, P > cross(tvec3< T, P > const &v, tquat< T, P > const &q)
Compute a cross product between a vector and a quaternion.
Definition: _noise.hpp:40
GLM_FUNC_DECL tvec4< T, P > rotate(tquat< T, P > const &q, tvec4< T, P > const &v)
Rotates a 4 components vector by a quaternion.
GLM_FUNC_DECL tquat< T, P > quat_cast(tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL tquat< T, P > rotation(tvec3< T, P > const &orig, tvec3< T, P > const &dest)
Compute the rotation between two vectors.
GLM_FUNC_DECL tmat3x3< T, P > mat3_cast(tquat< T, P > const &x)
Converts a quaternion to a 3 * 3 matrix.
GLM_FUNC_DECL tquat< T, P > log(tquat< T, P > const &q)
Returns a log of a quaternion.
GLM_FUNC_DECL T length2(tquat< T, P > const &q)
Returns the squared length of x.
GLM_FUNC_DECL tquat< T, P > pow(tquat< T, P > const &x, T const &y)
Returns x raised to the y power.