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