geom/aabb: add or'ing operator for points

This commit is contained in:
Danny Robson 2018-05-16 16:21:38 +10:00
parent 073b41da42
commit 09dfad5391

View File

@ -93,6 +93,23 @@ namespace util::geom {
} }
/// returns an aabb that covers the supplied point in addition to the
/// current aabb area.
auto operator| [[nodiscard]] (point<S,T> p) const noexcept
{
return aabb (
util::min (lo, p),
util::max (hi, p)
);
}
auto& operator|= (point<S,T> p) noexcept
{
return *this = *this | p;
}
::util::point<S,T> lo; ::util::point<S,T> lo;
::util::point<S,T> hi; ::util::point<S,T> hi;
}; };