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);
19 inline float distance(const glm::vec3 &a, const glm::vec3 &b) noexcept {
24 inline bool iszero(const T &v) noexcept {
25 return length_squared(v) < std::numeric_limits<typename T::value_type>::epsilon();
29 T manhattan_distance(const glm::tvec3<T> &a, const glm::tvec3<T> &b) noexcept {
30 glm::tvec3<T> diff(abs(a - b));
31 return diff.x + diff.y + diff.z;
35 T manhattan_radius(const glm::tvec3<T> &v) noexcept {
36 glm::tvec3<T> a(abs(v));
37 return std::max(a.x, std::max(a.y, a.z));