German Larrain  committed 885951b

utils.geometry: renamed Direction to Direction3; Direction3 is now subclass of ars.utils.matrix.Vector3.

  • Participants
  • Parent commits 53c88c7
  • Branches dev-utils

Comments (0)

Files changed (1)

File ars/utils/

 		raise NotImplementedError()
-class Direction:
+class Direction3(mxut.Vector3):
 	"""A vector can be used to represent a direction. Its length is not
 	relevant; only where it points to. If normalized, each component is a
 	'direction cosine', thus being constrained by the equation
 	def __init__(self, vector, normalize=False):
+		super(Direction3, self).__init__(vector)
 		if normalize:
-			vector = mut.norm3(vector)
-		self.x = vector[0]
-		self.y = vector[1]
-		self.z = vector[2]
-	def get_vector(self):
-		return (self.x, self.y, self.z)
+			self.unitize()
 	def get_angles(self):
 		"""Returns (alpha, beta, gamma) such that