From ceda802936c0ded0de443e1f6a1553bc110ce542 Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 15 Nov 2024 16:41:37 +0100 Subject: [PATCH] feat: added exact equality check to equals approximate --- src/math/vector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math/vector.cpp b/src/math/vector.cpp index ded2d7d..6566de2 100644 --- a/src/math/vector.cpp +++ b/src/math/vector.cpp @@ -41,7 +41,7 @@ float Vecf::distance(Vecf const &from, Vecf const &to) { } bool Vecf::equals_approximate(Vecf const &lhs, Vecf const &rhs) { - return std::fabs(lhs.x - rhs.x) < VECTOR_EPSILON && std::fabs(lhs.y - rhs.y) < VECTOR_EPSILON; + return lhs == rhs || (std::fabs(lhs.x - rhs.x) < VECTOR_EPSILON && std::fabs(lhs.y - rhs.y) < VECTOR_EPSILON); } float Vecf::dot(Vecf const &lhs, Vecf const &rhs) {