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

vardef polcurve(text f)(expr c,a,b,n)=
  save delta,_r,_a;
  delta=(b-a)/n;
  draw (c+f(a)*dir(a))
  for i:=0 upto n-1:
    hide(
    _a:=a+i*delta;
    _r:=f(_a);)
    ..(c+f(_a+delta)*dir(_a+delta))
  endfor;
enddef;
% --- end of displayed preamble in the book ---
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
polcurve(r)(origin,0,1150,1000);
endfig;
end;