0.9.6
gtx/quaternion.hpp
Go to the documentation of this file.
1 
39 #pragma once
40 
41 // Dependency:
42 #include "../glm.hpp"
43 #include "../gtc/constants.hpp"
44 #include "../gtc/quaternion.hpp"
45 #include "../gtx/norm.hpp"
46 
47 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
48 # pragma message("GLM: GLM_GTX_quaternion extension included")
49 #endif
50 
51 namespace glm
52 {
55 
59  template<typename T, precision P>
60  GLM_FUNC_DECL tvec3<T, P> cross(
61  tquat<T, P> const & q,
62  tvec3<T, P> const & v);
63 
67  template<typename T, precision P>
68  GLM_FUNC_DECL tvec3<T, P> cross(
69  tvec3<T, P> const & v,
70  tquat<T, P> const & q);
71 
76  template<typename T, precision P>
77  GLM_FUNC_DECL tquat<T, P> squad(
78  tquat<T, P> const & q1,
79  tquat<T, P> const & q2,
80  tquat<T, P> const & s1,
81  tquat<T, P> const & s2,
82  T const & h);
83 
87  template<typename T, precision P>
88  GLM_FUNC_DECL tquat<T, P> intermediate(
89  tquat<T, P> const & prev,
90  tquat<T, P> const & curr,
91  tquat<T, P> const & next);
92 
96  template<typename T, precision P>
97  GLM_FUNC_DECL tquat<T, P> exp(
98  tquat<T, P> const & q);
99 
103  template<typename T, precision P>
104  GLM_FUNC_DECL tquat<T, P> log(
105  tquat<T, P> const & q);
106 
110  template<typename T, precision P>
111  GLM_FUNC_DECL tquat<T, P> pow(
112  tquat<T, P> const & x,
113  T const & y);
114 
118  //template<typename T, precision P>
119  //tquat<T, P> sqrt(
120  // tquat<T, P> const & q);
121 
125  template<typename T, precision P>
126  GLM_FUNC_DECL tvec3<T, P> rotate(
127  tquat<T, P> const & q,
128  tvec3<T, P> const & v);
129 
133  template<typename T, precision P>
134  GLM_FUNC_DECL tvec4<T, P> rotate(
135  tquat<T, P> const & q,
136  tvec4<T, P> const & v);
137 
141  template<typename T, precision P>
142  GLM_FUNC_DECL T extractRealComponent(
143  tquat<T, P> const & q);
144 
148  template<typename T, precision P>
149  GLM_FUNC_DECL tmat3x3<T, P> toMat3(
150  tquat<T, P> const & x){return mat3_cast(x);}
151 
155  template<typename T, precision P>
156  GLM_FUNC_DECL tmat4x4<T, P> toMat4(
157  tquat<T, P> const & x){return mat4_cast(x);}
158 
162  template<typename T, precision P>
163  GLM_FUNC_DECL tquat<T, P> toQuat(
164  tmat3x3<T, P> const & x){return quat_cast(x);}
165 
169  template<typename T, precision P>
170  GLM_FUNC_DECL tquat<T, P> toQuat(
171  tmat4x4<T, P> const & x){return quat_cast(x);}
172 
176  template<typename T, precision P>
177  GLM_FUNC_DECL tquat<T, P> shortMix(
178  tquat<T, P> const & x,
179  tquat<T, P> const & y,
180  T const & a);
181 
185  template<typename T, precision P>
186  GLM_FUNC_DECL tquat<T, P> fastMix(
187  tquat<T, P> const & x,
188  tquat<T, P> const & y,
189  T const & a);
190 
196  template<typename T, precision P>
197  GLM_FUNC_DECL tquat<T, P> rotation(
198  tvec3<T, P> const & orig,
199  tvec3<T, P> const & dest);
200 
204  template<typename T, precision P>
205  GLM_FUNC_DECL T length2(tquat<T, P> const & q);
206 
208 }//namespace glm
209 
210 #include "quaternion.inl"
GLM_FUNC_DECL tmat4x4< T, P > toMat4(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 tmat3x3< T, P > toMat3(tquat< T, P > const &x)
Converts a quaternion to a 3 * 3 matrix.
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 tquat< T, P > pow(tquat< T, P > const &x, T const &y)
Returns x raised to the y power.
GLM_FUNC_DECL T length2(tquat< T, P > const &q)
Returns the squared length of x.
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 tquat< T, P > toQuat(tmat4x4< T, P > const &x)
Converts a 4 * 4 matrix to a quaternion.
Definition: _noise.hpp:31
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.
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 > fastMix(tquat< T, P > const &x, tquat< T, P > const &y, T const &a)
Quaternion normalized linear interpolation.
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 > exp(tquat< T, P > const &q)
Returns a exp of a quaternion.
GLM_FUNC_DECL T extractRealComponent(tquat< T, P > const &q)
Extract the real component of a quaternion.
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 > 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 tquat< T, P > quat_cast(tmat3x3< T, P > const &x)
Converts a 3 * 3 matrix to a quaternion.
GLM_FUNC_DECL tquat< T, P > log(tquat< T, P > const &q)
Returns a log of a quaternion.