Exemple #1
0
def test_overlaps():
    aabb1 = AABB([(0, 10), (0, 10)])
    aabb2 = AABB([(-5, 5), (-6, 3)])
    aabb3 = AABB([(10, 12), (5, 6)])

    assert aabb1.overlaps(aabb2)
    assert aabb2.overlaps(aabb1)
    assert not aabb3.overlaps(aabb2)
    assert not aabb2.overlaps(aabb3)
Exemple #2
0
def test_overlaps_closed():
    aabb1 = AABB([(0, 0)])
    aabb2 = AABB([(-1, 0)])
    aabb3 = AABB([(1, 2)])
    aabb4 = AABB([(-9, -8)])

    assert aabb1.overlaps(aabb2, True)
    assert aabb2.overlaps(aabb1, True)
    assert not aabb1.overlaps(aabb3, True)
    assert not aabb2.overlaps(aabb3, True)
    assert not aabb1.overlaps(aabb4, True)
    assert not aabb2.overlaps(aabb4, True)
    assert not aabb1.overlaps(AABB(), True)