geom/aabb: add a 'centre' query

This commit is contained in:
Danny Robson 2020-06-18 14:44:20 +10:00
parent deac73dc10
commit 4b8947464b

View File

@ -48,7 +48,6 @@ namespace cruft::geom {
}
///////////////////////////////////////////////////////////////////////
extent<S,T>
magnitude (void) const
@ -65,6 +64,17 @@ namespace cruft::geom {
}
//---------------------------------------------------------------------
point<S,T>
centre (void) const
{
point<S,T> 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