Debian Codegraph @

texmf-dist/source/metafont/roex/roexsamp/roes-02.mf

raw
1 %%%%
2 %%%% This file belongs to the ROEX package.
3 %%%%
4 %%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
5 %%% draw fix_fill_cmyk fix_draw_cmyk
6 % ROES-02.MF, ``DOORMAT'':
7 % Another example making use of both expanding stroke and removing overlaps;
8 % ---
9 input mftoeps; eps_mode_setup; input roex;
10 tracingexpanding:=1; tracingremoving:=1;
11 % ---
12 beginchar("0",1in#,1in#,0);
13 path A[\\],B[\\];
14 A.n:=5; B.n:=5; % large values may cause exceedingly long processing...
15 A.b:=(1/(2A.n+1))*w; B.b:=(1/(2B.n+1))*h;
16 for i:=1 upto A.n:
17 A[i]:=((0,0)..(-1/2A.b,1/3h)..(1/2A.b,2/3h)..(0,h)) shifted ((2i-.5)*A.b,0);
18 endfor
19 for i:=1 upto B.n:
20 B[i]:=((0,0)..(1/3w,-1/2B.b)..(2/3w,1/2B.b)..(w,0)) shifted (0,(2i-.5)*B.b);
21 endfor
22 expand_stroke(make_list(1,A.n)A, make_list(1,B.n)B)(1/2A.b)R;
23 remove_overlap(make_list(1,R.num)R)()R;
24 find_BB make_list(1,R.num) R;
25 write_preamble jobname;
26 for i:=1 upto R.num:
27 fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
28 draw_C R[i];
29 endfor;
30 write_postamble;
31 endchar;
32 end.
33 %%\end