function B=transUH(A)
% function B=transUH(A)
% shows the effect of a linear transformation given by the 2x2
% matrix A on the polygon in the shape of UH
%
% Output: Matrix containing x-coordinates of the image points in first row
% and y-coordinates in second row

% define UH polygon

X=[0 0 1 1 1 2 2 2];
Y=[2 0 0 2 1 1 2 0];

B=zeros(2,8);
B(1,:)=X;
B(2,:)=Y;

B=A*B;

Xnew=B(1,:);
Ynew=B(2,:);

figure, plot(X,Y,'-','LineWidth',4)
grid on
axis([min(min(X),min(Xnew))-1 max(max(X),max(Xnew))+1 min(min(Y),min(Ynew))-1 max(max(Y),max(Ynew))+1])

title('Input')


figure, plot(Xnew,Ynew,'-','LineWidth',4)
grid on
axis([min(min(X),min(Xnew))-1 max(max(X),max(Xnew))+1 min(min(Y),min(Ynew))-1 max(max(Y),max(Ynew))+1])

title('Output')


