зеркало из 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(
|
||||
"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
|
||||
((-1, 2, -1, 2, -1, 2), True),
|
||||
# bbox2 strictly within bbox1
|
||||
|
|
|
@ -102,12 +102,12 @@ class BoundingBox(Tuple[float, float, float, float, float, float]):
|
|||
True if bounding boxes intersect, else False
|
||||
"""
|
||||
return (
|
||||
self.minx < other.maxx
|
||||
and self.maxx > other.minx
|
||||
and self.miny < other.maxy
|
||||
and self.maxy > other.miny
|
||||
and self.mint < other.maxt
|
||||
and self.maxt > other.mint
|
||||
self.minx <= other.maxx
|
||||
and self.maxx >= other.minx
|
||||
and self.miny <= other.maxy
|
||||
and self.maxy >= other.miny
|
||||
and self.mint <= other.maxt
|
||||
and self.maxt >= other.mint
|
||||
)
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче