Commit 2d0d3c9e authored by Davis King's avatar Davis King

Added a global operator+ for rectangle+point to make this kind of operation

compile in more contexts.
parent d1dc0e1d
...@@ -541,6 +541,26 @@ namespace dlib ...@@ -541,6 +541,26 @@ namespace dlib
return rectangle(0, 0, m.nc()-1, m.nr()-1); return rectangle(0, 0, m.nc()-1, m.nr()-1);
} }
// ----------------------------------------------------------------------------------------
inline rectangle operator+ (
const rectangle& r,
const point& p
)
{
return r + rectangle(p);
}
// ----------------------------------------------------------------------------------------
inline rectangle operator+ (
const point& p,
const rectangle& r
)
{
return r + rectangle(p);
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -636,6 +636,30 @@ namespace dlib ...@@ -636,6 +636,30 @@ namespace dlib
bounding rectangle for that gridded object.) bounding rectangle for that gridded object.)
!*/ !*/
// ----------------------------------------------------------------------------------------
inline rectangle operator+ (
const rectangle& r,
const point& p
);
/*!
ensures
- returns r + rectangle(p)
(i.e. returns the rectangle that contains both r and p)
!*/
// ----------------------------------------------------------------------------------------
inline rectangle operator+ (
const point& p,
const rectangle& r
);
/*!
ensures
- returns r + rectangle(p)
(i.e. returns the rectangle that contains both r and p)
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -346,6 +346,9 @@ namespace ...@@ -346,6 +346,9 @@ namespace
} }
DLIB_TEST(rectangle() + point(5,4) + point(10,10) == rectangle(5,4,10,10));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment