1 #ifndef BLANK_GEOMETRY_DISTANCE_HPP_
2 #define BLANK_GEOMETRY_DISTANCE_HPP_
7 #include <glm/gtx/component_wise.hpp>
8 #include <glm/gtx/norm.hpp>
14 inline bool iszero(const T &v) noexcept {
15 return length2(v) < std::numeric_limits<typename T::value_type>::epsilon();
19 inline void limit(Vec &v, float max) noexcept {
20 float len2 = length2(v);
21 float max2 = max * max;
23 v = normalize(v) * max;
28 T manhattan_distance(const glm::tvec3<T> &a, const glm::tvec3<T> &b) noexcept {
29 return compAdd(abs(a - b));
33 T manhattan_radius(const glm::tvec3<T> &v) noexcept {
34 return compMax(abs(v));