diff --git a/extent.cpp b/extent.cpp index 2e777edb..6e163cee 100644 --- a/extent.cpp +++ b/extent.cpp @@ -24,12 +24,9 @@ #include -using namespace util; - - /////////////////////////////////////////////////////////////////////////////// template -extent::extent (const T _width, const T _height): +util::extent::extent (const T _width, const T _height): w (_width), h (_height) { ; } @@ -37,7 +34,7 @@ extent::extent (const T _width, const T _height): //----------------------------------------------------------------------------- template -extent::extent (const extent &rhs): +util::extent::extent (const util::extent &rhs): w (rhs.w), h (rhs.h) { ; } @@ -45,8 +42,8 @@ extent::extent (const extent &rhs): //----------------------------------------------------------------------------- template -extent& -extent::operator= (const extent &rhs) { +util::extent& +util::extent::operator= (const util::extent &rhs) { w = rhs.w; h = rhs.h; @@ -57,7 +54,7 @@ extent::operator= (const extent &rhs) { /////////////////////////////////////////////////////////////////////////////// template T -extent::diameter (void) const { +util::extent::diameter (void) const { return static_cast (sqrt (w * w + h * h)); } @@ -65,14 +62,14 @@ extent::diameter (void) const { //----------------------------------------------------------------------------- template T -extent::area (void) const +util::extent::area (void) const { return w * h; } /////////////////////////////////////////////////////////////////////////////// template -extent -extent::expanded (util::vector<2,T> size) const +util::extent +util::extent::expanded (util::vector<2,T> size) const { return { w + size.x, @@ -83,8 +80,8 @@ extent::expanded (util::vector<2,T> size) const //----------------------------------------------------------------------------- template -extent -extent::expanded (T t) const +util::extent +util::extent::expanded (T t) const { return expanded (util::vector<2,T> {t}); } @@ -93,7 +90,7 @@ extent::expanded (T t) const /////////////////////////////////////////////////////////////////////////////// template float -extent::aspect (void) const +util::extent::aspect (void) const { return static_cast (w) / static_cast (h); } @@ -102,14 +99,14 @@ extent::aspect (void) const /////////////////////////////////////////////////////////////////////////////// template bool -extent::empty (void) const +util::extent::empty (void) const { return almost_equal (area(), 0); } /////////////////////////////////////////////////////////////////////////////// template bool -extent::operator ==(const extent& rhs) const { +util::extent::operator ==(const extent& rhs) const { return almost_equal (w, rhs.w) && almost_equal (h, rhs.h); } @@ -118,7 +115,7 @@ extent::operator ==(const extent& rhs) const { /////////////////////////////////////////////////////////////////////////////// template void -extent::sanity (void) const +util::extent::sanity (void) const { CHECK (w >= 0 && h >= 0); }