Browse Source

Fixed ticket #104, dependence between GTX_epsilon and GTC_quaternion

Christophe Riccio 14 years ago
parent
commit
6c9364c2e8
2 changed files with 33 additions and 1 deletions
  1. 3 1
      glm/gtx/epsilon.hpp
  2. 30 0
      glm/gtx/epsilon.inl

+ 3 - 1
glm/gtx/epsilon.hpp

@@ -8,7 +8,8 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // Dependency:
 // - GLM core
-// - GLM_GTX_half
+// - GLM_GTC_half_float
+// - GLM_GTC_quaternion
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #ifndef glm_gtx_epsilon
@@ -17,6 +18,7 @@
 // Dependency:
 #include "../glm.hpp"
 #include "../gtc/half_float.hpp"
+#include "../gtc/quaternion.hpp"
 
 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
 #	pragma message("GLM: GLM_GTX_epsilon extension included")

+ 30 - 0
glm/gtx/epsilon.inl

@@ -157,6 +157,21 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
         abs(x.w - y.w) < epsilon.w);
 }
 
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
+(
+	detail::tquat<valType> const & x, 
+	detail::tquat<valType> const & y, 
+	detail::tquat<valType> const & epsilon
+)
+{
+    return detail::tvec4<bool>(
+        abs(x.x - y.x) < epsilon.x,
+        abs(x.y - y.y) < epsilon.y,
+        abs(x.z - y.z) < epsilon.z,
+        abs(x.w - y.w) < epsilon.w);
+}
+
 template <typename valType>
 GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon
 (
@@ -199,6 +214,21 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
         abs(x.w - y.w) >= epsilon.w);
 }
 
+template <typename valType>
+GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
+(
+	detail::tquat<valType> const & x, 
+	detail::tquat<valType> const & y, 
+	detail::tquat<valType> const & epsilon
+)
+{
+    return detail::tvec4<bool>(
+        abs(x.x - y.x) >= epsilon.x,
+        abs(x.y - y.y) >= epsilon.y,
+        abs(x.z - y.z) >= epsilon.z,
+        abs(x.w - y.w) >= epsilon.w);
+}
+
 }//namespace epsilon
 }//namespace gtx
 }//namespace glm