mailr10070 - in /1.3: maths_fns/rotation_matrix.py test_suite/unit_tests/_maths_fns/test_rotation_matrix.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 08, 2009 - 14:05:
Author: bugman
Date: Tue Dec  8 14:05:08 2009
New Revision: 10070

URL: http://svn.gna.org/viewcvs/relax?rev=10070&view=rev
Log:
Fix for the R_to_euler_zyx() function.

The beta = 0 problem point does not exist!


Modified:
    1.3/maths_fns/rotation_matrix.py
    1.3/test_suite/unit_tests/_maths_fns/test_rotation_matrix.py

Modified: 1.3/maths_fns/rotation_matrix.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/maths_fns/rotation_matrix.py?rev=10070&r1=10069&r2=10070&view=diff
==============================================================================
--- 1.3/maths_fns/rotation_matrix.py (original)
+++ 1.3/maths_fns/rotation_matrix.py Tue Dec  8 14:05:08 2009
@@ -2048,8 +2048,6 @@
         cg = cos(gamma),
         sg = sin(gamma).
 
-    If beta is zero degrees (i.e. the Rzz element is one), then the rotation 
angle is determined from the xy sub-matrix elements.  All of the rotation is 
assumed to be in alpha, while gamma stays at zero.
-
 
     @param R:       The 3x3 rotation matrix to update.
     @type R:        3x3 numpy array
@@ -2060,21 +2058,11 @@
     # The beta Euler angle.
     beta = asin(R[0, 2])
 
-    # Problem case - beta is zero so alpha and gamma are indistinguishable.
-    if R[0, 2] == 0.0:
-        # Put all the rotation into alpha.
-        alpha = atan2(R[1, 0], -R[2, 0])
-
-        # Gamma.
-        gamma = 0.0
-
-    # Normal case.
-    else:
-        # The alpha Euler angle.
-        alpha = atan2(-R[0, 1], R[0, 0])
-
-        # The gamma Euler angle.
-        gamma = atan2(-R[1, 2], R[2, 2])
+    # The alpha Euler angle.
+    alpha = atan2(-R[0, 1], R[0, 0])
+
+    # The gamma Euler angle.
+    gamma = atan2(-R[1, 2], R[2, 2])
 
     # Return the angles.
     return alpha, beta, gamma

Modified: 1.3/test_suite/unit_tests/_maths_fns/test_rotation_matrix.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_maths_fns/test_rotation_matrix.py?rev=10070&r1=10069&r2=10070&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/_maths_fns/test_rotation_matrix.py (original)
+++ 1.3/test_suite/unit_tests/_maths_fns/test_rotation_matrix.py Tue Dec  8 
14:05:08 2009
@@ -584,10 +584,10 @@
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 0.0, 
0.0, 0.0)
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 1.0, 
0.0, 0.0)
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 0.0, 
1.0, 0.0)
-        self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 0.0, 
0.0, 1.0, alpha_end=1.0, gamma_end=0.0)
+        self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 0.0, 
0.0, 1.0)
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 1.0, 
1.0, 0.0)
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 0.0, 
1.0, 1.0)
-        self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 1.0, 
0.0, 1.0, alpha_end=2.0, gamma_end=0.0)
+        self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 1.0, 
0.0, 1.0)
         self.check_return_conversion(euler_zyx_to_R, R_to_euler_zyx, 1.0, 
1.0, 1.0)
 
 




Related Messages


Powered by MHonArc, Updated Tue Dec 08 16:00:02 2009