Author: bugman Date: Tue Aug 18 13:57:40 2009 New Revision: 9324 URL: http://svn.gna.org/viewcvs/relax?rev=9324&view=rev Log: Credited Wikipedia and added the quaternion to rotation matrix equation. The reason is because Wikipedia looks like it has a mistake! 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=9324&r1=9323&r2=9324&view=diff ============================================================================== --- 1.3/maths_fns/rotation_matrix.py (original) +++ 1.3/maths_fns/rotation_matrix.py Tue Aug 18 13:57:40 2009 @@ -29,6 +29,15 @@ def quaternion_to_R(quat, matrix): """Convert a quaternion into rotation matrix form. + + This is from Wikipedia (http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion), where:: + + | 1 - 2y**2 - 2z**2 2xy - 2zw 2xz + 2yw | + Q = | 2xy + 2zw 1 - 2x**2 - 2z**2 2yz - 2xw |, + | 2xz - 2yw 2yz + 2xw 1 - 2x**2 - 2y**2 | + + and where the quaternion is defined as (x, y, z, w). + @param quat: The quaternion. @type quat: numpy 4D, rank-1 array