summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/4-1-9.mp
blob: 58c8d8fb876c0e2aabd7b4bd907eefb45a7c3928 (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
26
27
28
29
30
31
32
33
34
35
36
37
% --- start of displayed preamble in the book ---
vardef hatch(expr pth, angle, shift, trace)=
  save pic,support,st;
  picture pic;
  path support;
  pair st;
  st=shift*dir(angle+90);
  support=((37cm*left)--(37cm*right)) rotated angle;
  if trace=1:drawoptions(dashed evenly);fi;
  pic=image(
    for j=-200 upto 200:
      if ((support shifted (j*st))
           intersectiontimes pth) <> (-1,-1):
        draw support shifted (j*st);
      fi
    endfor;
    );
  clip pic to pth;
  drawoptions();
  pic
enddef;
% --- end of displayed preamble in the book ---
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
path p,q,r;
p=fullcircle scaled 3cm;
draw hatch(p,45,2mm,0) withcolor red;
draw p;
q=(p scaled .75) shifted (1.5cm,5cm);
draw hatch(q,10,2mm,1);
draw q;
r=(0,100)..(0,50)..(60,90)..(60,60)..cycle;
draw hatch(r,150,1mm,1) withcolor blue;
draw r;
endfig;
end;