Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2012 14:03
Show Gist options
  • Save anonymous/4078772 to your computer and use it in GitHub Desktop.
Save anonymous/4078772 to your computer and use it in GitHub Desktop.
Added new versions of glm::equalEpsilon and glm::notEqualEpsilon for glm::quat.
From d556ba797f8ce23fdd5052d446f6c142878fac7f Mon Sep 17 00:00:00 2001
From: jimvonmoon <jim@jim.com>
Date: Thu, 15 Nov 2012 14:51:50 +0100
Subject: [PATCH] Added new versions of glm::equalEpsilon and
glm::notEqualEpsilon for glm::quat.
---
glm/gtx/epsilon.inl | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/glm/gtx/epsilon.inl b/glm/gtx/epsilon.inl
index 7a82f7c..ceb3bbd 100644
--- a/glm/gtx/epsilon.inl
+++ b/glm/gtx/epsilon.inl
@@ -72,6 +72,21 @@ namespace glm
}
template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
+ (
+ detail::tquat<valType> const & x,
+ detail::tquat<valType> const & y,
+ valType const & epsilon
+ )
+ {
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) < epsilon,
+ abs(x.y - y.y) < epsilon,
+ abs(x.z - y.z) < epsilon,
+ abs(x.w - y.w) < epsilon);
+ }
+
+ template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon
(
detail::tvec2<valType> const & x,
@@ -114,6 +129,21 @@ namespace glm
}
template <typename valType>
+ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
+ (
+ detail::tquat<valType> const & x,
+ detail::tquat<valType> const & y,
+ valType const & epsilon
+ )
+ {
+ return detail::tvec4<bool>(
+ abs(x.x - y.x) >= epsilon,
+ abs(x.y - y.y) >= epsilon,
+ abs(x.z - y.z) >= epsilon,
+ abs(x.w - y.w) >= epsilon);
+ }
+
+ template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> equalEpsilon
(
detail::tvec2<valType> const & x,
--
1.8.0.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment