region: remove mutating point constrain function
This commit is contained in:
parent
31d2e6bfd8
commit
9abfef2769
13
region.cpp
13
region.cpp
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user