Commits

German Larrain committed 31d81bd

utils.geometry: new classes RotationMatrix (constructor and many stubs) and Quaternion

  • Participants
  • Parent commits 2605f94
  • Branches dev-utils

Comments (0)

Files changed (1)

File ars/utils/geometry.py

 import numpy as np
 
 import ars.utils.mathematical as mut
-#import ars.utils.matrix as mxut
+import ars.utils.matrix as mxut
 
 import generic as gut
 
 		return (mut.acos(self.x), mut.acos(self.y), mut.acos(self.z))
 
 
-#class RotationMatrix(mxut.Matrix3):
-#
-#	def __init__(self, elements=None, rows=None, axis=None, angle=None):
-#		pass
+class RotationMatrix(mxut.Matrix3):
+	"""Row-major rotation matrix."""
+
+	def __init__(self, elements=None, rows=None, axis=None, angle=None,
+			rpy=None):
+		if elements:  # not None nor empty
+			super(RotationMatrix, self).__init__(elements)
+		elif rows:  # not None nor empty
+			super(RotationMatrix, self).__init__(rows)
+		elif axis is not None and angle is not None:
+			mat = calc_rotation_matrix(axis, angle)
+			super(RotationMatrix, self).__init__(mat)
+		elif rpy is not None:
+			raise NotImplementedError()  # rpy_to_rot_matrix
+		else:
+			raise ValueError('Wrong constructor arguments.')
+
+	def to_RPY(self):
+		raise NotImplementedError()  # _rot_matrix_to_rpy_angles
+
+	def to_hom_transform(self):
+		raise NotImplementedError()  # rot_matrix_to_hom_transform
+
+	def to_euler_angles(self):
+		# See RTB's 'tr2eul.m'.
+		raise NotImplementedError()  # rot_matrix_to_euler_angles
+
+	def to_axis_angle(self):
+		# See RTB's 'tr2angvec.m'.
+		raise NotImplementedError()
+
+	def to_OpenGL_compatible(self):
+		raise NotImplementedError()  # make_OpenGL_matrix
+
+	def to_orientation_approach(self):
+		# See RTB's 'tr2angvec.m'.
+		raise NotImplementedError()
+
+	@classmethod
+	def is_rot_matrix(cls, matrix_):
+		# See RTB's 'isrot.m'.
+		raise NotImplementedError()
+
+
+class Quaternion(mxut.Vector4):
+	# See RTB's 'Quaternion.m'.
+	pass
 
 
 def rot_matrix_to_hom_transform(rot_matrix):