예제 #1
0
    def test_random(self):
        """ Test that rotation_matrix() returns a valid rotation matrix
		for random axes and angles """
        axis = np.random.random((3,))
        angle = np.random.random()

        mat = tr.rotation_matrix(angle, axis)
        self.assertTrue(tr.is_rotation_matrix(mat))
예제 #2
0
    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))
예제 #3
0
 def test_trivial(self):
     """ test that the identity matrix is a rotation matrix """
     self.assertTrue(tr.is_rotation_matrix(np.eye(3)))
     self.assertTrue(tr.is_rotation_matrix(np.eye(4)))
예제 #4
0
    def test_from_rotation_matrix(self):
        """ test that the rotated identity operator is
		a rotation matrix"""
        self.assertTrue(
            tr.is_rotation_matrix(tr.rotation_matrix(np.pi / 3, axis=[0, 0, 1]))
        )
예제 #5
0
def test_is_rotation_matrix_trivial():
    """ test that the identity matrix is a rotation matrix """
    assert tr.is_rotation_matrix(np.eye(3))
    assert tr.is_rotation_matrix(np.eye(4))