3rdparty/glm/doc/api/a00019_source.html
| | 0.9.8 |
dual_quaternion.hpp
Go to the documentation of this file.
1
17 #pragma once
18
19 // Dependency:
20 #include "../glm.hpp"
21 #include "../gtc/constants.hpp"
22 #include "../gtc/quaternion.hpp"
23
24 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
25 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
26 #endif
27
28 namespace glm
29 {
32
33template <typename T, precision P = defaultp>
34struct tdualquat
35 {
36// -- Implementation detail --
37
38typedef T value_type;
39typedef glm::tquat<T, P> part_type;
40
41// -- Data --
42
43 glm::tquat<T, P> real, dual;
44
45// -- Component accesses --
46
47typedef length_t length_type;
49 GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
50
51 GLM_FUNC_DECL part_type & operator[](length_type i);
52 GLM_FUNC_DECL part_type const & operator[](length_type i) const;
53
54// -- Implicit basic constructors --
55
56 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR;
57 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
58 template <precision Q>
59 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d);
60
61// -- Explicit basic constructors --
62
63 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tdualquat(ctor);
64 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real);
65 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation);
66 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
67
68// -- Conversion constructors --
69
70 template <typename U, precision Q>
71 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
72
73 GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat);
74 GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat);
75
76// -- Unary arithmetic operators --
77
78 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m) GLM_DEFAULT;
79
80 template <typename U>
81 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<U, P> const & m);
82 template <typename U>
83 GLM_FUNC_DECL tdualquat<T, P> & operator*=(U s);
84 template <typename U>
85 GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
86 };
87
88// -- Unary bit operators --
89
90 template <typename T, precision P>
91 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q);
92
93 template <typename T, precision P>
94 GLM_FUNC_DECL tdualquat<T, P> operator-(tdualquat<T, P> const & q);
95
96// -- Binary operators --
97
98 template <typename T, precision P>
99 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
100
101 template <typename T, precision P>
102 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
103
104 template <typename T, precision P>
105 GLM_FUNC_DECL tvec3<T, P> operator*(tdualquat<T, P> const & q, tvec3<T, P> const & v);
106
107 template <typename T, precision P>
108 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tdualquat<T, P> const & q);
109
110 template <typename T, precision P>
111 GLM_FUNC_DECL tvec4<T, P> operator*(tdualquat<T, P> const & q, tvec4<T, P> const & v);
112
113 template <typename T, precision P>
114 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tdualquat<T, P> const & q);
115
116 template <typename T, precision P>
117 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, T const & s);
118
119 template <typename T, precision P>
120 GLM_FUNC_DECL tdualquat<T, P> operator*(T const & s, tdualquat<T, P> const & q);
121
122 template <typename T, precision P>
123 GLM_FUNC_DECL tdualquat<T, P> operator/(tdualquat<T, P> const & q, T const & s);
124
125// -- Boolean operators --
126
127 template <typename T, precision P>
128 GLM_FUNC_DECL bool operator==(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
129
130 template <typename T, precision P>
131 GLM_FUNC_DECL bool operator!=(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
132
136 template <typename T, precision P>
137 GLM_FUNC_DECL tdualquat<T, P> normalize(tdualquat<T, P> const & q);
138
142 template <typename T, precision P>
143 GLM_FUNC_DECL tdualquat<T, P> lerp(tdualquat<T, P> const & x, tdualquat<T, P> const & y, T const & a);
144
148 template <typename T, precision P>
149 GLM_FUNC_DECL tdualquat<T, P> inverse(tdualquat<T, P> const & q);
150
154 template <typename T, precision P>
155 GLM_FUNC_DECL tmat2x4<T, P> mat2x4_cast(tdualquat<T, P> const & x);
156
160 template <typename T, precision P>
161 GLM_FUNC_DECL tmat3x4<T, P> mat3x4_cast(tdualquat<T, P> const & x);
162
166 template <typename T, precision P>
167 GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(tmat2x4<T, P> const & x);
168
172 template <typename T, precision P>
173 GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(tmat3x4<T, P> const & x);
174
175
179 typedef tdualquat<float, lowp> lowp_dualquat;
180
184 typedef tdualquat<float, mediump> mediump_dualquat;
185
189 typedef tdualquat<float, highp> highp_dualquat;
190
191
195 typedef tdualquat<float, lowp> lowp_fdualquat;
196
200 typedef tdualquat<float, mediump> mediump_fdualquat;
201
205 typedef tdualquat<float, highp> highp_fdualquat;
206
207
211 typedef tdualquat<double, lowp> lowp_ddualquat;
212
216 typedef tdualquat<double, mediump> mediump_ddualquat;
217
221 typedef tdualquat<double, highp> highp_ddualquat;
222
223
224 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
225typedef highp_fdualquat dualquat;
229
233typedef highp_fdualquat fdualquat;
234 #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
235typedef highp_fdualquat dualquat;
236typedef highp_fdualquat fdualquat;
237 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
238typedef mediump_fdualquat dualquat;
239typedef mediump_fdualquat fdualquat;
240 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
241typedef lowp_fdualquat dualquat;
242typedef lowp_fdualquat fdualquat;
243 #else
244 # error "GLM error: multiple default precision requested for single-precision floating-point types"
245 #endif
246
247
248 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
249typedef highp_ddualquat ddualquat;
253 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
254typedef highp_ddualquat ddualquat;
255 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
256typedef mediump_ddualquat ddualquat;
257 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
258typedef lowp_ddualquat ddualquat;
259 #else
260 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
261 #endif
262
264 } //namespace glm
265
266 #include "dual_quaternion.inl"
GLM_FUNC_DECL tmat4x4< T, P > orientation(tvec3< T, P > const &Normal, tvec3< T, P > const &Up)
Build a rotation matrix from a normal and a up vector.
tdualquat< float, lowp > lowp_fdualquat
Dual-quaternion of low single-precision floating-point numbers.
Definition: dual_quaternion.hpp:195
GLM_FUNC_DECL tdualquat< T, P > dualquat_cast(tmat3x4< T, P > const &x)
Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion.
highp_fdualquat fdualquat
Dual-quaternion of single-precision floating-point numbers.
Definition: dual_quaternion.hpp:233
tdualquat< double, mediump > mediump_ddualquat
Dual-quaternion of medium double-precision floating-point numbers.
Definition: dual_quaternion.hpp:216
GLM_FUNC_DECL tdualquat< T, P > normalize(tdualquat< T, P > const &q)
Returns the normalized quaternion.
tdualquat< float, mediump > mediump_fdualquat
Dual-quaternion of medium single-precision floating-point numbers.
Definition: dual_quaternion.hpp:200
Definition: _noise.hpp:11
tdualquat< double, lowp > lowp_ddualquat
Dual-quaternion of low double-precision floating-point numbers.
Definition: dual_quaternion.hpp:211
highp_ddualquat ddualquat
Dual-quaternion of default double-precision floating-point numbers.
Definition: dual_quaternion.hpp:252
highp_fdualquat dualquat
Dual-quaternion of floating-point numbers.
Definition: dual_quaternion.hpp:228
tdualquat< float, highp > highp_fdualquat
Dual-quaternion of high single-precision floating-point numbers.
Definition: dual_quaternion.hpp:205
tdualquat< float, mediump > mediump_dualquat
Dual-quaternion of medium single-precision floating-point numbers.
Definition: dual_quaternion.hpp:184
GLM_FUNC_DECL tdualquat< T, P > lerp(tdualquat< T, P > const &x, tdualquat< T, P > const &y, T const &a)
Returns the linear interpolation of two dual quaternion.
GLM_FUNC_DECL tmat3x4< T, P > mat3x4_cast(tdualquat< T, P > const &x)
Converts a quaternion to a 3 * 4 matrix.
tdualquat< float, highp > highp_dualquat
Dual-quaternion of high single-precision floating-point numbers.
Definition: dual_quaternion.hpp:189
GLM_FUNC_DECL tmat2x4< T, P > mat2x4_cast(tdualquat< T, P > const &x)
Converts a quaternion to a 2 * 4 matrix.
tdualquat< float, lowp > lowp_dualquat
Dual-quaternion of low single-precision floating-point numbers.
Definition: dual_quaternion.hpp:179
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
GLM_FUNC_DECL tdualquat< T, P > inverse(tdualquat< T, P > const &q)
Returns the q inverse.
tdualquat< double, highp > highp_ddualquat
Dual-quaternion of high double-precision floating-point numbers.
Definition: dual_quaternion.hpp:221
Generated by 1.8.10