diff options
author | vng <viktor.govako@gmail.com> | 2016-01-26 20:25:19 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:15:38 +0300 |
commit | fc12597bf3f12109bd978e93587f63ed5d76c142 (patch) | |
tree | 6551ceacf48612efe7ecc47f495ac7f99b241c83 /geometry | |
parent | 0dc9f5fa28a1714d7a3aa74f33709ac8d9cb7ae2 (diff) |
[search] Fixed bug with interactive search. Do call when viewport actually changed.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/any_rect2d.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/geometry/any_rect2d.hpp b/geometry/any_rect2d.hpp index 30d8448158..b538f5f99e 100644 --- a/geometry/any_rect2d.hpp +++ b/geometry/any_rect2d.hpp @@ -100,6 +100,23 @@ namespace m2 T GetMaxSize() const { return max(m_rect.SizeX(), m_rect.SizeY()); } + bool EqualDxDy(AnyRect<T> const & r, T eps) const + { + m2::Point<T> arr1[4]; + GetGlobalPoints(arr1); + sort(arr1, arr1 + 4); + + m2::Point<T> arr2[4]; + r.GetGlobalPoints(arr2); + sort(arr2, arr2 + 4); + + for (size_t i = 0; i < 4; ++i) + if (!arr1[i].EqualDxDy(arr2[i], eps)) + return false; + + return true; + } + bool IsPointInside(Point<T> const & pt) const { return m_rect.IsPointInside(ConvertTo(pt)); |