Commits

German Larrain committed 3f5af2d

utilities.mathematical.calc_rotation_matrix's doc updated

Comments (0)

Files changed (1)

ars/utilities/mathematical.py

 #
 # @author: german
 #
-# TODO: attribute the code sections that were copied from somewhere else
+# TODO:	attribute the code sections that were copied from somewhere else
+#		create a test for calc_rotation_matrix
 
 '''
 Functions to perform operations over vectors and matrices; 
 	"""
 	Returns the row-major 3x3 rotation matrix defining a rotation around axis by
 	angle.
+	
+	Formula is the same as the one presented here (as of 2011.12.01):
+	http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
+	
+	<math>
+	R = \begin{bmatrix} 
+	\cos \theta +u_x^2 \left(1-\cos \theta\right) & 
+	u_x u_y \left(1-\cos \theta\right) - u_z \sin \theta & 
+	u_x u_z \left(1-\cos \theta\right) + u_y \sin \theta \\ 
+	u_y u_x \left(1-\cos \theta\right) + u_z \sin \theta & 
+	\cos \theta + u_y^2\left(1-\cos \theta\right) & 
+	u_y u_z \left(1-\cos \theta\right) - u_x \sin \theta \\ 
+	u_z u_x \left(1-\cos \theta\right) - u_y \sin \theta & 
+	u_z u_y \left(1-\cos \theta\right) + u_x \sin \theta & 
+	\cos \theta + u_z^2\left(1-\cos \theta\right) 
+	\end{bmatrix}
+	</math>
 	"""
+
 	cos_theta = cos(angle)
 	sin_theta = sin(angle)
 	t = 1.0 - cos_theta