geom/aabb: add a 'centre' query
This commit is contained in:
parent
deac73dc10
commit
4b8947464b
@ -48,7 +48,6 @@ namespace cruft::geom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
extent<S,T>
|
extent<S,T>
|
||||||
magnitude (void) const
|
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
|
/// tests whether a point lies within the region, inclusive of borders
|
||||||
constexpr bool
|
constexpr bool
|
||||||
|
Loading…
Reference in New Issue
Block a user