00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #pragma once
00042
00043
00044 #include "../glm.hpp"
00045 #include "../gtc/constants.hpp"
00046 #include "../gtc/quaternion.hpp"
00047
00048 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
00049 # pragma message("GLM: GLM_GTX_dual_quaternion extension included")
00050 #endif
00051
00052 namespace glm{
00053 namespace detail
00054 {
00055 template <typename T, precision P>
00056 struct tdualquat
00057 {
00058 enum ctor{null};
00059 typedef T value_type;
00060 typedef glm::detail::tquat<T, P> part_type;
00061
00062 public:
00063 glm::detail::tquat<T, P> real, dual;
00064
00065 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
00066
00067
00068 GLM_FUNC_DECL tdualquat();
00069 GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real);
00070 GLM_FUNC_DECL tdualquat(tquat<T, P> const & real,tquat<T, P> const & dual);
00071 GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation,tvec3<T, P> const& translation);
00072
00074
00075 GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
00076 GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
00077
00078
00079 GLM_FUNC_DECL part_type & operator[](int i);
00080 GLM_FUNC_DECL part_type const & operator[](int i) const;
00081
00082
00083 GLM_FUNC_DECL tdualquat<T, P> & operator*=(T const & s);
00084 GLM_FUNC_DECL tdualquat<T, P> & operator/=(T const & s);
00085 };
00086
00087 template <typename T, precision P>
00088 GLM_FUNC_DECL detail::tquat<T, P> operator- (
00089 detail::tquat<T, P> const & q);
00090
00091 template <typename T, precision P>
00092 GLM_FUNC_DECL detail::tdualquat<T, P> operator+ (
00093 detail::tdualquat<T, P> const & q,
00094 detail::tdualquat<T, P> const & p);
00095
00096 template <typename T, precision P>
00097 GLM_FUNC_DECL detail::tdualquat<T, P> operator* (
00098 detail::tdualquat<T, P> const & q,
00099 detail::tdualquat<T, P> const & p);
00100
00101 template <typename T, precision P>
00102 GLM_FUNC_DECL detail::tvec3<T, P> operator* (
00103 detail::tquat<T, P> const & q,
00104 detail::tvec3<T, P> const & v);
00105
00106 template <typename T, precision P>
00107 GLM_FUNC_DECL detail::tvec3<T, P> operator* (
00108 detail::tvec3<T, P> const & v,
00109 detail::tquat<T, P> const & q);
00110
00111 template <typename T, precision P>
00112 GLM_FUNC_DECL detail::tvec4<T, P> operator* (
00113 detail::tquat<T, P> const & q,
00114 detail::tvec4<T, P> const & v);
00115
00116 template <typename T, precision P>
00117 GLM_FUNC_DECL detail::tvec4<T, P> operator* (
00118 detail::tvec4<T, P> const & v,
00119 detail::tquat<T, P> const & q);
00120
00121 template <typename T, precision P>
00122 GLM_FUNC_DECL detail::tdualquat<T, P> operator* (
00123 detail::tdualquat<T, P> const & q,
00124 T const & s);
00125
00126 template <typename T, precision P>
00127 GLM_FUNC_DECL detail::tdualquat<T, P> operator* (
00128 T const & s,
00129 detail::tdualquat<T, P> const & q);
00130
00131 template <typename T, precision P>
00132 GLM_FUNC_DECL detail::tdualquat<T, P> operator/ (
00133 detail::tdualquat<T, P> const & q,
00134 T const & s);
00135 }
00136
00139
00143 template <typename T, precision P>
00144 GLM_FUNC_DECL detail::tdualquat<T, P> normalize(
00145 detail::tdualquat<T, P> const & q);
00146
00150 template <typename T, precision P>
00151 GLM_FUNC_DECL detail::tdualquat<T, P> lerp(
00152 detail::tdualquat<T, P> const & x,
00153 detail::tdualquat<T, P> const & y,
00154 T const & a);
00155
00159 template <typename T, precision P>
00160 GLM_FUNC_DECL detail::tdualquat<T, P> inverse(
00161 detail::tdualquat<T, P> const & q);
00162
00163
00168
00169
00170
00171
00172
00176 template <typename T, precision P>
00177 GLM_FUNC_DECL detail::tmat2x4<T, P> mat2x4_cast(
00178 detail::tdualquat<T, P> const & x);
00179
00183 template <typename T, precision P>
00184 GLM_FUNC_DECL detail::tmat3x4<T, P> mat3x4_cast(
00185 detail::tdualquat<T, P> const & x);
00186
00190 template <typename T, precision P>
00191 GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast(
00192 detail::tmat2x4<T, P> const & x);
00193
00197 template <typename T, precision P>
00198 GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast(
00199 detail::tmat3x4<T, P> const & x);
00200
00201
00205 typedef detail::tdualquat<float, lowp> lowp_dualquat;
00206
00210 typedef detail::tdualquat<float, mediump> mediump_dualquat;
00211
00215 typedef detail::tdualquat<float, highp> highp_dualquat;
00216
00217
00221 typedef detail::tdualquat<float, lowp> lowp_fdualquat;
00222
00226 typedef detail::tdualquat<float, mediump> mediump_fdualquat;
00227
00231 typedef detail::tdualquat<float, highp> highp_fdualquat;
00232
00233
00237 typedef detail::tdualquat<double, lowp> lowp_ddualquat;
00238
00242 typedef detail::tdualquat<double, mediump> mediump_ddualquat;
00243
00247 typedef detail::tdualquat<double, highp> highp_ddualquat;
00248
00249
00250 #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
00251
00252
00253
00254 typedef highp_fdualquat dualquat;
00255
00259 typedef highp_fdualquat fdualquat;
00260 #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
00261 typedef highp_fdualquat dualquat;
00262 typedef highp_fdualquat fdualquat;
00263 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
00264 typedef mediump_fdualquat dualquat;
00265 typedef mediump_fdualquat fdualquat;
00266 #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
00267 typedef lowp_fdualquat dualquat;
00268 typedef lowp_fdualquat fdualquat;
00269 #else
00270 # error "GLM error: multiple default precision requested for single-precision floating-point types"
00271 #endif
00272
00273
00274 #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
00275
00276
00277
00278 typedef highp_ddualquat ddualquat;
00279 #elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
00280 typedef highp_ddualquat ddualquat;
00281 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
00282 typedef mediump_ddualquat ddualquat;
00283 #elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
00284 typedef lowp_ddualquat ddualquat;
00285 #else
00286 # error "GLM error: Multiple default precision requested for double-precision floating-point types"
00287 #endif
00288
00290 }
00291
00292 #include "dual_quaternion.inl"