def test_trivial(self): """ Test that a translation_rotation_matrix() reduces to rotation_matrix() for zero translation """ axis = np.random.random((3,)) angle = np.random.random() mat = tr.translation_rotation_matrix(angle, axis, translation=[0, 0, 0]) self.assertTrue(tr.is_rotation_matrix(mat))
def test_random(self): """ Test that translation_rotation_matrix() produces a matrix that correctly transforms a random point """ pt = np.random.random((3,)) axis = np.random.random((3,)) angle = np.random.random() translation = np.random.random((3,)) trmat = tr.translation_rotation_matrix(angle, axis, translation=translation) v1 = tr.transform(trmat, pt) # translated rotated point # Transform the point once operator at a time v2 = tr.transform(tr.rotation_matrix(angle, axis), pt) v2 += translation self.assertTrue(np.allclose(v1, v2))