def rotation_matrix_around_vec( axis: mp.XYZ, theta: float ): """ calcualted the rotation matrix to roatate an boject around axis theta radian degrees based on: http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/ and http://stackoverflow.com/questions/6802577/python-rotation-of-3d-vector """ return linalg.expm3(np.cross(np.eye(3), axis.as_list()/np.float64(linalg.norm(axis.as_list()))*theta))
def rotation_matrix_around_vec(axis: mp.XYZ, theta: float): """ calcualted the rotation matrix to roatate an boject around axis theta radian degrees based on: http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/ and http://stackoverflow.com/questions/6802577/python-rotation-of-3d-vector """ return linalg.expm3( np.cross( np.eye(3), axis.as_list() / np.float64(linalg.norm(axis.as_list())) * theta))