Professional Documents
Culture Documents
2DT
2DT
if type == 1 % Translation
p = 2;
q = 2;
TRANS = [1 0 p;…
0 1 q;…
0 0 1];
MAT = TRANS;
theta = 45;
0 0 1];
MAT = ROT;
shy = 1.5;
SHEARY = [1 0 0;…
shy 1 0;…
0 0 1];
MAT = SHEARY;
end
newpoint = MAT*oldpoint;
end
Ax = 3; % X Coordinate of point A
Ay = 1; % Y Coordinate of point A
Bx = 3; % X Coordinate of point B
By = 4; % Y Coordinate of point B
Cx = 8; % X Coordinate of point C
Cy = 4; % Y Coordinate of point C
Dx = 8; % X Coordinate of point D
Dy = 1; % Y Coordinate of point D
hold on
hold on
hold on
% Tutorial 1(a)
Aold = [Ax;Ay;1];
Bold = [Bx;By;1];
Cold = [Cx;Cy;1];
Dold = [Dx;Dy;1];
OldPos = [Aold,Bold,Cold,Dold];
NewPos= trans2d(1,OldPos);
%OldPos = NewPos;
%NewPos = trans2d(3,OldPos);
%OldPos = NewPos;
%NewPos = trans2d(2,OldPos);
Axnew = NewPos(1,1);
Aynew = NewPos(2,1);
Bxnew = NewPos(1,2);
Bynew = NewPos(2,2);
Cxnew = NewPos(1,3);
Cynew = NewPos(2,3);
Dxnew = NewPos(1,4);
Dynew = NewPos(2,4);
hold on
hold on