]> git.localhorst.tv Git - blank.git/blobdiff - src/model/geometry.hpp
brought some order to the whole controller thing
[blank.git] / src / model / geometry.hpp
index fd2c42bb8c8fa7f643f7fcae8697aeac26496dd2..0bc17c162b73afb2e457866ca5c0d98617f59865 100644 (file)
@@ -2,6 +2,7 @@
 #define BLANK_MODEL_GEOMETRY_H_
 
 #include <algorithm>
+#include <limits>
 #include <glm/glm.hpp>
 
 
@@ -28,6 +29,12 @@ constexpr float rad2deg(float r) {
 }
 
 
+template <class T>
+inline bool iszero(const T &v) {
+       return dot(v, v) < std::numeric_limits<typename T::value_type>::epsilon();
+}
+
+
 template<class T>
 T manhattan_distance(const glm::tvec3<T> &a, const glm::tvec3<T> &b) {
        glm::tvec3<T> diff(abs(a - b));