diff options
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)); |