class TestTransform(unittest.TestCase): def setUp(self): self.transform = Transform() self.translation = [1.,1.,1.] def test_translation(self): self.transform.translate(self.translation) reference = np.matrix('1., 0., 1.; 0., 1., 1.; 0., 0., 1.') tested = self.transform.matrix self.assertTrue(np.allclose(reference, tested)) def test_rotation(self): self.transform.rotate(90.) reference = np.matrix('0., -1., 0.; 1., 0., 0.; 0., 0., 1.') self.assertTrue(np.allclose(reference, self.transform.matrix))
def f(translation, rotation): t = Transform() t.rotate(rotation) t.translate(translation) return area_of_intersection(t)