diff --git a/geom/aabb.hpp b/geom/aabb.hpp index 0bbc9ad1..ea1041f0 100644 --- a/geom/aabb.hpp +++ b/geom/aabb.hpp @@ -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 + expand [[nodiscard]] (T mag) const + { + return { + lo - mag, + hi + mag + }; + } + /////////////////////////////////////////////////////////////////////// /// Adds a constant vector to both the lo and hi points. aabb operator+ (vector v) const