mailr9144 - /branches/frame_order/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 June 25, 2009 - 13:38:
Author: bugman
Date: Thu Jun 25 13:38:11 2009
New Revision: 9144

URL: http://svn.gna.org/viewcvs/relax?rev=9144&view=rev
Log:
Bug fix for the R_2vect() function.

The rotation axis is not always of unit length!


Modified:
    branches/frame_order/maths_fns/rotation_matrix.py

Modified: branches/frame_order/maths_fns/rotation_matrix.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/maths_fns/rotation_matrix.py?rev=9144&r1=9143&r2=9144&view=diff
==============================================================================
--- branches/frame_order/maths_fns/rotation_matrix.py (original)
+++ branches/frame_order/maths_fns/rotation_matrix.py Thu Jun 25 13:38:11 2009
@@ -89,8 +89,13 @@
     vector_orig = vector_orig / norm(vector_orig)
     vector_fin = vector_fin / norm(vector_fin)
 
-    # The rotation axis.
+    # The rotation axis (normalised).
     axis = cross(vector_orig, vector_fin)
+    axis_len = norm(axis)
+    if axis_len != 0.0:
+        axis = axis / axis_len
+
+    # Alias the axis coordinates.
     x = axis[0]
     y = axis[1]
     z = axis[2]




Related Messages


Powered by MHonArc, Updated Thu Jun 25 14:00:05 2009