mailr10040 - /1.3/maths_fns/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 02, 2009 - 14:24:
Author: bugman
Date: Wed Dec  2 14:24:46 2009
New Revision: 10040

URL: http://svn.gna.org/viewcvs/relax?rev=10040&view=rev
Log:
Added the reverse_euler_zyz() function.

This converts forwards rotation Euler angles into reverse rotation Euler 
angles.


Modified:
    1.3/maths_fns/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=10040&r1=10039&r2=10040&view=diff
==============================================================================
--- 1.3/maths_fns/rotation_matrix.py (original)
+++ 1.3/maths_fns/rotation_matrix.py Wed Dec  2 14:24:46 2009
@@ -22,7 +22,7 @@
 
 # Python module imports.
 from math import acos, asin, atan2, cos, pi, sin, sqrt
-from numpy import array, cross, dot, float64, hypot, zeros
+from numpy import array, cross, dot, float64, hypot, transpose, zeros
 from numpy.linalg import norm
 from random import gauss, uniform
 
@@ -430,6 +430,35 @@
     axis[2] = cos(phi)
 
 
+def reverse_euler_zyz(alpha, beta, gamma):
+    """Convert the given forward rotation Euler angles into the equivalent 
reverse rotation Euler angles.
+    
+    This if for the z-y-z notation.
+
+
+    @param alpha:   The alpha Euler angle in rad.
+    @type alpha:    float
+    @param beta:    The beta Euler angle in rad.
+    @type beta:     float
+    @param gamma:   The gamma Euler angle in rad.
+    @type gamma:    float
+    @return:        The alpha, beta, and gamma Euler angles for the reverse 
rotation.
+    @rtype:         tuple of float
+    """
+
+    # Init.
+    R = zeros((3, 3), float64)
+
+    # Get the rotation.
+    euler_zyz_to_R(alpha, beta, gamma, R)
+
+    # Reverse rotation.
+    R = transpose(R)
+
+    # Return the Euler angles.
+    return R_to_euler_zyz(R)
+
+
 def quaternion_to_axis_angle(quat):
     """Convert a quaternion into the axis-angle notation.
 




Related Messages


Powered by MHonArc, Updated Wed Dec 02 14:40:02 2009