Commits

German Larrain committed 53c88c7

utils.geometry: no code changes, only docstrings and comments

Comments (0)

Files changed (1)

ars/utils/geometry.py

 
 
 class Transform:
+	"""Represents a homogeneus transform, i.e. a size-4 square matrix which
+	eases the transformation of a vector from one frame of reference into
+	another by being linear in the R^4 space. Thus 'new_vec = T * vec', where
+	the vectors are expressed in homogeneous coordinates.
+
+	The top left submatrix is R, a 3x3 rotation matrix. The 4-th column is a
+	translation vector (size 3) plus a number 1 appended. The 4-th rows is
+	[0 0 0 1].
+
+	"""
+
 	def __init__(self, position, rot_matrix):
 		"""
 		position: a 3-tuple
 
 
 def calc_rotation_matrix(axis, angle):
-	"""
-	Returns the row-major 3x3 rotation matrix defining a rotation around axis by
-	angle.
+	"""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://goo.gl/RkW80
 	The returned matrix format is length-9 tuple.
 
 	"""
-
+	# TODO: rename as 'axis_angle_to_rot_matrix'
+	# TODO: See RTB's 'angvec2r.m'
 	cos_theta = mut.cos(angle)
 	sin_theta = mut.sin(angle)
 	t = 1.0 - cos_theta
 		pitch: pi/6, roll: 0.0
 
 	"""
-	# THE FOLLOWING worked only in some cases, damn
+	# THE FOLLOWING worked only in some cases, damn it
 	#y_up = mut.upAxis
 	#z_front = mut.bkwdAxis
 	#x_right = mut.rightAxis
 	#roll = mut.sign(roll_proj) * mut.acos_dot3(z_front, front_rotated)
 	#
 	#return pitch, roll
+	###########################################################################
 
 	roll_x, pitch_y, yaw_z = _rot_matrix_to_rpy_angles(rot_matrix)
 	roll = roll_x