def bounds_of(self) -> Bounds: box = Bounds() for child in self.members: cbox = child.parent_space_bounds_of() box.add_box(cbox) return box
def bounds_of(self) -> Bounds: box = Bounds() left_cbox = self.left.parent_space_bounds_of() right_cbox = self.right.parent_space_bounds_of() box.add_box(left_cbox) box.add_box(right_cbox) return box
def test_add_bounding_box_to_another(self): box1 = Bounds(Point(-5, -2, 0), Point(7, 4, 4)) box2 = Bounds(Point(8, -7, -2), Point(14, 2, 8)) box1.add_box(box2) self.assertEqual(box1.min, Point(-5, -7, -2)) self.assertEqual(box1.max, Point(14, 4, 8))