mailr9145 - /branches/frame_order/maths_fns/frame_order_matrix_ops.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:42:
Author: bugman
Date: Thu Jun 25 13:42:50 2009
New Revision: 9145

URL: http://svn.gna.org/viewcvs/relax?rev=9145&view=rev
Log:
Spun out the cone axis generation code into generate_vector().


Modified:
    branches/frame_order/maths_fns/frame_order_matrix_ops.py

Modified: branches/frame_order/maths_fns/frame_order_matrix_ops.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order/maths_fns/frame_order_matrix_ops.py?rev=9145&r1=9144&r2=9145&view=diff
==============================================================================
--- branches/frame_order/maths_fns/frame_order_matrix_ops.py (original)
+++ branches/frame_order/maths_fns/frame_order_matrix_ops.py Thu Jun 25 
13:42:50 2009
@@ -54,10 +54,7 @@
     """
 
     # Generate the cone axis from the spherical angles.
-    sin_theta = sin(theta_axis)
-    cone_axis[0] = cos(phi_axis) * sin_theta
-    cone_axis[1] = sin(phi_axis) * sin_theta
-    cone_axis[2] = cos(theta_axis)
+    generate_vector(cone_axis, theta_axis, phi_axis)
 
     # The axis of rotation (cross product of the z-axis and cone axis).
     mu_rot = cross(z_axis, cone_axis)
@@ -85,6 +82,26 @@
 
     # Return the matrix.
     return matrix
+
+
+def generate_vector(vector, theta, phi):
+    """Generate a unit vector from the polar angle theta and azimuthal angle 
phi.
+
+    @param vector:  The storage structure for the vector.
+    @type vector:   numpy 3D, rank-1 array
+    @param theta:   The polar angle.
+    @type theta:    float
+    @param phi:     The azimuthal angle.
+    @type phi:      float
+    """
+
+    # Trig alias.
+    sin_theta = sin(theta)
+
+    # The vector.
+    vector[0] = cos(phi) * sin_theta
+    vector[1] = sin(phi) * sin_theta
+    vector[2] = cos(theta)
 
 
 def populate_1st_eigenframe_iso_cone(matrix, angle):




Related Messages


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