зеркало из https://github.com/microsoft/torchgeo.git
Fix intersection for boxes on boundary
This commit is contained in:
Родитель
7e8fd461d8
Коммит
53fb4b28b9
|
@ -33,6 +33,9 @@ class TestBoundingBox:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_input,expected",
|
"test_input,expected",
|
||||||
[
|
[
|
||||||
|
# Same box
|
||||||
|
((0, 1, 0, 1, 0, 1), True),
|
||||||
|
((0.0, 1.0, 0.0, 1.0, 0.0, 1.0), True),
|
||||||
# bbox1 strictly within bbox2
|
# bbox1 strictly within bbox2
|
||||||
((-1, 2, -1, 2, -1, 2), True),
|
((-1, 2, -1, 2, -1, 2), True),
|
||||||
# bbox2 strictly within bbox1
|
# bbox2 strictly within bbox1
|
||||||
|
|
|
@ -102,12 +102,12 @@ class BoundingBox(Tuple[float, float, float, float, float, float]):
|
||||||
True if bounding boxes intersect, else False
|
True if bounding boxes intersect, else False
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
self.minx < other.maxx
|
self.minx <= other.maxx
|
||||||
and self.maxx > other.minx
|
and self.maxx >= other.minx
|
||||||
and self.miny < other.maxy
|
and self.miny <= other.maxy
|
||||||
and self.maxy > other.miny
|
and self.maxy >= other.miny
|
||||||
and self.mint < other.maxt
|
and self.mint <= other.maxt
|
||||||
and self.maxt > other.mint
|
and self.maxt >= other.mint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче