From 025ee8e9936686b61b0983f734cf098e608b66c5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 18 Mar 2021 14:30:34 +0100 Subject: [PATCH] Fix bug with quad rect --- .../src/main/java/net/osmand/data/QuadRect.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java index de2772aad2..5e71781d4d 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java @@ -41,11 +41,15 @@ public class QuadRect { } public static boolean intersects(QuadRect a, QuadRect b) { - return Math.min(a.left, a.right) < Math.max(b.left, b.right) - && Math.max(a.left, a.right) > Math.min(b.left, b.right) - && Math.min(a.bottom, a.top) < Math.max(b.bottom, b.top) - && Math.max(a.bottom, a.top) > Math.min(b.bottom, b.top); + return Math.min(a.left, a.right) <= Math.max(b.left, b.right) + && Math.max(a.left, a.right) >= Math.min(b.left, b.right) + && Math.min(a.bottom, a.top) <= Math.max(b.bottom, b.top) + && Math.max(a.bottom, a.top) >= Math.min(b.bottom, b.top); } + + public static boolean trivialOverlap(QuadRect a, QuadRect b) { + return intersects(a, b); + } public double centerX() { return (left + right) / 2;