diff options
Diffstat (limited to 'Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf')
-rw-r--r-- | Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf new file mode 100644 index 00000000000..266ec217ae8 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf @@ -0,0 +1,39 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% CLIPSQU.MF (Sierpi\'nski's carpet) +% --- +input mftoeps; eps_mode_setup; +% --- +def ^ = ** enddef; % syntactic sugar +primarydef i // n = % ditto + (if n=0: 0 else: i/n fi) +% why not to divide by 0? +enddef; +def shifted_accordingly(expr i,j,n,D)= + shifted ((i//n)[0,w-D],(j//n)[0,w-D]) +enddef; +% --- +w#=16mm#; h#=16mm#; define_pixels(w,h); +for N:=1,2,3: % 4, 5, 6, ..., infinity + set_BB 0,0,w,h; + write_preamble jobname & decimal(N); + D:=3w; + for n:=0 for q:=1 upto N-1: , 3^q-1 endfor: +% i.e., |for n:=0, 3^1-1, 3^2-1, ..., 3^(N-1)-1:| + path p[], q[]; D:=1/3D; k:=-1; + for i:=0 upto n: for j:=0 upto n: + k:=k+1; + p[k]=unitsquare scaled D + shifted_accordingly(i,j,n,D); + q[k]=reverse unitsquare scaled 1/3D + shifted (1/3D,1/3D) shifted_accordingly(i,j,n,D); + endfor; endfor; + clip_C p0, q0 for i:=1 upto k: , p[i], q[i] endfor; + endfor; + fill_C unitsquare scaled w; + write_postamble; +endfor; +% --- +end. |