Exemple #1
0
 def to_translation_rotation(self): 
     tra = tr.translation_from_matrix(self.data)
     mat = self.data.copy()
     mat[0:3,3]=0
     try: 
         rot,axis,point = tr.rotation_from_matrix(mat)
     except ValueError: 
         #print "Not a rotation matrix. "
         return None, None, None
     return tra, rot, axis
Exemple #2
0
 def to_translation_rotation(self): 
     tra = tr.translation_from_matrix(self.data)
     mat = self.data.copy()
     mat[0:3,3]=0
     try: 
         rot,axis,point = tr.rotation_from_matrix(mat)
     except ValueError: 
         #print "Not a rotation matrix. "
         return None, None, None
     return tra, rot, axis
Exemple #3
0
 def to_translation_scale_rotation(self): 
     # FIXME
     mat = self.data.copy()
     tra  = tr.translation_from_matrix(mat)
     tra_mat = tr.translation_matrix(tra)
     mat = numpy.dot(numpy.linalg.inv(tra_mat), mat)
     factor, origin, direction = tr.scale_from_matrix(mat)
     scale_mat = tr.scale_matrix(factor, origin, direction)
     scale = numpy.diag(scale_mat) 
     mat = numpy.dot(numpy.linalg.inv(scale_mat), mat) 
     try: 
         rot,rot_axis,point = tr.rotation_from_matrix(mat) 
     except ValueError: 
         #print "Not a rotation matrix. "
         return None, None, None, None
     #print "Rotation axis: ",rot_axis
     return tra, scale, rot, rot_axis
Exemple #4
0
 def to_translation_scale_rotation(self): 
     # FIXME
     mat = self.data.copy()
     tra  = tr.translation_from_matrix(mat)
     tra_mat = tr.translation_matrix(tra)
     mat = numpy.dot(numpy.linalg.inv(tra_mat), mat)
     factor, origin, direction = tr.scale_from_matrix(mat)
     scale_mat = tr.scale_matrix(factor, origin, direction)
     scale = numpy.diag(scale_mat) 
     mat = numpy.dot(numpy.linalg.inv(scale_mat), mat) 
     try: 
         rot,rot_axis,point = tr.rotation_from_matrix(mat) 
     except ValueError: 
         #print "Not a rotation matrix. "
         return None, None, None, None
     #print "Rotation axis: ",rot_axis
     return tra, scale, rot, rot_axis