region: add two point constructor

This commit is contained in:
Danny Robson 2015-02-17 18:25:29 +11:00
parent b50a8289b9
commit c7a868beac
2 changed files with 14 additions and 0 deletions

View File

@ -38,6 +38,19 @@ util::region<T>::region (point<2,T> _point,
{ ; } { ; }
//-----------------------------------------------------------------------------
template <typename T>
util::region<T>::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)
{
CHECK_GE (_b.x, _a.x);
CHECK_GE (_b.y, _a.y);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T> template <typename T>
util::region<T>::region (position_type _x, util::region<T>::region (position_type _x,

View File

@ -43,6 +43,7 @@ namespace util {
region () = default; region () = default;
region (util::point<2,T>, util::extent<size_type>); region (util::point<2,T>, util::extent<size_type>);
region (util::point<2,T>, util::point<2,T>);
region (T _x, T _y, size_type _w, size_type _h); region (T _x, T _y, size_type _w, size_type _h);
size_type area (void) const; size_type area (void) const;