diff --git a/region.cpp b/region.cpp index edba9e54..5ecae38c 100644 --- a/region.cpp +++ b/region.cpp @@ -27,6 +27,13 @@ #include +//----------------------------------------------------------------------------- +template +util::region::region (util::extent _extent): + region (util::point<2,T>::ORIGIN, _extent) +{ ; } + + //----------------------------------------------------------------------------- template util::region::region (point<2,T> _point, @@ -42,10 +49,7 @@ util::region::region (point<2,T> _point, template util::region::region (point<2,T> _a, point<2,T> _b): - x (_a.x), - y (_a.y), - w (_b.x - _a.x), - h (_b.y - _a.y) + region (_a, _b - _a) { CHECK_GE (_b.x, _a.x); CHECK_GE (_b.y, _a.y); @@ -57,10 +61,7 @@ util::region::region (position_type _x, position_type _y, size_type _w, size_type _h): - x (_x), - y (_y), - w (_w), - h (_h) + region (point<2,T> {_x, _y}, extent {_w, _h}) { ; } @@ -85,7 +86,7 @@ util::region::diameter (void) const //----------------------------------------------------------------------------- template util::extent::size_type> -util::region::size (void) const +util::region::magnitude (void) const { return { w, h }; } diff --git a/region.hpp b/region.hpp index ffdbcfdf..3815d796 100644 --- a/region.hpp +++ b/region.hpp @@ -43,13 +43,14 @@ namespace util { size_type w, h; region () = default; + region (util::extent); region (util::point<2,T>, util::extent); region (util::point<2,T>, util::point<2,T>); region (T _x, T _y, size_type _w, size_type _h); size_type area (void) const; size_type diameter (void) const; - util::extent size (void) const; + util::extent magnitude (void) const; void scale (T factor);