| 0.9.9 API documenation

gtx/quaternion.hpp
Go to the documentation of this file.
1
14 #pragma once
15
16 // Dependency:
17 #include "../glm.hpp"
18 #include "../gtc/constants.hpp"
19 #include "../gtc/quaternion.hpp"
20 #include "../ext/quaternion_exponential.hpp"
21 #include "../gtx/norm.hpp"
22
23 #ifndef GLM_ENABLE_EXPERIMENTAL
24 # error "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."
25 #endif
26
27 #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
28 # pragma message("GLM: GLM_GTX_quaternion extension included")
29 #endif
30
31 namespace glm
32 {
35
39 template<typename T, qualifier Q>
40 GLM_FUNC_DECL qua<T, Q> quat_identity();
41
45 template<typename T, qualifier Q>
46 GLM_FUNC_DECL vec<3, T, Q> cross(
47 qua<T, Q> const& q,
48 vec<3, T, Q> const& v);
49
53 template<typename T, qualifier Q>
54 GLM_FUNC_DECL vec<3, T, Q> cross(
55 vec<3, T, Q> const& v,
56 qua<T, Q> const& q);
57
62 template<typename T, qualifier Q>
63 GLM_FUNC_DECL qua<T, Q> squad(
64 qua<T, Q> const& q1,
65 qua<T, Q> const& q2,
66 qua<T, Q> const& s1,
67 qua<T, Q> const& s2,
68 T const& h);
69
73 template<typename T, qualifier Q>
74 GLM_FUNC_DECL qua<T, Q> intermediate(
75 qua<T, Q> const& prev,
76 qua<T, Q> const& curr,
77 qua<T, Q> const& next);
78
82 //template<typename T, qualifier Q>
83 //qua<T, Q> sqrt(
84 // qua<T, Q> const& q);
85
89 template<typename T, qualifier Q>
90 GLM_FUNC_DECL vec<3, T, Q> rotate(
91 qua<T, Q> const& q,
92 vec<3, T, Q> const& v);
93
97 template<typename T, qualifier Q>
98 GLM_FUNC_DECL vec<4, T, Q> rotate(
99 qua<T, Q> const& q,
100 vec<4, T, Q> const& v);
101
105 template<typename T, qualifier Q>
106 GLM_FUNC_DECL T extractRealComponent(
107 qua<T, Q> const& q);
108
112 template<typename T, qualifier Q>
113 GLM_FUNC_DECL mat<3, 3, T, Q> toMat3(
114 qua<T, Q> const& x){return mat3_cast(x);}
115
119 template<typename T, qualifier Q>
120 GLM_FUNC_DECL mat<4, 4, T, Q> toMat4(
121 qua<T, Q> const& x){return mat4_cast(x);}
122
126 template<typename T, qualifier Q>
127 GLM_FUNC_DECL qua<T, Q> toQuat(
128 mat<3, 3, T, Q> const& x){return quat_cast(x);}
129
133 template<typename T, qualifier Q>
134 GLM_FUNC_DECL qua<T, Q> toQuat(
135 mat<4, 4, T, Q> const& x){return quat_cast(x);}
136
140 template<typename T, qualifier Q>
141 GLM_FUNC_DECL qua<T, Q> shortMix(
142 qua<T, Q> const& x,
143 qua<T, Q> const& y,
144 T const& a);
145
149 template<typename T, qualifier Q>
150 GLM_FUNC_DECL qua<T, Q> fastMix(
151 qua<T, Q> const& x,
152 qua<T, Q> const& y,
153 T const& a);
154
160 template<typename T, qualifier Q>
161 GLM_FUNC_DECL qua<T, Q> rotation(
162 vec<3, T, Q> const& orig,
163 vec<3, T, Q> const& dest);
164
168 template<typename T, qualifier Q>
169 GLM_FUNC_DECL T length2(qua<T, Q> const& q);
170
172 }//namespace glm
173
174 #include "quaternion.inl"
glm::length2
GLM_FUNC_DECL T length2(qua< T, Q > const &q)
Returns the squared length of x.
glm::quat_cast
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::quat_identity
GLM_FUNC_DECL qua< T, Q > quat_identity()
Create an identity quaternion.
glm
Definition: common.hpp:18
glm::fastMix
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::rotate
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::shortMix
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::toQuat
GLM_FUNC_DECL qua< T, Q > toQuat(mat< 4, 4, T, Q > const &x)
Converts a 4 * 4 matrix to a quaternion.
Definition: gtx/quaternion.hpp:134
glm::toMat3
GLM_FUNC_DECL mat< 3, 3, T, Q > toMat3(qua< T, Q > const &x)
Converts a quaternion to a 3 * 3 matrix.
Definition: gtx/quaternion.hpp:113
glm::intermediate
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::cross
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::mat3_cast
GLM_FUNC_DECL mat< 3, 3, T, Q > mat3_cast(qua< T, Q > const &x)
Converts a quaternion to a 3 * 3 matrix.
glm::extractRealComponent
GLM_FUNC_DECL T extractRealComponent(qua< T, Q > const &q)
Extract the real component of a quaternion.
glm::squad
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::rotation
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::toMat4
GLM_FUNC_DECL mat< 4, 4, T, Q > toMat4(qua< T, Q > const &x)
Converts a quaternion to a 4 * 4 matrix.
Definition: gtx/quaternion.hpp:120
glm::mat4_cast
GLM_FUNC_DECL mat< 4, 4, T, Q > mat4_cast(qua< T, Q > const &x)
Converts a quaternion to a 4 * 4 matrix.