Browse Source

Fixed lack of consistency of quat and dualquat constructors

Christophe Riccio 11 years ago
parent
commit
e6a890454d
3 changed files with 49 additions and 11 deletions
  1. 16 5
      glm/gtx/dual_quaternion.hpp
  2. 32 6
      glm/gtx/dual_quaternion.inl
  3. 1 0
      readme.txt

+ 16 - 5
glm/gtx/dual_quaternion.hpp

@@ -57,7 +57,7 @@ namespace glm
 	template <typename T, precision P>
 	template <typename T, precision P>
 	struct tdualquat
 	struct tdualquat
 	{
 	{
-		enum ctor{null};
+		enum ctor{_null};
 		typedef T value_type;
 		typedef T value_type;
 		typedef glm::tquat<T, P> part_type;
 		typedef glm::tquat<T, P> part_type;
 		
 		
@@ -72,14 +72,25 @@ namespace glm
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 		GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
 #endif//GLM_FORCE_SIZE_FUNC
 #endif//GLM_FORCE_SIZE_FUNC
 		
 		
-		// Constructors
+		//////////////////////////////////////
+		// Implicit basic constructors
+
 		GLM_FUNC_DECL tdualquat();
 		GLM_FUNC_DECL tdualquat();
+		GLM_FUNC_DECL tdualquat(tdualquat<T, P> const & d);
+		template <precision Q>
+		GLM_FUNC_DECL tdualquat(tdualquat<T, Q> const & d);
+
+		//////////////////////////////////////
+		// Explicit basic constructors
+
+		GLM_FUNC_DECL explicit tdualquat(ctor);
 		GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real);
 		GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real);
-		GLM_FUNC_DECL tdualquat(tquat<T, P> const & real,tquat<T, P> const & dual);
-		GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation,tvec3<T, P> const& translation);
-		
+		GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation);
+		GLM_FUNC_DECL tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
+
 		//////////////////////////////////////////////////////////////
 		//////////////////////////////////////////////////////////////
 		// tdualquat conversions
 		// tdualquat conversions
+
 		GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
 		GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
 		GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
 		GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
 		
 		

+ 32 - 6
glm/gtx/dual_quaternion.inl

@@ -54,20 +54,36 @@ namespace glm
 	template <typename T, precision P>
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
 	(
 	(
-		tquat<T, P> const & r
+		tdualquat<T, P> const & d,
 	) :
 	) :
-		real(r),
-		dual(tquat<T, P>(T(0), T(0), T(0), T(0)))
+		real(d.r),
+		dual(d.d)
 	{}
 	{}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
+	template <precision Q>
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
 	(
 	(
-		tquat<T, P> const & r,
-		tquat<T, P> const & d
+		tdualquat<T, Q> const & d,
+	) :
+		real(d.r),
+		dual(d.d)
+	{}
+
+	//////////////////////////////////////
+	// Explicit basic constructors
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(ctor)
+	{}
+
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
+	(
+		tquat<T, P> const & r
 	) :
 	) :
 		real(r),
 		real(r),
-		dual(d)
+		dual(tquat<T, P>(T(0), T(0), T(0), T(0)))
 	{}
 	{}
 
 
 	template <typename T, precision P>
 	template <typename T, precision P>
@@ -84,6 +100,16 @@ namespace glm
 			T(+0.5) * ( p.x*q.y - p.y*q.x + p.z*q.w))
 			T(+0.5) * ( p.x*q.y - p.y*q.x + p.z*q.w))
 	{}
 	{}
 
 
+	template <typename T, precision P>
+	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat
+	(
+		tquat<T, P> const & r,
+		tquat<T, P> const & d
+	) :
+		real(r),
+		dual(d)
+	{}
+
 	//////////////////////////////////////////////////////////////
 	//////////////////////////////////////////////////////////////
 	// tdualquat conversions
 	// tdualquat conversions
 	template <typename T, precision P>
 	template <typename T, precision P>

+ 1 - 0
readme.txt

@@ -64,6 +64,7 @@ GLM 0.9.6.0: 2014-XX-XX
 - Fixed GTX_string_cast to support for integer types #249
 - Fixed GTX_string_cast to support for integer types #249
 - Removed GLM_FORCE_CUDA, Cuda is implicitly detected
 - Removed GLM_FORCE_CUDA, Cuda is implicitly detected
 - Updated GTX_associated_min_max with vec1 support
 - 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
 GLM 0.9.5.4: 2014-06-21