diff --git a/geom/aabb.hpp b/geom/aabb.hpp index f4d23728..b37ca6ab 100644 --- a/geom/aabb.hpp +++ b/geom/aabb.hpp @@ -48,7 +48,6 @@ namespace cruft::geom { } - /////////////////////////////////////////////////////////////////////// extent magnitude (void) const @@ -65,6 +64,17 @@ namespace cruft::geom { } + //--------------------------------------------------------------------- + point + centre (void) const + { + point res; + for (std::size_t i = 0; i < S; ++i) + res[i] = (lo[i] + hi[i] / 2); + return res; + } + + ///-------------------------------------------------------------------- /// tests whether a point lies within the region, inclusive of borders constexpr bool