diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2023-07-08 21:41:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-08 21:41:27 +0200 |
commit | a68f48ad526d0843eb451af0be7f119db5ff794e (patch) | |
tree | 3c539c9e7de841c6616f532dadb7c8c1ef552d95 /src/Vector.hpp | |
parent | Merge pull request #80 from LaG1924/ftr/better-water (diff) | |
parent | Fixed some errors detected by static analysis (diff) | |
download | AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.gz AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.bz2 AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.lz AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.xz AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.zst AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.zip |
Diffstat (limited to 'src/Vector.hpp')
-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>; |