为什么.apply()没有像我期望的那样应用旋转


(Pdb) R.from_matrix(R_xy).apply(centered_points[599,:])
array([-0.02405325,  0.00502445,  0.06892317])
(Pdb) (R_xy @ centered_points[599,:].T).T
array([-0.02449478,  0.00437224,  0.06888685])

我希望第二条线是旋转到中心点的正确应用。centered_points是一个1024,3的矢量。从视觉上看,当我检查结果时,#2是正确的,而Scipy是错误的。什么东西?

我发现了这个问题:我从非完全正交向量生成R_xy。这会使所有计算与rot混淆。应用

我无法再现这种行为:

from scipy.spatial.transform import Rotation
rot = Rotation.from_quat((0.7, 0.6, 0.5, 0.4))
# array([[ 0.03174603,  0.34920635,  0.93650794],
#        [ 0.98412698, -0.17460317,  0.03174603],
#        [ 0.17460317,  0.92063492, -0.34920635]])
x = [3, 2, 1]
y1 = rot.as_matrix() @ x
# array([1.73015873, 2.63492063, 2.01587302])
y2 = rot.apply(x)
# array([1.73015873, 2.63492063, 2.01587302])

最新更新