geom/aabb: dont use mutating function naming convention

This commit is contained in:
Danny Robson 2017-08-24 16:47:02 +10:00
parent cd1bb730f2
commit f77cdabaee
3 changed files with 10 additions and 10 deletions

View File

@ -86,7 +86,7 @@ aabb<S,T>::closest (point<S,T> q) const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T> template <size_t S, typename T>
aabb<S,T> aabb<S,T>
aabb<S,T>::expanded (vector<S,T> mag) const noexcept aabb<S,T>::expand (vector<S,T> mag) const noexcept
{ {
CHECK (all (mag >= T{0})); CHECK (all (mag >= T{0}));
CHECK (all (mag < p1 - p0)); CHECK (all (mag < p1 - p0));
@ -101,7 +101,7 @@ aabb<S,T>::expanded (vector<S,T> mag) const noexcept
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <size_t S, typename T> template <size_t S, typename T>
aabb<S,T> aabb<S,T>
aabb<S,T>::expanded (T t) const noexcept aabb<S,T>::expand (T t) const noexcept
{ {
CHECK_GE (t, T{0}); CHECK_GE (t, T{0});
CHECK (all (t < p1 - p0)); CHECK (all (t < p1 - p0));
@ -116,7 +116,7 @@ aabb<S,T>::expanded (T t) const noexcept
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T> template <size_t S, typename T>
aabb<S,T> aabb<S,T>
aabb<S,T>::contracted (util::vector<S,T> mag) const noexcept aabb<S,T>::contract (util::vector<S,T> mag) const noexcept
{ {
CHECK (all (mag > T{0})); CHECK (all (mag > T{0}));
CHECK (all (mag <= p1 - p0)); CHECK (all (mag <= p1 - p0));
@ -131,7 +131,7 @@ aabb<S,T>::contracted (util::vector<S,T> mag) const noexcept
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <size_t S, typename T> template <size_t S, typename T>
aabb<S,T> aabb<S,T>
aabb<S,T>::contracted (T mag) const noexcept aabb<S,T>::contract (T mag) const noexcept
{ {
CHECK_GE (mag, T{0}); CHECK_GE (mag, T{0});
CHECK (all (mag <= p1 - p0)); CHECK (all (mag <= p1 - p0));

View File

@ -36,11 +36,11 @@ namespace util::geom {
point<S,T> closest (point<S,T>) const; point<S,T> closest (point<S,T>) const;
aabb<S,T> expanded (util::vector<S,T>) const noexcept; aabb<S,T> expand (util::vector<S,T>) const noexcept;
aabb<S,T> expanded (T) const noexcept; aabb<S,T> expand (T) const noexcept;
aabb<S,T> contracted (util::vector<S,T>) const noexcept; aabb<S,T> contract (util::vector<S,T>) const noexcept;
aabb<S,T> contracted (T) const noexcept; aabb<S,T> contract (T) const noexcept;
void cover (point<S,T>); void cover (point<S,T>);

View File

@ -17,7 +17,7 @@ main (int, char**)
const aabb2f val { { 2, 2 }, { 8, 8 } }; const aabb2f val { { 2, 2 }, { 8, 8 } };
const aabb2f res { { 3, 3 }, { 7, 7 } }; const aabb2f res { { 3, 3 }, { 7, 7 } };
tap.expect_eq (val.contracted (2.f), res, "over contraction"); tap.expect_eq (val.contract (2.f), res, "over contraction");
} }
{ {
@ -25,7 +25,7 @@ main (int, char**)
const aabb2f val { { 2, 2 }, { 8, 8 } }; const aabb2f val { { 2, 2 }, { 8, 8 } };
const aabb2f res { { 1, 1 }, { 9, 9 } }; const aabb2f res { { 1, 1 }, { 9, 9 } };
tap.expect_eq (val.expanded (2.f), res, "expansion"); tap.expect_eq (val.expand (2.f), res, "expansion");
} }
return tap.status (); return tap.status ();