function out=ccat(z,cc) % % CCAT(z,cc). z is a complex number. cc is a (1,3)-color vecor. % SELFDEMONSTRATING when called w/o parameters. % % Visualizing multiplication by a complex number by its % effects on a cat's face. % % Author: Matthias Kawski. http://math.asu.edu/~kawski % All rights reserved. % Date: September 2002. % Updates: None yet. % 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. % pts = x + i*y; % fill(x,y,[0,.3,1]) plot(x,y,'m-') % % % Apply the linear transformation. % If none is given, a random COMPLEX INTEGER is generated % if nargin < 1 z = floor(5*rand(1,1)-2) + i * floor(5*rand(1,1)-2); end newpts = z * pts; % % Overlay the transformed image. % xnew = real( newpts ) ynew = imag( newpts ) 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-') axis('equal')