diff --git a/glm/gtc/epsilon.hpp b/glm/gtc/epsilon.hpp index b113848c..29544235 100644 --- a/glm/gtc/epsilon.hpp +++ b/glm/gtc/epsilon.hpp @@ -57,7 +57,7 @@ namespace glm /// Returns the component-wise compare of |x - y| < epsilon. /// @see gtc_epsilon template - bool equalEpsilon( + bool epsilonEqual( genTypeT const & x, genTypeT const & y, genTypeU const & epsilon); @@ -65,7 +65,7 @@ namespace glm /// Returns the component-wise compare of |x - y| >= epsilon. /// @see gtc_epsilon template - bool notEqualEpsilon( + bool epsilonNotEqual( genTypeT const & x, genTypeT const & y, genTypeU const & epsilon); diff --git a/glm/gtc/epsilon.inl b/glm/gtc/epsilon.inl index 175eef1a..b4d15905 100644 --- a/glm/gtc/epsilon.inl +++ b/glm/gtc/epsilon.inl @@ -29,7 +29,7 @@ namespace glm { template - GLM_FUNC_QUALIFIER bool equalEpsilon + GLM_FUNC_QUALIFIER bool epsilonEqual ( genType const & x, genType const & y, @@ -40,7 +40,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER bool notEqualEpsilon + GLM_FUNC_QUALIFIER bool epsilonNotEqual ( genType const & x, genType const & y, @@ -51,7 +51,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec2 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec2 epsilonEqual ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -63,7 +63,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec3 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec3 epsilonEqual ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -76,7 +76,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonEqual ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -91,7 +91,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec2 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec2 epsilonNotEqual ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -104,7 +104,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec3 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec3 epsilonNotEqual ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -118,7 +118,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonNotEqual ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -133,7 +133,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec2 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec2 epsilonEqual ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -146,7 +146,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec3 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec3 epsilonEqual ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -160,7 +160,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonEqual ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -175,7 +175,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 equalEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonEqual ( detail::tquat const & x, detail::tquat const & y, @@ -190,7 +190,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec2 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec2 epsilonNotEqual ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -203,7 +203,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec3 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec3 epsilonNotEqual ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -217,7 +217,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonNotEqual ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -232,7 +232,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER detail::tvec4 notEqualEpsilon + GLM_FUNC_QUALIFIER detail::tvec4 epsilonNotEqual ( detail::tquat const & x, detail::tquat const & y, diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl index 9e12bd4c..183f1c7f 100644 --- a/glm/gtx/vector_angle.inl +++ b/glm/gtx/vector_angle.inl @@ -33,7 +33,7 @@ namespace glm valType const Angle(glm::degrees(acos(dot(x, y)))); #endif detail::tvec2 const TransformedVector(glm::rotate(x, Angle)); - if(all(equalEpsilon(y, TransformedVector, valType(0.01)))) + if(all(epsilonEqual(y, TransformedVector, valType(0.01)))) return Angle; else return -Angle; diff --git a/readme.txt b/readme.txt index 25a9eebe..bd438cc2 100644 --- a/readme.txt +++ b/readme.txt @@ -34,12 +34,12 @@ GLM is a header only library, there is nothing to build, just include it. #include More informations in GLM manual: -http://glm.g-truc.net/glm-0.9.3.pdf +http://glm.g-truc.net/glm-0.9.4.pdf ================================================================================ -GLM 0.9.4.0: 2012-10-13 +GLM 0.9.4.0: 2012-11-07 -------------------------------------------------------------------------------- -- Added Intel Composer support +- Added Intel Composer Compiler support - Promoted GTC_espilon extension - Promoted GTC_ulp extension - Removed GLM website from the source repository diff --git a/test/gtc/gtc_constants.cpp b/test/gtc/gtc_constants.cpp index db06b04a..3120aef4 100644 --- a/test/gtc/gtc_constants.cpp +++ b/test/gtc/gtc_constants.cpp @@ -14,7 +14,7 @@ int main() { int Error(0); - + return Error; } diff --git a/test/gtc/gtc_epsilon.cpp b/test/gtc/gtc_epsilon.cpp index 8948c0a6..2c3001b3 100644 --- a/test/gtc/gtc_epsilon.cpp +++ b/test/gtc/gtc_epsilon.cpp @@ -8,13 +8,55 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include +#include #include +#include + +template +int test_equal() +{ + int Error(0); + + { + T A = glm::epsilon(); + T B = glm::epsilon(); + Error += glm::epsilonEqual(A, B, glm::epsilon()) ? 0 : 1; + } + + { + T A(0); + T B = T(0) + glm::epsilon(); + Error += glm::epsilonEqual(A, B, glm::epsilon()) ? 0 : 1; + } + + { + T A(0); + T B = T(0) - glm::epsilon(); + Error += glm::epsilonEqual(A, B, glm::epsilon()) ? 0 : 1; + } + + { + T A = T(0) + glm::epsilon(); + T B = T(0); + Error += glm::epsilonEqual(A, B, glm::epsilon()) ? 0 : 1; + } + + { + T A = T(0) - glm::epsilon(); + T B = T(0); + Error += glm::epsilonEqual(A, B, glm::epsilon()) ? 0 : 1; + } + + return Error; +} int main() { int Error(0); - + Error += test_equal(); + Error += test_equal(); + Error += test_equal(); return Error; } diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index 6a2b3619..f4ae8070 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -20,10 +20,10 @@ int test_quat_fastMix() glm::quat C = glm::fastMix(A, B, 0.5f); glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1)); - Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.z, D.z, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.w, D.w, 0.01f) ? 0 : 1; return Error; } @@ -37,10 +37,10 @@ int test_quat_shortMix() glm::quat C = glm::shortMix(A, B, 0.5f); glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1)); - Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1; - Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.x, D.x, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.y, D.y, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.z, D.z, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(C.w, D.w, 0.01f) ? 0 : 1; return Error; } diff --git a/test/gtx/gtx_vector_angle.cpp b/test/gtx/gtx_vector_angle.cpp index 6d578520..30192367 100644 --- a/test/gtx/gtx_vector_angle.cpp +++ b/test/gtx/gtx_vector_angle.cpp @@ -17,11 +17,11 @@ int test_angle() int Error = 0; float AngleA = glm::angle(glm::vec2(1, 0), glm::normalize(glm::vec2(1, 1))); - Error += glm::equalEpsilon(AngleA, 45.f, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(AngleA, 45.f, 0.01f) ? 0 : 1; float AngleB = glm::angle(glm::vec3(1, 0, 0), glm::normalize(glm::vec3(1, 1, 0))); - Error += glm::equalEpsilon(AngleB, 45.f, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(AngleB, 45.f, 0.01f) ? 0 : 1; float AngleC = glm::angle(glm::vec4(1, 0, 0, 0), glm::normalize(glm::vec4(1, 1, 0, 0))); - Error += glm::equalEpsilon(AngleC, 45.f, 0.01f) ? 0 : 1; + Error += glm::epsilonEqual(AngleC, 45.f, 0.01f) ? 0 : 1; return Error; }