def test_overlapping_crossing_boxes(self): box1 = ConstructionBox() # overlapping boxes with corners inside of each other box2 = ConstructionBox(width=0.1, height=3) assert box1.is_any_corner_inside(box2) is False assert box2.is_any_corner_inside(box1) is False assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True # center2 outside of box1 box2 = ConstructionBox(center=(0.3, 0.708), width=0.18, height=2.88) assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True # center2 outside of box1, no overlapping box2 = ConstructionBox(center=(0.6427, 0.6563), width=0.18, height=2.88) assert box1.is_overlapping(box2) is False assert box2.is_overlapping(box1) is False # cutting corner of box1 box2 = ConstructionBox(center=(0.2639, 0.5721), width=0.18, height=2.88, angle=45) assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True
def test_overlapping_boxes(self): box1 = ConstructionBox() assert box1.is_overlapping(box1) is True box2 = ConstructionBox(width=2, height=2) # box1 complete inside of box2 assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True # one touching corner box2 = ConstructionBox(center=(1, 1)) assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True # no overlapping box2 = ConstructionBox(center=(1.2091, 0.4669), angle=45) assert box1.is_overlapping(box2) is False assert box2.is_overlapping(box1) is False # one point of box2 inside of box1 box2 = ConstructionBox(center=(0.5404, 0.5404), angle=45) assert box1.is_overlapping(box2) is True assert box2.is_overlapping(box1) is True