]> git.localhorst.tv Git - blank.git/blobdiff - src/geometry/primitive.hpp
tentative optimization of chunk intersection test
[blank.git] / src / geometry / primitive.hpp
index 351a3a432e1c17d3662b9544012e5c997c22328c..7da1096b38ddd528546748d232289a7e30fefa3a 100644 (file)
@@ -20,6 +20,12 @@ struct AABB {
        glm::vec3 Center() const noexcept {
                return min + (max - min) * 0.5f;
        }
+
+       /// return distance between origin and farthest vertex
+       float OriginRadius() const noexcept {
+               glm::vec3 high(glm::max(abs(min), abs(max)));
+               return length(high);
+       }
 };
 
 struct Ray {