summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/4-1-9.mp
diff options
context:
space:
mode:
Diffstat (limited to 'info/examples/lgc2/4-1-9.mp')
-rw-r--r--info/examples/lgc2/4-1-9.mp37
1 files changed, 37 insertions, 0 deletions
diff --git a/info/examples/lgc2/4-1-9.mp b/info/examples/lgc2/4-1-9.mp
new file mode 100644
index 0000000000..58c8d8fb87
--- /dev/null
+++ b/info/examples/lgc2/4-1-9.mp
@@ -0,0 +1,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;