region: remove mutating point constrain function

This commit is contained in:
Danny Robson 2017-08-11 15:19:14 +10:00
parent 31d2e6bfd8
commit 9abfef2769
2 changed files with 3 additions and 13 deletions

View File

@ -179,20 +179,11 @@ util::region<S,T>::intersects (region<S,T> rhs) const
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <size_t S, typename T> template <size_t S, typename T>
void typename region<S,T>::point_t
util::region<S,T>::constrain (point_t &q) const region<S,T>::constrain (point_t q) const noexcept
{ {
for (size_t i = 0; i < S; ++i) for (size_t i = 0; i < S; ++i)
q[i] = limit (q[i], p[i], p[i] + e[i]); q[i] = limit (q[i], p[i], p[i] + e[i]);
}
//-----------------------------------------------------------------------------
template <size_t S, typename T>
typename util::region<S,T>::point_t
util::region<S,T>::constrained (point_t q) const
{
constrain (q);
return q; return q;
} }

View File

@ -81,8 +81,7 @@ namespace util {
bool covers (point<S,T>) const noexcept; bool covers (point<S,T>) const noexcept;
// Move a point to be within the region bounds // Move a point to be within the region bounds
void constrain (point_t&) const; point_t constrain (point_t) const noexcept;
point_t constrained (point_t) const;
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Compute a region `mag` units into the region // Compute a region `mag` units into the region