def rotation_matrix(bone, tx, ty, tz):
# Construct rotation matrix M
tx = np.deg2rad(tx)
ty = np.deg2rad(ty)
tz = np.deg2rad(tz)
Mx = np.matrix([[1, 0, 0],
[0, np.cos(tx), np.sin(tx)],
[0, -np.sin(tx), np.cos(tx)]])
My = np.matrix([[np.cos(ty), 0, -np.sin(ty)],
[0, 1, 0],
[np.sin(ty), 0, np.cos(ty)]])
Mz = np.matrix([[np.cos(tz), np.sin(tz), 0],
[-np.sin(tz), np.cos(tz), 0],
[0, 0, 1]])
M = Mx * My * Mz
L = bone.Cinv * M * bone.C
return L
评论列表
文章目录