summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/4-4-7.mp
blob: 4ca0cdac3ca48493aa9d6b1f1199577b67cf5f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% --- start of displayed preamble in the book ---

% --- end of displayed preamble in the book ---
% graphic converted to gray in book using 'color2gray'
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
numeric psi,iter,c,r,t,cv;
path p;
psi=137.6;
iter=200;
c=5;
r=0;
for i=iter downto 1:
  t:=sqrt(i);
  r:=(r+psi) mod 360;
  cv:=cosd((i/iter)*90);
  p:=((0,0)--(t,1)--
      (t+1,0)--(t,-1)--cycle)
     rotated r;
  fill p scaled c withcolor (1,cv,0);
  draw p scaled c;
endfor;
endfig;
end;