Commit 3292376c authored by Davis King's avatar Davis King

Added some overloads for move_rect() and translate_rect() that take a

point object.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402485
parent 66a56209
......@@ -395,6 +395,21 @@ namespace dlib
return centered_rect((rect.left()+rect.right())/2, (rect.top()+rect.bottom())/2, width, height);
}
// ----------------------------------------------------------------------------------------
inline const rectangle translate_rect (
const rectangle& rect,
const point& p
)
{
rectangle result;
result.set_top ( rect.top() + p.y() );
result.set_bottom ( rect.bottom() + p.y() );
result.set_left ( rect.left() + p.x() );
result.set_right ( rect.right() + p.x() );
return result;
}
// ----------------------------------------------------------------------------------------
inline const rectangle translate_rect (
......@@ -448,6 +463,16 @@ namespace dlib
rect.top()+height-1);
}
// ----------------------------------------------------------------------------------------
inline const rectangle move_rect (
const rectangle& rect,
const point& p
)
{
return rectangle(p.x(), p.y(), p.x()+rect.width()-1, p.y()+rect.height()-1);
}
// ----------------------------------------------------------------------------------------
inline const rectangle move_rect (
......
......@@ -447,6 +447,21 @@ namespace dlib
- The center of R is at the center of rect
!*/
// ----------------------------------------------------------------------------------------
const rectangle translate_rect (
const rectangle& rect,
const point& p
);
/*!
ensures
- returns a rectangle R such that:
- R.left() == rect.left() + p.x()
- R.right() == rect.right() + p.x()
- R.top() == rect.top() + p.y()
- R.bottom() == rect.bottom() + p.y()
!*/
// ----------------------------------------------------------------------------------------
const rectangle translate_rect (
......@@ -513,6 +528,21 @@ namespace dlib
- R.right() == rect.right()
!*/
// ----------------------------------------------------------------------------------------
const rectangle move_rect (
const rectangle& rect,
const point& p
);
/*!
ensures
- returns a rectangle R such that:
- R.width() == rect.width()
- R.height() == rect.height()
- R.left() == p.x()
- R.top() == p.y()
!*/
// ----------------------------------------------------------------------------------------
const rectangle move_rect (
......
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