def _create_buildings(self, city, size): blocks_count = size - 1 building_spacing = 18 for x in range(blocks_count): for y in range(blocks_count): for block_x in range(3): for block_y in range(3): pos = Point( x * self.multiplier + block_x * 30 + building_spacing, y * self.multiplier + block_y * 30 + building_spacing, 0) if abs(pos.y - pos.x) > building_spacing and \ abs(pos.y + pos.x - self.multiplier * blocks_count) > building_spacing: building = Building.square(pos, 20, 40) city.add_building(building)
def test_bounding_box_with_one_point_building_not_centered_at_0_0(self): origin = Point(34, 68) building = Building.square(origin, 0, 14) self.assertEqual(building.bounding_box(), BoundingBox(origin, origin + Point(0, 0, 14)))