旋转矩阵是正交矩阵。这意味着它的逆与转置相同,或者等效地,所有行或所有列都是正常的(即单位长度和彼此正交的)。
如果您打印出旋转矩阵,则可以
[[ 0.06007468 0.56167836 -0.10374915]
[-0.56167836 0. -0.32523301]
[-0.10374915 0.32523301 0.17917509]]
这里是另一种旋转矩阵例程:
def rotMat( a, theta ): # rotation matrix for a rotation of angle theta about axis a
R = np.zeros( ( 3, 3 ) )
n = a / np.linalg.norm( a )
C = np.cos( theta )
S = np.sin( theta )
R[0,0] = C + n[0] * n[0] * ( 1.0 - C )
R[0,1] = n[0] * n[1] * ( 1.0 - C ) - n[2] * S
R[0,2] = n[0] * n[2] * ( 1.0 - C ) + n[1] * S
R[1,1] = C + n[1] * n[1] * ( 1.0 - C )
R[1,2] = n[1] * n[2] * ( 1.0 - C ) - n[0] * S
R[1,0] = n[1] * n[0] * ( 1.0 - C ) + n[2] * S
R[2,2] = C + n[2] * n[2] * ( 1.0 - C )
R[2,0] = n[2] * n[0] * ( 1.0 - C ) - n[1] * S
R[2,1] = n[2] * n[1] * ( 1.0 - C ) + n[0] * S
return R
您可以在代码中调用它
rotation_matrix = rotMat( rotation_axis, theta )
,然后我认为你的cuboid还可以。