From c984afdf47ef31511024c6b70bd4b4c4e64f56a6 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 8 Jul 2023 23:30:25 +0500 Subject: Fixed some errors detected by static analysis --- src/Vector.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Vector.hpp') diff --git a/src/Vector.hpp b/src/Vector.hpp index a067ea0..82f5132 100644 --- a/src/Vector.hpp +++ b/src/Vector.hpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -137,5 +138,21 @@ struct Vector3 { } }; +template<> +inline bool Vector3::operator==(const Vector3& rhs) const { + return + std::fabs(rhs.x - x) < FLT_EPSILON && + std::fabs(rhs.y - y) < FLT_EPSILON && + std::fabs(rhs.z - z) < FLT_EPSILON; +} + +template<> +inline bool Vector3::operator==(const Vector3& rhs) const { + return + std::fabs(rhs.x - x) < DBL_EPSILON && + std::fabs(rhs.y - y) < DBL_EPSILON && + std::fabs(rhs.z - z) < DBL_EPSILON; +} + using VectorF = Vector3; -using Vector = Vector3; \ No newline at end of file +using Vector = Vector3; -- cgit v1.2.3