예제 #1
0
 def bounding_box(self):
     box_list = map(lambda vertex: BoundingBox(vertex, vertex),
                    self.vertices)
     box_base = BoundingBox.from_boxes(box_list).translate(self.origin)
     box_origin = box_base.origin
     box_corner = box_base.corner + Point(0, 0, self.height)
     return BoundingBox(box_origin, box_corner)
예제 #2
0
 def bounding_box(self):
     box_list = self._box_list_from_list(self.roads)
     box_list.extend(self._box_list_from_list(self.blocks))
     box_list.extend(self._box_list_from_list(self.buildings))
     if self.ground_plane is not None:
         box_list.append(self.ground_plane.bounding_box())
     return BoundingBox.from_boxes(box_list)
예제 #3
0
 def test_from_boxes_with_five_boxes(self):
     box_1 = BoundingBox(Point(-20, -10), Point(-10, 10))
     box_2 = BoundingBox(Point(20, 5), Point(30, 15))
     box_3 = BoundingBox(Point(-15, 0), Point(10, 20))
     box_4 = BoundingBox(Point(55, 15), Point(45, 16))
     box_5 = BoundingBox(Point(-5, -10), Point(5, 0))
     box_list = [box_1, box_2, box_3, box_4, box_4]
     expected_merge = BoundingBox(Point(-20, -10), Point(55, 20))
     self.assertEqual(BoundingBox.from_boxes(box_list), expected_merge)
예제 #4
0
 def test_from_boxes_with_empty_box_list(self):
     box_list = []
     self.assertRaises(Exception, lambda: BoundingBox.from_boxes(box_list))
예제 #5
0
 def test_from_boxes_with_two_boxes(self):
     box_1 = BoundingBox(Point(-5, -10), Point(5, 0))
     box_2 = BoundingBox(Point(-5, 10), Point(5, 20))
     box_list = [box_1, box_2]
     expected_merge = BoundingBox(Point(-5, -10), Point(5, 20))
     self.assertEqual(BoundingBox.from_boxes(box_list), expected_merge)
예제 #6
0
 def test_from_boxes_with_one_box(self):
     box = BoundingBox(Point(17, 4), Point(59, 7))
     self.assertEqual(BoundingBox.from_boxes([box]), box)
예제 #7
0
 def bounding_box(self):
     node_bounding_boxes = self._node_bounding_boxes()
     return BoundingBox.from_boxes(node_bounding_boxes)