Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Question about 3D rotation

1 回表示 (過去 30 日間)
Jiali
Jiali 2020 年 5 月 20 日
閉鎖済み: Jiali 2020 年 6 月 5 日
I tried to rotate a sequence of points in the below sequence:
first-axis: Z, rotation angle is 45 degree; second-axis: X, rotation angle is 30 degree; third-axis:Y, rotation angle is 0 degree.
In my opinion, the above coordinate transformation is equivalent with the spherical coordinate with theta 45 degree and phi 30 degree. However, when I use the dcm2angle, the value of theta is -45 degree and the value of phi is -30 degree. I am really confused about it since I believe that they should be equal. Could you please help me out? Thanks a lot.
clear all;
[X,Y,Z]=ndgrid([-1:0.5:1],[-3:1:3],[-2:0.4:2]);
a=[X(:),Y(:),Z(:)];
a=a.';
R1=rotz(45);
R2=rotx(30);
R3=roty(0);
dcm=R3*R2*R1;
% new coordinate
anew=dcm*a;
figure;scatter3(a(1,:,:),a(2,:,:),a(3,:,:));
hold on;
scatter3(anew(1,:,:),anew(2,:,:),anew(3,:,:));
% the calculation of theta and phi
[pitch,roll,yaw]=dcm2angle(dcm,'ZXY');
pitch=pitch*180/pi;
roll=roll*180/pi;

回答 (0 件)

製品


リリース

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by