%% House

%% Definition of matrixes and variabels

% Vectors of 
h1=[2;0]; h2=[3;0]; h3=[3;1];
h4=[4;1]; h5=[4;0]; h6=[6;0];
h7=[6;2]; h8=[4;3]; h9=[2;2];
h=[h1 h2 h3 h4 h5 h6 h7 h8 h9 h1];
h=[h
ones(1,length(h))];

s=2; % seconds to pause
clf; % clear prev runs

%% Plot of house
plot_house('House 0 - original', h);
pause(s)

%% 1 Reflection
T1=[-1 0 0
    0 1 0
    0 0 1]; % reflect in y-axis
h=T1*h;
plot_house('House 1 - reflection', h);
pause(s)

%% 2 Rotation
v2=pi/2; % 90 degrees
T2=[cos(v2) -sin(v2) 0
    sin(v2) cos(v2) 0
    0 0 1]; % rotate 90 CCW
h=T2*h;

plot_house('House 2 - rotation', h);
pause(s)

%% 3 Translation
T3=[1 0 4
    0 1 4
    0 0 1]; % move +4 in x & +4 in y
h=T3*h;
plot_house('House 3 - translation', h);
pause(s)

%% 4 Reflection
Ta=[1 0 -4
    0 1 0
    0 0 1]; % translate -4 in x = origo
Tb=[1 0 4
    0 1 0
    0 0 1]; % translate +4 in x = origo
T4=T1; % reflect in y-axis
h=Tb*T4*Ta*h;
plot_house('House 4 - reflection', h);
pause(s)

%% 5 Rotation
h=Tb*T2*Ta*h; % translate to origo, rotate 90 CCW, translate back to start position
plot_house('House 5 - rotation', h);