41 #ifndef GLM_GTX_dual_quaternion
42 #define GLM_GTX_dual_quaternion
46 #include "../gtc/constants.hpp"
47 #include "../gtc/quaternion.hpp"
49 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
50 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
56 template <
typename T, precision P>
61 typedef glm::detail::tquat<T, P> part_type;
64 glm::detail::tquat<T, P> real, dual;
66 GLM_FUNC_DECL GLM_CONSTEXPR
int length()
const;
70 explicit tdualquat(tquat<T, P>
const & real);
71 tdualquat(tquat<T, P>
const & real,tquat<T, P>
const & dual);
72 tdualquat(tquat<T, P>
const &
orientation,tvec3<T, P>
const& translation);
76 explicit tdualquat(tmat2x4<T, P>
const & holder_mat);
77 explicit tdualquat(tmat3x4<T, P>
const & aug_mat);
80 part_type & operator[](
int i);
81 part_type
const & operator[](
int i)
const;
84 tdualquat<T, P> & operator*=(T
const & s);
85 tdualquat<T, P> & operator/=(T
const & s);
88 template <
typename T, precision P>
89 detail::tquat<T, P> operator- (
90 detail::tquat<T, P>
const & q);
92 template <
typename T, precision P>
93 detail::tdualquat<T, P> operator+ (
94 detail::tdualquat<T, P>
const & q,
95 detail::tdualquat<T, P>
const & p);
97 template <
typename T, precision P>
98 detail::tdualquat<T, P> operator* (
99 detail::tdualquat<T, P>
const & q,
100 detail::tdualquat<T, P>
const & p);
102 template <
typename T, precision P>
103 detail::tvec3<T, P> operator* (
104 detail::tquat<T, P>
const & q,
105 detail::tvec3<T, P>
const & v);
107 template <
typename T, precision P>
108 detail::tvec3<T, P> operator* (
109 detail::tvec3<T, P>
const & v,
110 detail::tquat<T, P>
const & q);
112 template <
typename T, precision P>
113 detail::tvec4<T, P> operator* (
114 detail::tquat<T, P>
const & q,
115 detail::tvec4<T, P>
const & v);
117 template <
typename T, precision P>
118 detail::tvec4<T, P> operator* (
119 detail::tvec4<T, P>
const & v,
120 detail::tquat<T, P>
const & q);
122 template <
typename T, precision P>
123 detail::tdualquat<T, P> operator* (
124 detail::tdualquat<T, P>
const & q,
127 template <
typename T, precision P>
128 detail::tdualquat<T, P> operator* (
130 detail::tdualquat<T, P>
const & q);
132 template <
typename T, precision P>
133 detail::tdualquat<T, P> operator/ (
134 detail::tdualquat<T, P>
const & q,
144 template <
typename T, precision P>
146 detail::tdualquat<T, P>
const & q);
151 template <
typename T, precision P>
152 detail::tdualquat<T, P>
lerp(
153 detail::tdualquat<T, P>
const & x,
154 detail::tdualquat<T, P>
const & y,
160 template <
typename T, precision P>
161 detail::tdualquat<T, P>
inverse(
162 detail::tdualquat<T, P>
const & q);
177 template <
typename T, precision P>
179 detail::tdualquat<T, P>
const & x);
184 template <
typename T, precision P>
186 detail::tdualquat<T, P>
const & x);
191 template <
typename T, precision P>
193 detail::tmat2x4<T, P>
const & x);
198 template <
typename T, precision P>
200 detail::tmat3x4<T, P>
const & x);
251 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
261 #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
264 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
267 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
271 # error "GLM error: multiple default precision requested for single-precision floating-point types"
275 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
280 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
282 #elif(!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))
287 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
293 #include "dual_quaternion.inl"
295 #endif//GLM_GTX_dual_quaternion
detail::tdualquat< float, highp > highp_dualquat
Dual-quaternion of high single-precision floating-point numbers.
GLM_FUNC_DECL detail::tquat< T, P > lerp(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
Linear interpolation of two quaternions.
detail::tmat3x4< T, P > mat3x4_cast(detail::tdualquat< T, P > const &x)
Converts a quaternion to a 3 * 4 matrix.
detail::tdualquat< double, highp > highp_ddualquat
Dual-quaternion of high double-precision floating-point numbers.
highp_fdualquat fdualquat
Dual-quaternion of single-precision floating-point numbers.
detail::tdualquat< double, lowp > lowp_ddualquat
Dual-quaternion of low double-precision floating-point numbers.
detail::tmat4x4< T, P > orientation(detail::tvec3< T, P > const &Normal, detail::tvec3< T, P > const &Up)
Build a rotation matrix from a normal and a up vector.
GLM_FUNC_DECL genType normalize(genType const &x)
Returns a vector in the same direction as x but with length of 1.
detail::tdualquat< double, mediump > mediump_ddualquat
Dual-quaternion of medium double-precision floating-point numbers.
detail::tdualquat< float, lowp > lowp_dualquat
Dual-quaternion of low single-precision floating-point numbers.
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
detail::tdualquat< T, P > dualquat_cast(detail::tmat2x4< T, P > const &x)
Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion. ...
highp_ddualquat ddualquat
Dual-quaternion of default double-precision floating-point numbers.
detail::tmat2x4< T, P > mat2x4_cast(detail::tdualquat< T, P > const &x)
Converts a quaternion to a 2 * 4 matrix.
detail::tdualquat< float, mediump > mediump_fdualquat
Dual-quaternion of medium single-precision floating-point numbers.
detail::tdualquat< float, lowp > lowp_fdualquat
Dual-quaternion of low single-precision floating-point numbers.
detail::tdualquat< float, highp > highp_fdualquat
Dual-quaternion of high single-precision floating-point numbers.
detail::tdualquat< float, mediump > mediump_dualquat
Dual-quaternion of medium single-precision floating-point numbers.
highp_fdualquat dualquat
Dual-quaternion of floating-point numbers.
GLM_FUNC_DECL detail::tquat< T, P > inverse(detail::tquat< T, P > const &q)
Returns the q inverse.