def test_with_box(self): b = box.from_corners(corner1=(-5, -6, 3), corner2=(5, -4, 6)) self.assertTrue(self.tester(left=b, right=b)) directions = [ (1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (1, -1, 0), (1, 0, -1), (0, 1, -1), (1, 1, 1), (1, 1, -1), (1, -1, 1), (-1, 1, 1), ] for direction in directions: self.check_boundary(trial=b, direction=direction) self.assertTrue( self.tester(left=b, right=box.from_corners(corner1=(-4.9, -5.9, 3.1), corner2=(-4.8, -5.8, 3.2))) ) self.assertTrue(self.tester(left=b, right=box.from_corners(corner1=(-0.1, -4.1, 0), corner2=(0.1, -3.9, 9))))
def check_boundary(self, trial, direction): self.assertFalse( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.low, self.scale(direction, -2)), corner2=self.shift( self.shift(trial.low, (1, 1, 1)), self.scale(direction, -1.1), ), ), )) self.assertTrue( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.low, self.scale(direction, -2)), corner2=self.shift( self.shift(trial.low, (1, 1, 1)), self.scale(direction, -0.9), ), ), )) self.assertFalse( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.high, self.scale(direction, 0.1)), corner2=self.shift( self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2), ), ), )) right = box.from_corners( corner1=self.shift(trial.high, self.scale(direction, -0.1)), corner2=self.shift( self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2), ), ) self.assertTrue( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.high, self.scale(direction, -0.1)), corner2=self.shift( self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2), ), ), ))
def check_boundary(self, trial, direction): self.assertFalse( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.low, self.scale(direction, -2)), corner2=self.shift(self.shift(trial.low, (1, 1, 1)), self.scale(direction, -1.1)), ), ) ) self.assertTrue( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.low, self.scale(direction, -2)), corner2=self.shift(self.shift(trial.low, (1, 1, 1)), self.scale(direction, -0.9)), ), ) ) self.assertFalse( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.high, self.scale(direction, 0.1)), corner2=self.shift(self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2)), ), ) ) right = box.from_corners( corner1=self.shift(trial.high, self.scale(direction, -0.1)), corner2=self.shift(self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2)), ) self.assertTrue( self.tester( left=trial, right=box.from_corners( corner1=self.shift(trial.high, self.scale(direction, -0.1)), corner2=self.shift(self.shift(trial.high, (-1, -1, -1)), self.scale(direction, 2)), ), ) )
def test_with_box(self): b = box.from_corners(corner1=(-5, -6, 3), corner2=(5, -4, 6)) self.assertTrue(self.tester(left=b, right=b)) directions = [ (1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (1, 0, 1), (0, 1, 1), (1, -1, 0), (1, 0, -1), (0, 1, -1), (1, 1, 1), (1, 1, -1), (1, -1, 1), (-1, 1, 1), ] for direction in directions: self.check_boundary(trial=b, direction=direction) self.assertTrue( self.tester( left=b, right=box.from_corners( corner1=(-4.9, -5.9, 3.1), corner2=(-4.8, -5.8, 3.2), ), )) self.assertTrue( self.tester( left=b, right=box.from_corners( corner1=(-0.1, -4.1, 0), corner2=(0.1, -3.9, 9), ), ))