Example #1
0
 def test_smaller_inside_bigger_intersection(self):
     b1 = BoundingBox([(0, 0, 0), (3, 3, 3)])
     b2 = BoundingBox([(1, 1, 1), (2, 2, 2)])
     b = b1.intersection(b2)
     assert b.size.isclose((1, 1, 1))
     assert b.extmin.isclose((1, 1, 1))
     assert b.extmax.isclose((2, 2, 2))
Example #2
0
 def test_full_intersection(self):
     b1 = BoundingBox([(0, 0, 0), (2, 2, 2)])
     b = b1.intersection(b1)
     assert b.size.isclose((2, 2, 2))
     assert b.extmin.isclose((0, 0, 0))
     assert b.extmax.isclose((2, 2, 2))
Example #3
0
 def test_multiple_intersections(self, v1, v2):
     b1 = BoundingBox(v1)
     b2 = BoundingBox(v2)
     b = b1.intersection(b2)
     assert b.size.isclose((1, 1, 1))
Example #4
0
 def test_touches_at_one_corner(self):
     b1 = BoundingBox([(0, 0, 0), (1, 1, 1)])
     b2 = BoundingBox([(1, 1, 1), (2, 2, 2)])
     b = b1.intersection(b2)
     assert b.is_empty is True
Example #5
0
 def test_no_intersection(self):
     b1 = BoundingBox([(0, 0, 0), (1, 1, 1)])
     b2 = BoundingBox([(2, 2, 2), (3, 3, 3)])
     b = b1.intersection(b2)
     assert b.is_empty is True
Example #6
0
 def test_accept_3d_box(self):
     b1 = BoundingBox([(0, 0, -1), (10, 10, 10)])
     b2 = BoundingBox2d([(1, 1), (9, 9)])  # z-axis is 0
     b = b1.intersection(b2)
     assert b.is_empty is True  # has no volume!