geom/aabb: move inclusive point query into header

This commit is contained in:
Danny Robson 2017-08-24 17:21:23 +10:00
parent d47f52b63f
commit e82d770d2b
2 changed files with 5 additions and 15 deletions

View File

@ -48,19 +48,7 @@ template <size_t S, typename T>
util::extent<S,T>
aabb<S,T>::magnitude (void) const
{
extent<S,T> out;
for (size_t i = 0; i < S; ++i)
out[i] = p1[i] - p0[i];
return out;
}
//-----------------------------------------------------------------------------
template <size_t S, typename T>
bool
aabb<S,T>::inclusive (point<S,T> p) const
{
return all (p0 <= p && p1 >= p);
return (p1 - p0).template as<util::extent> ();
}

View File

@ -30,11 +30,13 @@ namespace util::geom {
aabb () = default;
aabb (point<S,T>, point<S,T>);
T diameter (void) const;
extent<S,T> magnitude (void) const;
T diameter (void) const;
/// tests whether a point lies within the region, inclusive of borders
bool inclusive (point<S,T>) const;
constexpr bool
inclusive (point<S,T> p) const noexcept
{ return all (p0 <= p && p1 >= p); }
point<S,T> closest (point<S,T>) const;