From 8f184a87fbd630da45b6708ee0fcfcb8372fdef1 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 13 May 2024 22:35:43 +0800 Subject: [PATCH] update IsNearlyEqual/IsNearlyZero --- inc/hgl/math/Vector.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inc/hgl/math/Vector.h b/inc/hgl/math/Vector.h index ca62e4b..baf41fa 100644 --- a/inc/hgl/math/Vector.h +++ b/inc/hgl/math/Vector.h @@ -379,14 +379,14 @@ namespace hgl } template - const bool IsNearlyZero(const glm::vec<2,T,Q> &v) + inline const bool IsNearlyZero(const glm::vec<2,T,Q> &v) { return IsNearlyZero(v.x) &&IsNearlyZero(v.y); } template - const bool IsNearlyZero(const glm::vec<3,T,Q> &v) + inline const bool IsNearlyZero(const glm::vec<3,T,Q> &v) { return IsNearlyZero(v.x) &&IsNearlyZero(v.y) @@ -394,18 +394,18 @@ namespace hgl } template - const bool IsNearlyEqual(const glm::vec<2,T,Q> &a,const glm::vec<2,T,Q> &b) + inline const bool IsNearlyEqual(const glm::vec<2,T,Q> &a,const glm::vec<2,T,Q> &b) { - return IsNearlyZero(a.x-b.x) - &&IsNearlyZero(a.y-b.y); + return IsNearlyEqual(a.x,b.x) + &&IsNearlyEqual(a.y,b.y); } template - const bool IsNearlyEqual(const glm::vec<3,T,Q> &a,const glm::vec<3,T,Q> &b) + inline const bool IsNearlyEqual(const glm::vec<3,T,Q> &a,const glm::vec<3,T,Q> &b) { - return IsNearlyZero(a.x-b.x) - &&IsNearlyZero(a.y-b.y) - &&IsNearlyZero(a.z-b.z); + return IsNearlyEqual(a.x,b.x) + &&IsNearlyEqual(a.y,b.y) + &&IsNearlyEqual(a.z,b.z); } }//namespace hgl #endif//HGL_ALGORITHM_MATH_VECTOR_INCLUDE