def test_cut_infinity(self): cs.init(3, {0: [0], 1: [1], 2: [2]}) c1 = Cuboid([1, float("-inf"), 3], [7, float("inf"), 9], { 0: [0], 2: [2] }) c2 = Cuboid([4, float("-inf"), 6], [7, float("inf"), 7], { 0: [0], 2: [2] }) s1 = Core([c1, c2], {0: [0], 2: [2]}) low_c1 = Cuboid([1, float("-inf"), 3], [7, float("inf"), 5], { 0: [0], 2: [2] }) low_s = Core([low_c1], {0: [0], 2: [2]}) up_c1 = Cuboid([1, float("-inf"), 5], [7, float("inf"), 9], { 0: [0], 2: [2] }) up_c2 = Cuboid([4, float("-inf"), 6], [7, float("inf"), 7], { 0: [0], 2: [2] }) up_s = Core([up_c1, up_c2], {0: [0], 2: [2]}) self.assertEqual(s1.cut_at(2, 5), (low_s, up_s))
def test_cut_through_one_cuboid(self): cs.init(3, {0: [0, 1, 2]}) c1 = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1, 2]}) c2 = Cuboid([4, 5, 6], [7, 7, 7], {0: [0, 1, 2]}) s1 = Core([c1, c2], {0: [0, 1, 2]}) low_c1 = Cuboid([1, 2, 3], [7, 8, 5], {0: [0, 1, 2]}) low_s = Core([low_c1], {0: [0, 1, 2]}) up_c1 = Cuboid([1, 2, 5], [7, 8, 9], {0: [0, 1, 2]}) up_c2 = Cuboid([4, 5, 6], [7, 7, 7], {0: [0, 1, 2]}) up_s = Core([up_c1, up_c2], {0: [0, 1, 2]}) self.assertEqual(s1.cut_at(2, 5), (low_s, up_s))
def test_cut_below(self): cs.init(3, {0: [0, 1, 2]}) c1 = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1, 2]}) c2 = Cuboid([4, 5, 6], [7, 7, 7], {0: [0, 1, 2]}) s1 = Core([c1, c2], {0: [0, 1, 2]}) self.assertEqual(s1.cut_at(2, 0.0), (None, s1))
def test_cut_above(self): cs.init(3, {0: [0, 1, 2]}) c1 = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1, 2]}) c2 = Cuboid([4, 5, 6], [7, 7, 7], {0: [0, 1, 2]}) s1 = Core([c1, c2], {0: [0, 1, 2]}) self.assertEqual(s1.cut_at(0, 8.0), (s1, None))