function []=cloud(n);

%Fractal Cloud
%Jennifer Shih
%EPS 109, Fall 2012

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Zero generation is a long rectangle that I chose
S=[0 0 8 8 7 6 5 4 3 2 1 0;0 1 1 0 0 0 0 0 0 0 0 0];

%initialize
index=1;
while index <= n
    len=length(S(1,:));
    for i = 1: (len-1)
        k=S(:, i+1) -S(:,i); %Change in the length of side
        rota=[0 -1; 1 0]* k; %rotate k
        T(:,4*(i-1)+1)= S(:,i); %6 Transformations
        T(:,4*(i-1)+2)= S(:,i)+(3/10)*k;
        T(:,4*(i-1)+3)= S(:,i)+(2/5)*k+(1/5)*rota;
        T(:,4*(i-1)+4)= S(:,i)+(3/5)*k+(1/5)*rota;
        T(:,4*(i-1)+5)= S(:,i)+(7/10)*k;
        T(:,4*(i-1)+6)= S(:,i+1);
        
    end
    index=index+1;
    S=T;
end
%print
plot (S(1,:),S(2,:)), axis('equal')