コード例 #1
0
    def test_rotation_matrix_conversions(self):
        """
        Bidirectional rotor - rotation matrix test. This needs work but is a reasonable start
        """
        from clifford.g3c import layout
        from clifford.tools.g3 import rotation_matrix_to_rotor, rotor_to_rotation_matrix
        e1 = layout.blades['e1']
        e2 = layout.blades['e2']

        rotor = e1 * e2
        print(rotor)
        matrix = rotor_to_rotation_matrix(rotor)
        print(matrix)
        rotor_return = rotation_matrix_to_rotor(matrix)
        print(rotor_return)
        testing.assert_almost_equal(rotor.value, rotor_return.value)
コード例 #2
0
ファイル: test_tools.py プロジェクト: arsenovic/clifford
 def test_rotation_matrix_conversions(self):
     """
     Bidirectional rotor - rotation matrix test. This needs work but is a reasonable start
     """
     from clifford.g3c import layout, up, down
     from clifford.tools.g3 import rotation_matrix_to_rotor, rotor_to_rotation_matrix
     from clifford.tools.g3c import random_rotation_rotor, random_conformal_point, apply_rotor
     for i in range(1000):
         rotor = random_rotation_rotor()
         # Check that we can map up and back
         Rmat = rotor_to_rotation_matrix(rotor)
         rotor_return = rotation_matrix_to_rotor(Rmat)
         testing.assert_almost_equal(rotor.value, rotor_return.value)
         # Check that the rotations do the same thing
         A = random_conformal_point()
         B = down(apply_rotor(A, rotor)).value[1:4]
         C = Rmat @ down(A).value[1:4]
         np.testing.assert_almost_equal(B, C)
コード例 #3
0
 def test_rotation_matrix_conversions(self):
     """
     Bidirectional rotor - rotation matrix test. This needs work but is a reasonable start
     """
     from clifford.g3c import layout, up, down
     from clifford.tools.g3 import rotation_matrix_to_rotor, rotor_to_rotation_matrix
     from clifford.tools.g3c import random_rotation_rotor, random_conformal_point, apply_rotor
     for i in range(1000):
         rotor = random_rotation_rotor()
         # Check that we can map up and back
         Rmat = rotor_to_rotation_matrix(rotor)
         rotor_return = rotation_matrix_to_rotor(Rmat)
         testing.assert_almost_equal(rotor.value, rotor_return.value)
         # Check that the rotations do the same thing
         A = random_conformal_point()
         B = down(apply_rotor(A, rotor)).value[1:4]
         C = Rmat @ down(A).value[1:4]
         np.testing.assert_almost_equal(B, C)