20 #include "../gtc/constants.hpp"
21 #include "../gtc/quaternion.hpp"
23 #ifndef GLM_ENABLE_EXPERIMENTAL
24 # error "GLM: GLM_GTX_dual_quaternion is an experimetal extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
27 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
28 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
36 template <
typename T, precision P = defaultp>
42 typedef glm::tquat<T, P> part_type;
46 glm::tquat<T, P> real, dual;
50 typedef length_t length_type;
52 GLM_FUNC_DECL
static length_type
length(){
return 2;}
54 GLM_FUNC_DECL part_type & operator[](length_type i);
55 GLM_FUNC_DECL part_type
const & operator[](length_type i)
const;
59 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR;
60 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
61 template <precision Q>
62 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d);
66 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tdualquat(ctor);
67 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real);
68 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const &
orientation, tvec3<T, P> const & translation);
69 GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
73 template <typename U, precision Q>
74 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
76 GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat);
77 GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat);
81 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m) GLM_DEFAULT;
84 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<U, P> const & m);
86 GLM_FUNC_DECL tdualquat<T, P> & operator*=(U s);
88 GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
93 template <typename T, precision P>
94 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q);
96 template <typename T, precision P>
97 GLM_FUNC_DECL tdualquat<T, P> operator-(tdualquat<T, P> const & q);
101 template <typename T, precision P>
102 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
104 template <typename T, precision P>
105 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
107 template <typename T, precision P>
108 GLM_FUNC_DECL tvec3<T, P> operator*(tdualquat<T, P> const & q, tvec3<T, P> const & v);
110 template <typename T, precision P>
111 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tdualquat<T, P> const & q);
113 template <typename T, precision P>
114 GLM_FUNC_DECL tvec4<T, P> operator*(tdualquat<T, P> const & q, tvec4<T, P> const & v);
116 template <typename T, precision P>
117 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tdualquat<T, P> const & q);
119 template <typename T, precision P>
120 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, T const & s);
122 template <typename T, precision P>
123 GLM_FUNC_DECL tdualquat<T, P> operator*(T const & s, tdualquat<T, P> const & q);
125 template <typename T, precision P>
126 GLM_FUNC_DECL tdualquat<T, P> operator/(tdualquat<T, P> const & q, T const & s);
130 template <typename T, precision P>
131 GLM_FUNC_DECL
bool operator==(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
133 template <typename T, precision P>
134 GLM_FUNC_DECL
bool operator!=(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
139 template <typename T, precision P>
140 GLM_FUNC_DECL tdualquat<T, P>
normalize(tdualquat<T, P> const & q);
145 template <typename T, precision P>
146 GLM_FUNC_DECL tdualquat<T, P>
lerp(tdualquat<T, P> const & x, tdualquat<T, P> const & y, T const & a);
151 template <typename T, precision P>
152 GLM_FUNC_DECL tdualquat<T, P>
inverse(tdualquat<T, P> const & q);
157 template <typename T, precision P>
158 GLM_FUNC_DECL tmat2x4<T, P>
mat2x4_cast(tdualquat<T, P> const & x);
163 template <typename T, precision P>
164 GLM_FUNC_DECL tmat3x4<T, P>
mat3x4_cast(tdualquat<T, P> const & x);
169 template <typename T, precision P>
170 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat2x4<T, P> const & x);
175 template <typename T, precision P>
176 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat3x4<T, P> const & x);
227 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
237 #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
240 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
243 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
247 # error "GLM error: multiple default precision requested for single-precision floating-point types"
251 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
256 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
258 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
260 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
263 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
269 #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.
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.
tdualquat< double, mediump > mediump_ddualquat
Dual-quaternion of medium double-precision floating-point numbers.
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.
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
tdualquat< double, lowp > lowp_ddualquat
Dual-quaternion of low double-precision floating-point numbers.
highp_ddualquat ddualquat
Dual-quaternion of default double-precision floating-point numbers.
highp_fdualquat dualquat
Dual-quaternion of floating-point numbers.
tdualquat< float, highp > highp_fdualquat
Dual-quaternion of high single-precision floating-point numbers.
tdualquat< float, mediump > mediump_dualquat
Dual-quaternion of medium 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 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.
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.
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.