From e6a890454d8d15159e3b209046f32871de73f207 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 12 Oct 2014 02:32:32 +0200 Subject: [PATCH] Fixed lack of consistency of quat and dualquat constructors --- glm/gtx/dual_quaternion.hpp | 21 +++++++++++++++----- glm/gtx/dual_quaternion.inl | 38 +++++++++++++++++++++++++++++++------ readme.txt | 1 + 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 78a812d9..bb97aad5 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -57,7 +57,7 @@ namespace glm template struct tdualquat { - enum ctor{null}; + enum ctor{_null}; typedef T value_type; typedef glm::tquat part_type; @@ -72,14 +72,25 @@ namespace glm GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; #endif//GLM_FORCE_SIZE_FUNC - // Constructors + ////////////////////////////////////// + // Implicit basic constructors + GLM_FUNC_DECL tdualquat(); + GLM_FUNC_DECL tdualquat(tdualquat const & d); + template + GLM_FUNC_DECL tdualquat(tdualquat const & d); + + ////////////////////////////////////// + // Explicit basic constructors + + GLM_FUNC_DECL explicit tdualquat(ctor); GLM_FUNC_DECL explicit tdualquat(tquat const & real); - GLM_FUNC_DECL tdualquat(tquat const & real,tquat const & dual); - GLM_FUNC_DECL tdualquat(tquat const & orientation,tvec3 const& translation); - + GLM_FUNC_DECL tdualquat(tquat const & orientation, tvec3 const & translation); + GLM_FUNC_DECL tdualquat(tquat const & real, tquat const & dual); + ////////////////////////////////////////////////////////////// // tdualquat conversions + GLM_FUNC_DECL explicit tdualquat(tmat2x4 const & holder_mat); GLM_FUNC_DECL explicit tdualquat(tmat3x4 const & aug_mat); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 7d54e064..0993269a 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -54,20 +54,36 @@ namespace glm template GLM_FUNC_QUALIFIER tdualquat::tdualquat ( - tquat const & r + tdualquat const & d, ) : - real(r), - dual(tquat(T(0), T(0), T(0), T(0))) + real(d.r), + dual(d.d) + {} + + template + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat + ( + tdualquat const & d, + ) : + real(d.r), + dual(d.d) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat(ctor) {} template GLM_FUNC_QUALIFIER tdualquat::tdualquat ( - tquat const & r, - tquat const & d + tquat const & r ) : real(r), - dual(d) + dual(tquat(T(0), T(0), T(0), T(0))) {} template @@ -84,6 +100,16 @@ namespace glm T(+0.5) * ( p.x*q.y - p.y*q.x + p.z*q.w)) {} + template + GLM_FUNC_QUALIFIER tdualquat::tdualquat + ( + tquat const & r, + tquat const & d + ) : + real(r), + dual(d) + {} + ////////////////////////////////////////////////////////////// // tdualquat conversions template diff --git a/readme.txt b/readme.txt index 3453fb3f..2c1d1d0a 100644 --- a/readme.txt +++ b/readme.txt @@ -64,6 +64,7 @@ GLM 0.9.6.0: 2014-XX-XX - Fixed GTX_string_cast to support for integer types #249 - Removed GLM_FORCE_CUDA, Cuda is implicitly detected - Updated GTX_associated_min_max with vec1 support +- Fixed lack of consistency of quat and dualquat constructors ================================================================================ GLM 0.9.5.4: 2014-06-21