geom/aabb: add expand observer.

This commit is contained in:
Danny Robson 2019-04-08 14:05:38 +10:00
parent 3c9b71fa56
commit 3186d300a1

View File

@ -73,6 +73,21 @@ namespace cruft::geom {
} }
///////////////////////////////////////////////////////////////////////
/// Applies a negative offset to lo, and a positive offset to hi, and
/// returns the result.
///
/// The offset applied is identical for lo and hi, so one may need to
/// consider halving the supplied magnitude depending on the use case.
aabb<S,T>
expand [[nodiscard]] (T mag) const
{
return {
lo - mag,
hi + mag
};
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
/// Adds a constant vector to both the lo and hi points. /// Adds a constant vector to both the lo and hi points.
aabb<S,T> operator+ (vector<S,T> v) const aabb<S,T> operator+ (vector<S,T> v) const