Filter löschen
Filter löschen

How to rotate axis by 180 degree?

10 Ansichten (letzte 30 Tage)
CL
CL am 21 Sep. 2022
Kommentiert: CL am 21 Sep. 2022
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;

Antworten (1)

Chunru
Chunru am 21 Sep. 2022
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 Kommentare
CL
CL am 21 Sep. 2022
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 am 21 Sep. 2022
ok ... I guess I'll just reverse the Y axis as well then to return to the right-hand orientation. thanks

Melden Sie sich an, um zu kommentieren.

Tags

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by