Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'geometry/rect2d.hpp')
-rw-r--r--geometry/rect2d.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/geometry/rect2d.hpp b/geometry/rect2d.hpp
index 6154eec94a..09414221e6 100644
--- a/geometry/rect2d.hpp
+++ b/geometry/rect2d.hpp
@@ -176,6 +176,18 @@ namespace m2
m_maxY = c.y + dy;
}
+ void SetSizesToIncludePoint(Point<T> const & pt)
+ {
+ Point<T> const c = Center();
+ T const dx = my::Abs(pt.x - c.x);
+ T const dy = my::Abs(pt.y - c.y);
+
+ m_minX = c.x - dx;
+ m_minY = c.y - dy;
+ m_maxX = c.x + dx;
+ m_maxY = c.y + dy;
+ }
+
void SetCenter(m2::Point<T> const & p)
{
Offset(p - Center());