21 #include "../gtc/constants.hpp"
22 #include "../gtc/quaternion.hpp"
24 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
25 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
33 template <
typename T, precision P = defaultp>
39 typedef glm::tquat<T, P> part_type;
43 glm::tquat<T, P> real, dual;
47 typedef length_t length_type;
49 GLM_FUNC_DECL GLM_CONSTEXPR length_type
length()
const;
51 GLM_FUNC_DECL part_type & operator[](length_type i);
52 GLM_FUNC_DECL part_type
const & operator[](length_type i)
const;
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);
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);
70 template <typename U, precision Q>
71 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
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);
78 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m) GLM_DEFAULT;
81 GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<U, P> const & m);
83 GLM_FUNC_DECL tdualquat<T, P> & operator*=(U s);
85 GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
90 template <typename T, precision P>
91 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q);
93 template <typename T, precision P>
94 GLM_FUNC_DECL tdualquat<T, P> operator-(tdualquat<T, P> const & q);
98 template <typename T, precision P>
99 GLM_FUNC_DECL tdualquat<T, P> operator+(tdualquat<T, P> const & q, tdualquat<T, P> const & p);
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 tvec3<T, P> operator*(tdualquat<T, P> const & q, tvec3<T, P> const & v);
107 template <typename T, precision P>
108 GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tdualquat<T, P> const & q);
110 template <typename T, precision P>
111 GLM_FUNC_DECL tvec4<T, P> operator*(tdualquat<T, P> const & q, tvec4<T, P> const & v);
113 template <typename T, precision P>
114 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tdualquat<T, P> const & q);
116 template <typename T, precision P>
117 GLM_FUNC_DECL tdualquat<T, P> operator*(tdualquat<T, P> const & q, T const & s);
119 template <typename T, precision P>
120 GLM_FUNC_DECL tdualquat<T, P> operator*(T const & s, tdualquat<T, P> const & q);
122 template <typename T, precision P>
123 GLM_FUNC_DECL tdualquat<T, P> operator/(tdualquat<T, P> const & q, T const & s);
127 template <typename T, precision P>
128 GLM_FUNC_DECL
bool operator==(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
130 template <typename T, precision P>
131 GLM_FUNC_DECL
bool operator!=(tdualquat<T, P> const & q1, tdualquat<T, P> const & q2);
136 template <typename T, precision P>
137 GLM_FUNC_DECL tdualquat<T, P>
normalize(tdualquat<T, P> const & q);
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);
148 template <typename T, precision P>
149 GLM_FUNC_DECL tdualquat<T, P>
inverse(tdualquat<T, P> const & q);
154 template <typename T, precision P>
155 GLM_FUNC_DECL tmat2x4<T, P>
mat2x4_cast(tdualquat<T, P> const & x);
160 template <typename T, precision P>
161 GLM_FUNC_DECL tmat3x4<T, P>
mat3x4_cast(tdualquat<T, P> const & x);
166 template <typename T, precision P>
167 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat2x4<T, P> const & x);
172 template <typename T, precision P>
173 GLM_FUNC_DECL tdualquat<T, P>
dualquat_cast(tmat3x4<T, P> const & x);
224 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
234 #elif(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))
244 # error "GLM error: multiple default precision requested for single-precision floating-point types"
248 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
253 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
255 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
257 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
260 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
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.
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.
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 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.