mailr9064 - /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 May 28, 2009 - 16:53:
Author: bugman
Date: Thu May 28 16:53:23 2009
New Revision: 9064

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


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=9064&r1=9063&r2=9064&view=diff
==============================================================================
--- 1.3/maths_fns/rotation_matrix.py (original)
+++ 1.3/maths_fns/rotation_matrix.py Thu May 28 16:53:23 2009
@@ -46,21 +46,18 @@
     q34 = quat[2] * quat[3]
 
     # The diagonal.
-    matrix[0, 0] = (quat[0]**2 + q4_2) - 0.5
-    matrix[1, 1] = (quat[1]**2 + q4_2) - 0.5
-    matrix[2, 2] = (quat[2]**2 + q4_2) - 0.5
+    matrix[0, 0] = 2.0 * (quat[0]**2 + q4_2) - 1.0
+    matrix[1, 1] = 2.0 * (quat[1]**2 + q4_2) - 1.0
+    matrix[2, 2] = 2.0 * (quat[2]**2 + q4_2) - 1.0
 
     # Off-diagonal.
-    matrix[0, 1] = q12 - q34
-    matrix[0, 2] = q13 + q24
-    matrix[1, 2] = q23 - q14
-
-    matrix[1, 0] = q12 + q34
-    matrix[2, 0] = q13 - q24
-    matrix[2, 1] = q23 + q14
-
-    # Double.
-    matrix = 2.0 * matrix
+    matrix[0, 1] = 2.0 * (q12 - q34)
+    matrix[0, 2] = 2.0 * (q13 + q24)
+    matrix[1, 2] = 2.0 * (q23 - q14)
+
+    matrix[1, 0] = 2.0 * (q12 + q34)
+    matrix[2, 0] = 2.0 * (q13 - q24)
+    matrix[2, 1] = 2.0 * (q23 + q14)
 
 
 def R_2vect(R, vector_orig, vector_fin):




Related Messages


Powered by MHonArc, Updated Fri May 29 11:00:02 2009