49 #include "../gtc/constants.hpp"
50 #include "../gtc/quaternion.hpp"
52 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
53 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
61 template <
typename T, precision P = defaultp>
67 typedef glm::tquat<T, P> part_type;
69 # ifdef GLM_META_PROG_HELPERS
70 static GLM_RELAXED_CONSTEXPR length_t components = 2;
71 static GLM_RELAXED_CONSTEXPR precision prec = P;
72 # endif//GLM_META_PROG_HELPERS
76 glm::tquat<T, P> real, dual;
80 # ifdef GLM_FORCE_SIZE_FUNC
81 typedef size_t size_type;
83 GLM_FUNC_DECL GLM_CONSTEXPR size_type size()
const;
85 GLM_FUNC_DECL part_type & operator[](size_type i);
86 GLM_FUNC_DECL part_type
const & operator[](size_type i)
const;
88 typedef length_t length_type;
90 GLM_FUNC_DECL GLM_CONSTEXPR length_type
length()
const;
92 GLM_FUNC_DECL part_type & operator[](length_type i);
93 GLM_FUNC_DECL part_type
const & operator[](length_type i)
const;
94 # endif//GLM_FORCE_SIZE_FUNC
98 GLM_FUNC_DECL tdualquat() GLM_DEFAULT_CTOR;
99 GLM_FUNC_DECL tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
100 template <precision Q>
101 GLM_FUNC_DECL tdualquat(tdualquat<T, Q> const & d);
105 GLM_FUNC_DECL explicit tdualquat(ctor);
106 GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real);
107 GLM_FUNC_DECL tdualquat(tquat<T, P> const &
orientation, tvec3<T, P> const & translation);
108 GLM_FUNC_DECL tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
112 template <typename U, precision Q>
113 GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
115 GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
116 GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
120 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m) GLM_DEFAULT;
122 template <typename U>
123 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<U, P> const & m);
124 template <typename U>
125 GLM_FUNC_DECL tdualquat<T, P> & operator*=(U s);
126 template <typename U>
127 GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
132 template <typename T, precision P>
133 GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const & q);
137 template <typename T, precision P>
138 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
140 template <typename T, precision P>
141 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
143 template <typename T, precision P>
144 GLM_FUNC_DECL tvec3<T, P> operator*(tquat<T, P> const & q, tvec3<T, P> const & v);
146 template <typename T, precision P>
147 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tquat<T, P> const & q);
149 template <typename T, precision P>
150 GLM_FUNC_DECL tvec4<T, P> operator*(tquat<T, P> const & q, tvec4<T, P> const & v);
152 template <typename T, precision P>
153 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tquat<T, P> const & q);
155 template <typename T, precision P>
156 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, T const & s);
158 template <typename T, precision P>
159 GLM_FUNC_DECL tdualquat<T, P> operator*(T const & s, tdualquat<T, P> const & q);
161 template <typename T, precision P>
162 GLM_FUNC_DECL tdualquat<T, P> operator/(tdualquat<T, P> const & q, T const & s);
167 template <typename T, precision P>
168 GLM_FUNC_DECL tdualquat<T, P>
normalize(tdualquat<T, P> const & q);
173 template <typename T, precision P>
174 GLM_FUNC_DECL tdualquat<T, P>
lerp(tdualquat<T, P> const & x, tdualquat<T, P> const & y, T const & a);
179 template <typename T, precision P>
180 GLM_FUNC_DECL tdualquat<T, P>
inverse(tdualquat<T, P> const & q);
185 template <typename T, precision P>
186 GLM_FUNC_DECL tmat2x4<T, P>
mat2x4_cast(tdualquat<T, P> const & x);
191 template <typename T, precision P>
192 GLM_FUNC_DECL tmat3x4<T, P>
mat3x4_cast(tdualquat<T, P> const & x);
197 template <typename T, precision P>
198 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat2x4<T, P> const & x);
203 template <typename T, precision P>
204 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat3x4<T, P> const & x);
255 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
265 #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
268 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
271 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
275 # error "GLM error: multiple default precision requested for single-precision floating-point types"
279 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
284 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
286 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
288 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
291 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
297 #include "dual_quaternion.inl"
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.
tdualquat< double, lowp > lowp_ddualquat
Dual-quaternion of low double-precision floating-point numbers.
GLM_FUNC_DECL tdualquat< T, P > normalize(tdualquat< T, P > const &q)
Returns the normalized quaternion.
tdualquat< float, highp > highp_dualquat
Dual-quaternion of high single-precision floating-point numbers.
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, mediump > mediump_fdualquat
Dual-quaternion of medium single-precision floating-point numbers.
highp_fdualquat fdualquat
Dual-quaternion of single-precision floating-point numbers.
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
tdualquat< float, lowp > lowp_dualquat
Dual-quaternion of low single-precision floating-point numbers.
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 tmat2x4< T, P > mat2x4_cast(tdualquat< T, P > const &x)
Converts a quaternion to a 2 * 4 matrix.
highp_ddualquat ddualquat
Dual-quaternion of default double-precision floating-point numbers.
tdualquat< double, highp > highp_ddualquat
Dual-quaternion of high double-precision floating-point numbers.
tdualquat< float, highp > highp_fdualquat
Dual-quaternion of high single-precision floating-point numbers.
GLM_FUNC_DECL tdualquat< T, P > inverse(tdualquat< T, P > const &q)
Returns the q inverse.
tdualquat< float, mediump > mediump_dualquat
Dual-quaternion of medium single-precision floating-point numbers.
tdualquat< double, mediump > mediump_ddualquat
Dual-quaternion of medium double-precision floating-point numbers.
GLM_FUNC_DECL tmat3x4< T, P > mat3x4_cast(tdualquat< T, P > const &x)
Converts a quaternion to a 3 * 4 matrix.
tdualquat< float, lowp > lowp_fdualquat
Dual-quaternion of low single-precision floating-point numbers.
highp_fdualquat dualquat
Dual-quaternion of floating-point numbers.