1 #ifndef BLANK_GEOMETRY_DISTANCE_HPP_
2 #define BLANK_GEOMETRY_DISTANCE_HPP_
11 inline float length_squared(const glm::vec3 &v) noexcept {
15 inline float distance_squared(const glm::vec3 &a, const glm::vec3 &b) noexcept {
16 return length_squared(a - b);
20 inline bool iszero(const T &v) noexcept {
21 return length_squared(v) < std::numeric_limits<typename T::value_type>::epsilon();
25 T manhattan_distance(const glm::tvec3<T> &a, const glm::tvec3<T> &b) noexcept {
26 glm::tvec3<T> diff(abs(a - b));
27 return diff.x + diff.y + diff.z;
31 T manhattan_radius(const glm::tvec3<T> &v) noexcept {
32 glm::tvec3<T> a(abs(v));
33 return std::max(a.x, std::max(a.y, a.z));