diff --git a/include/geode/geometry/bounding_box.hpp b/include/geode/geometry/bounding_box.hpp index a3e4fb564..651ffee14 100644 --- a/include/geode/geometry/bounding_box.hpp +++ b/include/geode/geometry/bounding_box.hpp @@ -115,6 +115,8 @@ namespace geode [[nodiscard]] std::tuple< local_index_t, double > largest_length() const; + [[nodiscard]] double n_volume() const; + [[nodiscard]] std::string string() const; private: diff --git a/src/geode/geometry/bounding_box.cpp b/src/geode/geometry/bounding_box.cpp index eba8fe22e..85ed00985 100644 --- a/src/geode/geometry/bounding_box.cpp +++ b/src/geode/geometry/bounding_box.cpp @@ -508,6 +508,18 @@ namespace geode return -inner_distance; } + template < index_t dimension > + double BoundingBox< dimension >::n_volume() const + { + double volume{ 1.0 }; + const auto box_extent = diagonal(); + for( const auto c : geode::LRange{ dimension } ) + { + volume *= ( box_extent.value( c ) ); + } + return volume; + } + template < index_t dimension > std::string BoundingBox< dimension >::string() const {