Fix bug with quad rect
This commit is contained in:
parent
4a357e6459
commit
025ee8e993
1 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue