필터 지우기
필터 지우기

How to rotate axis by 180 degree?

조회 수: 10 (최근 30일)
CL
CL 2022년 9월 21일
댓글: CL 2022년 9월 21일
By default, Matlab plots the my three unit vectors (x,y,z) in a way that the z-axis points up. How can I "roll" the orientation around the x-axis by 180 degrees so I can have the z-axis unit vector points down positively?
The right-hand rule has to be preserved - I'm not flipping any of the axis.
x=[1;0;0];
y=[0;1;0];
z=[0;0;1];
quiver3(0,0,0,x(1),x(2),x(3),'Color','green','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,y(1),y(2),y(3),'Color','blue','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,z(1),z(2),z(3),'Color','red','LineWidth',2,'MaxHeadSize',0.5);
axlims = norm(x)*1.2;
set(gca,'xlim',[-1,1]*axlims,'ylim',[-1,1]*axlims,'zlim',[-1,1]*axlims);
grid on;
axis square;

답변 (1개)

Chunru
Chunru 2022년 9월 21일
x=[1;0;0];
y=[0;1;0];
z=[0;0;1];
quiver3(0,0,0,x(1),x(2),x(3),'Color','green','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,y(1),y(2),y(3),'Color','blue','LineWidth',2,'MaxHeadSize',0.5);
hold on;
quiver3(0,0,0,z(1),z(2),z(3),'Color','red','LineWidth',2,'MaxHeadSize',0.5);
axlims = norm(x)*1.2;
set(gca,'xlim',[-1,1]*axlims,'ylim',[-1,1]*axlims,'zlim',[-1,1]*axlims);
grid on;
axis square;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(gca, 'ZDir', 'reverse')
  댓글 수: 2
CL
CL 2022년 9월 21일
Ah no - as shown in both images in the question, both orientations has to obey the right-hand-rule. Reversing the orientation would break the the right-hand orientation and direction of rotation. I should have specified it better.
CL
CL 2022년 9월 21일
ok ... I guess I'll just reverse the Y axis as well then to return to the right-hand orientation. thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by