📄 exm07222_1.m
字号:
%exm07222_1.m
shg,clf
p1=[-0.5,0,1]';p2=[-0.5,1,1]';p3=[0.5,1,1]';p4=[0.5,0,1]';
Sq=[p1,p2,p3,p4,p1];
%
dx=0.5;dy=1;T=[1,0,dx;0,1,dy;0,0,1];
%
th=pi/6;R=[cos(th),-sin(th),0;sin(th),cos(th),0;0,0,1];
%
alpha=2;beta=3;S=[alpha,0,0;0,beta,0;0,0,1];
E=eye(3,3); %<10>
TRS={E,T,R,S}; %<11>
ss={'r^','rd','rp','rh'}; %<12>
tt={'Original Square','Translation','Rotation','Scaling'};%<13>
for i=1:4
W=TRS{i}*Sq;
subplot(2,2,i)
for k=1:4
plot(W(1,k),W(2,k),ss{k}); %<19>
axis([-3,3,-1,5]),axis equal
hold on %<21>
end
plot(W(1,:),W(2,:)) %<23>
grid on
title(tt{i})
hold off
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -