diff options
author | LaG1924 <lag1924@gmail.com> | 2023-07-08 20:30:25 +0200 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2023-07-08 21:24:04 +0200 |
commit | c984afdf47ef31511024c6b70bd4b4c4e64f56a6 (patch) | |
tree | 3c539c9e7de841c6616f532dadb7c8c1ef552d95 /src/Vector.hpp | |
parent | Merge pull request #80 from LaG1924/ftr/better-water (diff) | |
download | AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar.gz AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar.bz2 AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar.lz AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar.xz AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.tar.zst AltCraft-c984afdf47ef31511024c6b70bd4b4c4e64f56a6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Vector.hpp | 19 |
1 files changed, 18 insertions, 1 deletions
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 <ostream> #include <cmath> +#include <cfloat> #include <glm/vec3.hpp> @@ -137,5 +138,21 @@ struct Vector3 { } }; +template<> +inline bool Vector3<float>::operator==(const Vector3<float>& 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<double>::operator==(const Vector3<double>& 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<double>; -using Vector = Vector3<signed long long>;
\ No newline at end of file +using Vector = Vector3<signed long long>; |