问题描述
我有一个包含多个旋转的 scipy.spatial.transform.Rotation
:
from scipy.spatial.transform import Rotation
rot = Rotation.from_matrix([[[-1,0],[ 0,1,-1]],[[ 0,1],[-1,0]],[[ 1,-1,0]]])
我想获得旋转
total = rot[0] * rot[1] * rot[2]
顺便说一下,这是绕轴 [1,1] / cbrt(3)
旋转 120 度。在更一般的情况下,我可以编写循环:
total = Rotation.identity()
for r in rot:
total *= r
或
total = functools.reduce(Rotation.__mul__,rot)
是否有可用的内置方法来执行此操作?
方法 Rotation.reduce
看起来很有前途,但似乎完全是在做其他事情。
顺便说一句,这似乎是目前最快的方法:
Rotation.from_matrix(functools.reduce(np.dot,rot.as_matrix()))
不幸的是,以下方法不起作用:
np.matmul.reduce(rot.as_matrix(),axis=0)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)