% uses Strang's house figure to show trans,..caffine,..biquadratic

 hx=[-6 -6 -7 0 7 6  6 -3 -3  0  0 -6];
 hy=[ -7  2  1 8 1 2 -7 -7 -2 -2 -7 -7];
 h=hx+i*hy;

 plot(h);axis('image')
 title('Strang''s original example')

figure
%hx=[-9 -9 -10 0  10 9  9 -3.5 -3.5  0  0 -9 NaN -.5  -.5   NaN -7 -7 -5 -5 -7 NaN -3 -3 -1 -1 -3 NaN 1 1 3 3 1 NaN 5 5 7 7 5 NaN -7 -7 -5 -5 -7 NaN -3 -3 -1 -1 -3 NaN 1 1 3 3 1 NaN 5 5 7 7 5];
%hy=[-8  7  6  16  6 7 -8 -8    -1  -1 -8 -8 NaN -4.5 -3.5 [NaN  5  7  7  5  5 NaN  5  7  7  5  5 NaN 5 7 7 5 5 NaN 5 7 7 5 5 NaN  1  3  3  1  1 NaN  1  3  3  1  1 NaN 1 3 3 1 1 NaN 1 3 3 1 1]-.5];
roofx=[linspace(-10,0) linspace(0,10)];
roofy=[linspace(6,16)  linspace(16,6)];
facex=[9  9 -3.5 -3.5  0  0 -9 -9 NaN -.5  -.5];
facey=[7 -8 -8    -1  -1 -8 -8  7 NaN -4.5 -3.5];
windowsx=[-7 -7 -5 -5 -7 NaN -3 -3 -1 -1 -3 NaN 1 1 3 3 1 NaN 5 5 7 7 5 NaN -7 -7 -5 -5 -7 NaN -3 -3 -1 -1 -3 NaN 1 1 3 3 1 NaN 5 5 7 7 5];
windowsy=[ 5  7  7  5  5 NaN  5  7  7  5  5 NaN 5 7 7 5 5 NaN 5 7 7 5 5 NaN  1  3  3  1  1 NaN  1  3  3  1  1 NaN 1 3 3 1 1 NaN 1 3 3 1 1]-.5;
hx=[facex NaN windowsx NaN roofx];
hy=[facey NaN windowsy NaN roofy];

h=hx+i*hy;
%subplot(221);plot(h);axis('image');title('original')
handle=axes('position',[0 .33 .2 .33]);plot(h);axis('image');
set(handle,'visible','off')
xlabel('(ORIGINAL)')

H=[hx;hy];

A=[.9 .1;.5 .9];
G=A*H;
g=G(1,:)+i*G(2,:);
%subplot(222);plot(g);axis('image');title('affine')
handle=axes('position',[.2 .33 .2 .33]);plot(g);axis('image');
set(handle,'visible','off')
xlabel('(AFFINE)')

% q-chirp
pux=1; puy=0; puxy=0; puxx=-.03; pu=0;
pvx=0; pvy=1; pvxy=0; pvyy=0; pv=0;
gx=pux*hx + puy*hy + puxy*hx.*hy +puxx*hx.*hx +pu*ones(size(hx));
gy=pvx*hx + pvy*hy + pvxy*hx.*hy +pvyy*hy.*hy +pv*ones(size(hx));
g=gx+i*gy;
%subplot(223);plot(g);axis('image');title('q-chirp')
handle=axes('position',[.8 .33 .2 .2]);plot(g);axis('image');
set(handle,'visible','off')
xlabel('(BIQUADRATIC)')

% for corr2p:
x=[-7 -7  7  7];
y=[ 1  3  1  3];
u=[-7 -7  7  7];
v=[ 0  4  1  3];
[a b c d e f g h]=corr2p(x,y,u,v);
G=[a b c;d e f;g h 1]*[H;ones(1,length(H))]; % assume H at least 2 wide
gx=G(1,:)./G(3,:);
gy=G(2,:)./G(3,:);
g=gx+i*gy;
%subplot(224);plot(g);axis('image');title('p-chirp')
handle=axes('position',[.4 .33 .2 .33]);plot(g);axis('image');
%set(h,'Box','off')
%set(h,'linewidth',0)
% set(h,'ticklength',[0,0]) % not needed
%set(h,'xtick',NaN) % get rid of numbers
%set(h,'ytick',NaN) % get rid of numbers
set(handle,'visible','off') % turns off all but plot.
xlabel('(PROJECTIVE)')

% bilinear
pux=1; puy=0; puxy=0; pu=0;
pvx=0; pvy=1; pvxy=-.05; pv=0;
gx=pux*hx + puy*hy + puxy*hx.*hy +pu*ones(size(hx));
gy=pvx*hx + pvy*hy + pvxy*hx.*hy +pv*ones(size(hx));
g=gx+i*gy;
%subplot(223);plot(g);axis('image');title('bilinear')
handle=axes('position',[.6 .33 .2 .33]);plot(g);axis('image');
set(handle,'visible','off')
xlabel('(BILINEAR)')

