function out=catt(A,cc) % % CATT(A,cc). A is a 2x2 real matrix. cc is a (1,3)-color vecor. % SELFDEMONSTRATING whne called w/o paramters. % % Visualizing linear transformations of the plane by their % effects on a cat's face. Good ewxample for block-multipli- % cation of matrices: Each column is one vertex! % An older file cat.m has been retired due to name conflicts. % Revised Dec.12, 1996: Documentation added April 1999. % Revisions: April 1999 documentation added. % July 1999: Added axis-equal, initial clf % All rights reserved. Matt Kawski. http://math.la.asu.edu/~kawski % Define the vertices for the face. % clf axis equal format short topx=[1 .98 .8 .83 .8 .77 .5 .25 0 -.25 -.5 -.8 -.8 -.98 -1]; topy=[0 .15 .7 1.15 1.03 1.15 .85 .95 1 .95 .85 1.2 .7 .15 0]; botx=-cos(pi*[1:10]/10); boty=-sin(pi*[1:10]/10); wiskx=[.2 1.3 .2 1.4 .2 1.4 .2 1.3 .2 .17 .13 .08 .03 0]; wisky=[ 0 .3 0 .1 0 -.1 0 -.3 0 .1 -.1 .1 -.1 0]-.2; xeye=[0 .2 .3 .4 .43 .45 .43 .4 .37 .35 .37 .4 .5 .6 .5 .4 .3 .2 0]; yeye=[.5 .5 .43 .4 .42 .5 .58 .6 .58 .5 .42 .4 .43 .5 .57 .6 .57 .5 .5]-.2; x=[topx,botx,wiskx,xeye,-xeye,fliplr(-wiskx)]; y=[topy,boty,wisky,yeye, yeye,fliplr(wisky)]; % % Draw the original face. % fill(x,y,[0,.3,1]) plot(x,y,'m-') % pts=[x;y]; % % Apply the linear transformation. If none given use random % 2x2 matrix with INTEGER VALUES (quite often singular!) % if nargin < 1 A=floor(5*rand(2,2)-2) end Apts=A*pts; % % Overlay the transformewd image. % xnew=Apts(1,:); ynew=Apts(2,:); axis(5*[-1,1,-1,1]) hold on if nargin < 2 cc=rand(1,3) end fill(xnew,ynew,cc) % % Replot the original face as it may have been covered up. % plot(x,y,'m-')