summaryrefslogtreecommitdiffstats
path: root/src/Vector.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Vector.hpp19
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>;