% --- start of displayed preamble in the book --- input hatching; % star macro defined as above % --- end of displayed preamble in the book --- % graphic converted to gray in book using 'color2gray' vardef star(expr n) = for i_:=0 upto 2n-1: if odd i_: 1/2 fi (right rotated (180*(i_/n))) -- endfor cycle enddef; defaultfont:="ptmr8r"; warningcheck:=0; beginfig(1) path p; p:=star(10) xscaled 20mm yscaled 20mm; save draw_hatched_band; vardef draw_hatched_band(expr za,zb,a,l,d) = save n_; n_:=length(za-zb)/l; for i_:=0 upto ceiling n_: fill star(10) xscaled 2/5l yscaled 2/5l shifted (i_/n_)[za,zb] withcolor (i_/n_)[green,blue]; endfor enddef; hatchfill p withcolor (red+green) withcolor (45,10bp,-1bp); endfig; end;