坐标系O1和O2,假设点P在坐标系O1中的坐标是{A1,B1,C1},坐标系O1先沿着y轴旋转-90度,再沿着Z轴旋转45度得到坐标系O2,求该点在坐标系O2中的坐标{A2,B2,C2}。
错误解法:
求出O1到O2的旋转旋转矩阵:
3D Rotation Converter (andre-gaschler.com)
R=[ -0.0000000, -0.0000000, -1.0000000;
0.7071068, 0.7071068, 0.0000000;
0.7071068, -0.7071068, 0.0000000 ]
P2=R*P1;
正确解法:
R1=[ 0.0000000, 0.0000000, -1.0000000;
0.0000000, 1.0000000, 0.0000000;
1.0000000, 0.0000000, 0.0000000 ]
R2=[ 0.7071068, -0.7071068, 0.0000000;
0.7071068, 0.7071068, 0.0000000;
0.0000000, 0.0000000, 1.0000000 ]
P2=R2*(R1*P1);
MATLBA代码验证: