diff --git a/geom/aabb.cpp b/geom/aabb.cpp index c491885e..029ea30e 100644 --- a/geom/aabb.cpp +++ b/geom/aabb.cpp @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015 Danny Robson + * Copyright 2015-2017 Danny Robson */ @@ -23,6 +23,7 @@ using util::geom::aabb; + //----------------------------------------------------------------------------- template aabb::aabb (point _p0, point _p1): @@ -158,16 +159,6 @@ aabb::operator- (vector v) const /////////////////////////////////////////////////////////////////////////////// -template -bool -aabb::operator== (const aabb rhs) const -{ - return rhs.p0 == p0 && rhs.p1 == p1; -} - - - -//----------------------------------------------------------------------------- namespace util::debug { template struct validator> { diff --git a/geom/aabb.hpp b/geom/aabb.hpp index 6f11b6aa..ab943799 100644 --- a/geom/aabb.hpp +++ b/geom/aabb.hpp @@ -11,12 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015-2016 Danny Robson + * Copyright 2015-2017 Danny Robson */ -#ifndef __UTIL_GEOM_AABB_HPP -#define __UTIL_GEOM_AABB_HPP +#ifndef CRUFT_UTIL_GEOM_AABB_HPP +#define CRUFT_UTIL_GEOM_AABB_HPP #include "../point.hpp" #include "../extent.hpp" @@ -24,6 +24,7 @@ #include namespace util::geom { + /////////////////////////////////////////////////////////////////////////// template struct aabb { aabb () = default; @@ -47,12 +48,21 @@ namespace util::geom { aabb operator+ (vector) const; aabb operator- (vector) const; - bool operator== (aabb) const; - point p0; point p1; }; + + /////////////////////////////////////////////////////////////////////////// + template + constexpr bool + operator== (const aabb &a, const aabb &b) noexcept + { + return a.p0 == b.p0 && a.p1 == b.p1; + } + + + /////////////////////////////////////////////////////////////////////////// typedef aabb<2,float> aabb2f; typedef aabb<2,unsigned> aabb2u; typedef aabb<2,int> aabb2i;