summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/metafont/roex/roexsamp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-11 23:49:34 +0000
committerKarl Berry <karl@freefriends.org>2006-01-11 23:49:34 +0000
commit0bf7dc87971bc4f426fb6abdd893a26a6ae65d0b (patch)
tree4d53bded23dec78efc81b258f039469fa2832271 /Master/texmf-dist/source/metafont/roex/roexsamp
parentd780c57e68c80655669a3b01af46b9978f5698ef (diff)
trunk/Master/texmf-dist/source/metafont
git-svn-id: svn://tug.org/texlive/trunk@116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/metafont/roex/roexsamp')
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc69
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf29
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf32
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf43
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf26
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf33
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf34
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf49
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf45
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf150
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf102
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf38
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf33
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf49
-rw-r--r--Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf91
15 files changed, 823 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc b/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc
new file mode 100644
index 00000000000..86336cf613b
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc
@@ -0,0 +1,69 @@
+This file belongs to the ROEX package.
+
+-----------------------------------------------------------------------------
+
+The directory ROEXSAMP contains this file (0ROEXSAM.DOC) and 14 examples
+of using ROEX with the MFTOEPS package.
+
+WARNING: processing some of the files may last a while; in braces are
+shown computing times for mf386 (version 2.71 [3c-beta5]) run on 486 Intel PC
+with 66MHz clock.
+
+ ES-01.MF, ``SQUARE'' (3 seconds):
+ A trivial example, expanding stroke applied to a square.
+ ES-02.MF, ``PARALLELOGRAM'' (4 seconds):
+ Another trivial example: expanding stroke applied
+ to a parallelogram.
+ ES-03.MF, ``COGWHEEL'' (7 seconds):
+ Expanding stroke applied to a somewhat complex object.
+ RO-01.MF, ``PROPELLER'' (14 seconds):
+ Removing overlaps applied to a circle and three rectangles;
+ rectangles are positively oriented, circle is negatively
+ oriented and has weight |2|.
+ RO-02.MF, ``ENCIRCLED CROSS 1'' (4 seconds):
+ Removing overlaps applied to a positively oriented circle
+ and two negatively oriented rectangles.
+ RO-03.MF, ``ENCIRCLED CROSS 2'' (4 seconds):
+ An example very similar to RO-02.MF; removing overlaps applied
+ to a negatively oriented circle and two positively oriented
+ rectangles, background colour is set to |1| (default is |0|).
+ RO-04.MF, ``EOFILL'' (30 seconds):
+ Removing overlaps performed in two stages; emulates
+ even-odd filling rule
+ RO-05.MF, ``GERBERA'' (3 minutes, 51 seconds):
+ Areas covered a specified number of times are collected
+ separately using the macro |recombine_edges| (performing
+ the last step of removing overlaps), and each area is painted
+ with a different colour, yielding a gerbera-like form.
+ RO-06.MF, ``EL PALO ALTO TREE'' (57 seconds):
+ A tough example (see remarks in the code) excerpted from
+ The \MF{}book, pages 124 thru 126.
+ RO-07.MF, ``LOGO OF JOURNAL OF ALGORITHMS'' (28 seconds):
+ Another example excerpted from The \MF{}book,
+ pages 137 thru 139.
+ ROES-01.MF, ``SUN'' (55 seconds):
+ An example making use of both expanding stroke
+ and removing overlaps.
+ ROES-02.MF, ``DOORMAT'' (1 minute, 34 seconds):
+ Another example making use of both expanding stroke
+ and removing overlaps;
+ ROES-03.MF, ``OLYMPIC CIRCLES'' (1 minute, 1 second):
+ Yet another example making use of both expanding
+ stroke and removing overlaps; it also demonstrates
+ repositioning of the picture in such a way that the lower
+ left corner of the bounding box coincides with the origin
+ of coordinate system.
+ ROES-04.MF, ``STAR FLOWERS'' (3 minutes, 4 seconds):
+ An example of removing overlaps of a single
+ self-intersecting curve; three EPS files are generated.
+
+You are entitled to do with these files whatever you wish.
+If you alter a file, however, please remove the comment line:
+
+ `This file belongs to the ROEX package.'
+
+in order to avoid mess.
+
+-----------------------------------------------------------------------------
+
+END OF THE 0ROEXSAMP.DOC FILE
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf
new file mode 100644
index 00000000000..c2ccc77d17c
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf
@@ -0,0 +1,29 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ES-01.MF, ``SQUARE'':
+% A trivial example, expanding stroke applied to a square.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1;
+% ---
+beginchar("0",cm#,cm#,0);
+ expand_stroke (unitsquare xscaled w yscaled h) (1mm) R;
+% find_BB make_list(1,R.num) R;
+ find_BB R1,R2; % R.num=2
+ write_preamble jobname;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf
new file mode 100644
index 00000000000..037091afe12
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf
@@ -0,0 +1,32 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ES-02.MF, ``PARALLELOGRAM'':
+% Another trivial example: expanding stroke applied to a parallelogram.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1;
+% ---
+beginchar("0",1/10in#,in#,0);
+ path p; p=((1/2w,0)--(1/4w,1/4h)--(0,1/2h)--(1/2w,h)--(w,1/2h)--cycle);
+ miter_size:=w;
+ expand_stroke (p) (2/5w) R;
+% change_weight (p) (2/5w) R;
+ find_BB make_list(1,R.num) R;
+ write_preamble jobname;
+ fix_draw_cmyk 0,0,0,1; draw_C p;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf
new file mode 100644
index 00000000000..b21da0d9baf
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf
@@ -0,0 +1,43 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ES-03.MF, ``COGWHEEL'':
+% Expanding stroke applied to a somewhat complex object, |miter_size|
+% set to zero.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1;
+% ---
+vardef flex_polyg(expr n,a) =
+ save zz; pair zz[\\];
+ for i:=0 upto n-1:
+ zz[i]:=up rotated (i*(360/n));
+ endfor
+ (zz0
+ for i:=1 upto n:
+ {(zz[i mod n]-zz[i-1]) rotated a}..{(zz[i mod n]-zz[i-1]) rotated -a}
+ if i=n: cycle else: zz[i] fi
+ endfor
+ ) scaled .5
+enddef;
+% ---
+beginchar("0",in#,in#,0);
+ b:=.5mm; path p; p=flex_polyg(17,60) scaled w shifted (1/2w,1/2h);
+ miter_size:=0bp; expand_stroke (p) (b) R;
+% miter_size:=0bp; change_weight(p) (b) R;
+ find_BB R1,R2;
+ write_preamble jobname;
+ draw_C R1,R2;
+ write_postamble;
+ for i:=1,2:
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf
new file mode 100644
index 00000000000..6b4551eccdc
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf
@@ -0,0 +1,26 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% RO-01.MF, ``PROPELLER'':
+% Removing overlaps applied to a circle and three rectangles; rectangles
+% are positively oriented, circle is negatively oriented and has weight |2|.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path A,B,C,D;
+ A=unitsquare xscaled 1/5w yscaled h shifted (2/5w,0);
+ B=A rotatedaround((1/2w,1/2h), 60);
+ C=B rotatedaround((1/2w,1/2h), 60);
+ D=reverse fullcircle scaled 3/4w shifted (1/2w,1/2h);
+ remove_overlap (A,B,C,D) ((4,2)) R;
+ find_BB make_list(1,R.num) R;
+ write_preamble jobname;
+ fill_C make_list(1,R.num) R;
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf
new file mode 100644
index 00000000000..ce5a058219b
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf
@@ -0,0 +1,33 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% RO-02.MF, ``ENCIRCLED CROSS 1'':
+% Removing overlaps applied to a positively oriented circle and two
+% negatively oriented rectangles.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path A,B,C;
+ A=fullcircle scaled w shifted (1/2w,1/2h);
+ B=reverse unitsquare xscaled 1/5w yscaled 3/5w shifted (2/5w,1/5w);
+ C=B rotatedaround((1/2w,1/2h), 90);
+ remove_overlap (A,B,C) () R;
+ set_BB 0,0,w,h;
+ write_preamble jobname;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf
new file mode 100644
index 00000000000..988c018b1a1
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf
@@ -0,0 +1,34 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% RO-03.MF, ``ENCIRCLED CROSS 2'':
+% An example very similar to RO-02.MF; removing overlaps applied to
+% a negatively oriented circle and two positively oriented rectangles,
+% background colour is set to |1| (default is |0|).
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path A,B,C;
+ A=reverse fullcircle scaled w shifted (1/2w,1/2h);
+ B=unitsquare xscaled 1/5w yscaled 3/5w shifted (2/5w,1/5w);
+ C=B rotatedaround((1/2w,1/2h), 90);
+ background_color:=1; remove_overlap (A,B,C) () R;
+ set_BB 0,0,w,h;
+ write_preamble jobname;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf
new file mode 100644
index 00000000000..7704db948af
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf
@@ -0,0 +1,49 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk roex_default
+% RO-04.MF, ``EOFILL'':
+% Removing overlaps performed in two stages: first stage removes overlaps
+% using even-odd filling rule, the second stage restores default meanings
+% of |good_colors| and |touch_path| and performs ``traditional'' removing
+% overlaps on the result of stage 1 and a positively oriented rectangle.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path A,B,C,D,E,F;
+ A=fullcircle scaled 1w shifted (1/2w,1/2h);
+ B=fullcircle scaled 4/5w shifted (1/2w,1/2h);
+ C=fullcircle scaled 3/5w shifted (1/2w,1/2h);
+ D=fullcircle scaled 2/5w shifted (1/2w,1/2h);
+ E=unitsquare xscaled 1/5w yscaled 9/10h shifted (2/5w,1/20h);
+ F=unitsquare xscaled 7/5w yscaled 1/5h shifted (-1/5w,2/5h);
+%
+% STAGE 1: remove overlaps for |A|, |B|, |C|, |D| and |E| using
+% the `eofill' rule (the re-definition of |touch_path| is superfluous here,
+% but recommended in a general case):
+ vardef good_colors(expr i,o) = odd(i) and odd(o+1) enddef;
+ vardef touch_path(expr p) = pos_turn(p) enddef;
+ remove_overlap (A,B,C,D,E) () R;
+% STAGE 2: remove overlaps for |F| and the paths resulting from the stage 1:
+ roex_default good_colors, touch_path;
+ remove_overlap (F,make_list(1,R.num) R) () R;
+%
+ find_BB make_list(1,R.num) R;
+ write_preamble jobname;
+ fix_fill_cmyk 0,0,0,1/10;
+ fill_C make_list(1,R.num) R;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor;
+ write_postamble;
+endchar;
+end.
+%%\end
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf
new file mode 100644
index 00000000000..bac4bb8d7d8
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf
@@ -0,0 +1,45 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% RO-05.MF, ``GERBERA'':
+% Non-standard application of removing overlaps; areas covered a specified
+% number of times are collected separately using the macro |recombine_edges|
+% (performing the last step of removing overlaps), and each area is painted
+% with a different colour, yielding a gerbera-like form.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path R[\\],V[\\][\\];
+ N:=9;
+ R.num:=0;
+ R[incr R.num]=fullcircle xscaled 1/5w yscaled h shifted (1/2w,1/2h);
+ for i:=1 upto N-1:
+ R[incr R.num]=R[R.num-1] rotatedaround((0.5w,.5h), 180/N);
+ endfor
+%
+ remove_overlap (make_list(1,R.num)R)() R; % dummy result
+ col.min:=infinity; col.max:=-infinity;
+ for i:=-EDGE_.num upto EDGE_.num : if i<>0:
+ col.min:=min(EDGE_.col[i],col.min);
+ col.max:=max(EDGE_.col[i],col.max);
+ fi endfor;
+ col.min:=max(1,col.min);
+ for k:=col.min upto col.max:
+ vardef good_colors(expr i,j) = (i=k) enddef;
+ message "recombine_edges: color=" & decimal(k); recombine_edges(V[k]);
+ endfor;
+ set_BB 0,0,w,h; write_preamble jobname;
+ for k:=col.min upto col.max:
+ if V[k]num>0:
+ fix_fill_cmyk 0,3/4((((k-col.min)/(col.max-col.min))**1/2)[1,0]),1,0;
+ fill_C make_list(1,V[k]num)V[k];
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf
new file mode 100644
index 00000000000..7007cd233b2
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf
@@ -0,0 +1,150 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+%%% draw fix_line_join fix_line_cap fix_line_width
+% RO-06.MF, ``EL PALO ALTO TREE'':
+% A tough example (see remarks below) excerpted from The \MF{}book, pages
+% 124 thru 126.
+%% % an innocent formatting trick: the underscore character ending a name
+%% % will be typeset as an superscript asterisk
+%% \let\oriunderscore\_
+%% \newif\ifbgroupopen \bgroupopenfalse
+%% \def\altdblbackslash#1{\bgroup\bgroupopentrue\it#1}
+%% \def\optegroup{\ifbgroupopen\egroup\fi}
+%% \def\underscoreasasterisk#1{%
+%% \ifx#1\relax\optegroup^*\else\oriunderscore#1\fi}
+%% \def\\#1{%
+%% \let\_\underscoreasasterisk
+%% \altdblbackslash{#1\relax}\optegroup
+%% \let\_\oriunderscore}
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+% REMARKS:
+% 1. There arise very close points during the intersecting process,
+% hence |epsil.dist| is adjusted (see also point 2).
+% 2. Note that:
+% a) |turningnumber(branch1)=1| but |turningnumber(reverse branch1)=0|
+% (sic!);
+% b) for the second resulting path, |R2| (the tree), |turningnumber(R2)=1|
+% while |check_turn(R2)=-1|, which is the desired value as the tree
+% is unfilled (oh, these tiny loops!);
+% c) the minimal resulting interval, i.e., the time distance
+% between two neighbouring points of intersection is dangerously
+% small, namely, |0.00032|; usually the value smaller than the bound,
+% by default equal to |0.01|, portends a collaps of the algorithm,
+% fortunately not in this case (set |tracingremoving:=2| for more
+% information on intervals and secants).
+epsil.dist:=1/50pt;
+% show_turningnumbers_and_turn_checks:=1;
+% mark_trunk_close_points:=1;
+% ---
+beginchar ("0",1/2in#,5/4in#,0);
+ path branch[\\], oval;
+%
+% prepare data:
+ branch0 = % i.e., trunk
+ (0,660)---(-12,70)..{curl 5}(-28,-8)
+ & flex((-28,-8),(-16,-4),(-10,-11))
+ & flex((-10,-11),(0,-5),(14,-10))
+ & flex((14,-10),(20,-6),(29,-11))
+ & (29,-11){curl 4}..(10,100)---cycle;
+ branch1= flex((0,660),(-9,633),(-22,610))
+ & flex((-22,610),(-3,622),(17,617))
+ & flex((17,617),(7,637),(0,660)) & cycle;
+ branch2=flex((30,570),(10,590),(-1,616))
+ & flex((-1,616),(-11,592),(-29,576),(-32,562))
+ & flex((-32,562),(-10,577),(30,570)) & cycle;
+ branch3=flex((-1,570),(-17,550),(-40,535))
+ & flex((-40,535),(-45,510),(-60,477))
+ & flex((-60,477),(-20,510),(40,512))
+ & flex((40,512),(31,532),(8,550),(-1,570)) & cycle;
+ branch4=flex((0,509),(-14,492),(-32,481))
+ & flex((-32,481),(-42,455),(-62,430))
+ & flex((-62,430),(-20,450),(42,448))
+ & flex((42,448),(38,465),(4,493),(0,509)) & cycle;
+ branch5=flex((-22,470),(-23,435),(-44,410))
+ & flex((-44,410),(-10,421),(35,420))
+ & flex((35,420),(15,455),(-22,470)) & cycle;
+ branch6=flex((18,375),(9,396),(5,420))
+ & flex((5,420),(-5,410),(-50,375),(-50,350))
+ & flex((-50,350),(-25,375),(18,375)) & cycle;
+ branch7=flex((0,400),(-13,373),(-30,350))
+ & flex((-30,350),(0,358),(30,350))
+ & flex((30,350),(13,373),(0,400)) & cycle;
+ branch8=flex((50,275),(45,310),(3,360))
+ & flex((3,360),(-20,330),(-70,300),(-100,266))
+ & flex((-100,266),(-75,278),(-60,266))
+ & flex((-60,266),(0,310),(50,275)) & cycle;
+ branch9=flex((10,333),(-15,290),(-43,256))
+ & flex((-43,256),(8,262),(58,245))
+ & flex((58,245),(34,275),(10,333)) & cycle;
+ branch10=flex((8,262),(-21,249),(-55,240))
+ & flex((-55,240),(-51,232),(-53,220))
+ & flex((-53,220),(-28,229),(27,235))
+ & flex((27,235),(16,246),(8,262)) & cycle;
+ branch11=flex((0,250),(-25,220),(-70,195))
+ & flex((-70,195),(-78,180),(-90,170))
+ & flex((-90,170),(-5,188),(74,183))
+ & flex((74,183),(34,214),(0,250)) & cycle;
+ branch12=flex((8,215),(-35,175),(-72,155))
+ & flex((-72,155),(-75,130),(-92,110),(-95,88))
+ & flex((-95,88),(-65,117),(-54,104))
+ & flex((-54,104),(10,151),(35,142))
+ ..flex((42,130),(60,123),(76,124))
+ & flex((76,124),(62,146),(26,180),(8,215)) & cycle;
+%
+ for i:=0 upto 12:
+ branch[i]:=neg_turn branch[i] shifted (150,50) scaled (w/300);
+ endfor
+ oval=superellipse((w,1/2h),(1/2w,h),(0,1/2h),(1/2w,0),4/5);
+%
+% remove overlaps and (optionally) show |turningnumber|s and |turn_check|s:
+ remove_overlap (make_list(0,12)branch,oval)() R;
+ if known show_turningnumbers_and_turn_checks:
+ begingroup
+ interim autorounding:=0;
+ show (turningnumber(branch1), turningnumber(reverse branch1));
+ for i:=1 upto R.num: show i,(turningnumber R[i],check_turn R[i]); endfor;
+ endgroup;
+ fi
+%
+% begin export to EPS:
+ find_BB oval;
+ write_preamble jobname;
+ fix_line_join 1; fix_line_cap 1;
+ fix_line_width 1/50pt;
+% paint the picture:
+ fix_fill_cmyk 0,0,0,1/6;
+ fill_C make_list(1,R.num)R;
+ for i:=1 upto R.num:
+ if proofing=0:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ else:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+%
+% mark (optionally) dangerously close points:
+ if known mark_trunk_close_points:
+ fix_fill_cmyk 0,0,0,1; fix_draw_cmyk 0,0,0,1;
+ for j:=13,14,17,18:
+ z[j]=point TIME_1tim[j] of PATH_1;
+ fill_C fullcircle scaled 1/50pt shifted z[j];
+ endfor
+ z.a=(1pt,0); z.b=(1/20pt,0); z.c=(1/5pt,1/10pt); z.d=(1/5pt,-1/10pt);
+ for zz:=1/2[z13,z14],1/2[z17,z18]:
+ draw_C (zz-z.a)--(zz-z.b), (zz-z.c)--(zz-z.b)--(zz-z.d);
+ endfor
+ fi
+% end export to EPS:
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf
new file mode 100644
index 00000000000..5697a6462ac
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf
@@ -0,0 +1,102 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% RO-07.MF, ``LOGO OF JOURNAL OF ALGORITHMS'':
+% Another example excerpted from The \MF{}book, pages 137 thru 139;
+% |penstroke| is redefined in such a way that instead of creating a bitmap
+% picture, it stores respective curves; two points were moved, |z.a8l| and
+% |z.a8r| (see comments with a remark ``intrusion''), in order to avoid
+% partially overlaping paths, as ROEX does not cope with such data.
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+% ---
+def penstroke text t =
+ forsuffixes e = l,r: path_.e:=t; endfor
+ if cycle path_.l: R[incr R.num]:=path_.l.t_; R[incr R.num]:=path_.r.t_;
+ else: R[incr R.num]:=path_.l -- reverse path_.r -- cycle; fi
+ enddef;
+% ---
+beginchar("0",29mm#,25mm#,0);
+ path R[\\]; R.num:=0;
+%
+ thick#:=2mm#; thin#:=5/4mm#;
+ define_whole_blacker_pixels(thick,thin);
+ forsuffixes $=a,b,c: transform $;
+ forsuffixes e=l,r: path $e,$'e; numeric t$[\\]e;
+ endfor
+ endfor
+ penpos1(thick,0); penpos2(thick,90); penpos3(thick,180); penpos4(thick,270);
+ penpos5(thick,0); penpos6(thick,90); penpos7(thick,180); penpos8(thick,270);
+ x2=x4=x6=x8=.5[x5,x7]=.5w; x1r=w; x3r=0;
+ x5-x7=y6-y8;
+ y1=y3=y5=y7=.5[y6,y8]=.5h; y2r=h; y4r=0;
+ y6r=.75h;
+ forsuffixes e=l,r: a.e=b'e=c'e=superellipse (z1e,z2e,z3e,z4e,.75);
+ a'e=b.e=c.e=superellipse (z5e,z6e,z7e,z8e,.72);
+ endfor
+ penpos a1(thin,0); penpos a5(whatever,-90); penpos a9(thin,180);
+ x.a1l-x.a9l=1/3(x5l-x7l); x.a5=.5w; y.a1=y.a9; y.a5r=4/7h;
+ x.a3l=x.a1l; x.a3r=x.a1r; x.a4r=1/6[x.a3r,x1l]; x0=.5w; y0=.52h;
+ x.a6l+x.a4l=x.a6r+x.a4r=x.a7l+x.a3l=
+ x.a7r+x.a3r=x.a9+x.a1=w;
+ y.a3r=y.a4r=y.a6r=y.a7r=.2[y2l,y0]; y.a3l=y.a4l=y.a6l=y.a7l=y.a3r-thin;
+ z.a4l=z.a4r+(thin,0) rotated(angle(z.a4r-z.a5r)+90)+whatever*(z.a4r-z.a5r);
+ z.a4l-z.a5l=whatever*(z.a4r-z.a5r);
+ z=a.r intersectionpoint (z0--(w,0));
+ y.a1-y.a5=length(z-z0);
+ b=identity shifted (0,y0-y.a1) rotatedaround(z0,90-angle(z0-(w,0)));
+ c=b reflectedabout (z2,z4);
+ for n=1,3,4,5,6,7,9: forsuffixes e=l,,r: forsuffixes $=b,c:
+ z$[n]e=z.a[n]e transformed $;
+ endfor endfor endfor
+ forsuffixes e=l,r: forsuffixes $=a,b,c:
+% intrusion: the primed entries are stored for further use (see below)
+ z$2e'=$l intersectionpoint (z$1e--z$3e);
+ z$8e'=$l intersectionpoint (z$9e--z$7e);
+% end of intrusion
+ z$2e=$r intersectionpoint (z$1e--z$3e);
+ z$8e=$r intersectionpoint (z$9e--z$7e);
+ t$1e=xpart($e intersectiontimes (z$1l--z$3l));
+ t$9e=xpart($e intersectiontimes (z$9l--z$7l));
+ t$4e=xpart($'e intersectiontimes (z$5r--z$4l));
+ t$6e=xpart($'e intersectiontimes (z$5r--z$6l));
+ endfor endfor
+ penstroke subpath(t.a9e,t.b6e) of a.e;
+ penstroke subpath(t.b4e,t.c4e) of b'e;
+ penstroke subpath(t.c6e,t.a1e+8) of c'e;
+ penstroke subpath(t.a6e,t.b9e) of a'e;
+ penstroke subpath(t.b1e,t.c1e) of b.e;
+ penstroke subpath(t.c9e,t.a4e+8) of c.e;
+% intrusion: correction of offending nodes, i.e., |z.a8l|, |z.a8r|,
+% |z.a8l|, and |z.a8r|
+ x.a8l:=x.a8l'; x.a8r:=x.a8r'; y.a8l:=y.a8l'; y.a8r:=y.a8r'+(y2r-y2);
+ x.a2l:=x.a2l'; x.a2r:=x.a2r'; y.a2l:=y.a2l'; y.a2r:=y.a2r'+(y2r-y2);
+% end of intrusion
+ forsuffixes $=a,b,c:
+% |penlabels($1,$2,$3,$4,$5,$6,$7,$8,$9);|
+ penstroke z$2e--z$3e--z$4e--z$5e--z$6e--z$7e--z$8e;
+ endfor
+% |penlabels(range 0 thru 8);|
+ vardef touch_path expr p = pos_turn p enddef;
+ remove_overlap (make_list(1,R.num)R) () R;
+ find_BB make_list(1,R.num)R;
+ write_preamble jobname;
+ fix_fill_cmyk 0,0,0,1/6;
+ fill_C make_list(1,R.num)R;
+ fix_line_width 1/10pt;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn R[i]>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ if proofing>0:
+ for j:=0 upto length(R[i])-1:
+ makelabel(decimal(j) & "/" & decimal(i),point j of R[i]);
+ endfor
+ fi
+ endfor
+ write_postamble;
+endchar;
+end.
+%%\end
+
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf
new file mode 100644
index 00000000000..bac1a14bfda
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf
@@ -0,0 +1,38 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ROES-01.MF, ``SUN'':
+% An example making use of both expanding stroke and removing overlaps.
+% ---
+input mftoeps; eps_mode_setup; input roex;
+tracingexpanding:=1; tracingremoving:=1;
+% ---
+beginchar("0",in#,in#,0);
+ path Q,R[\\]; R.num:=0;
+ M:=12; % number of half-periods of a sine wave
+ N:=11; % number of gaps
+ H:=h/(2N); W=1.2w;
+ Q:=reverse for i:=0 upto M: if i>0: .. fi
+ ((i/M)[1/2(w-W),w-1/2(w-W)],1/2sind(90(i mod 4))*H)
+ endfor;
+%
+ expand_stroke(Q)(1/2H)R; Q:=reverse R1; R.num:=0;
+ if proofing>0:
+ for j:=0 upto length(Q)-1: makelabel("Q" & decimal(j),point j of Q); endfor
+ fix_line_width 1; draw_C Q;
+ fi
+ for i:=1 upto N: R[incr R.num]:=Q shifted (0,(2i-1)*H); endfor
+ R[incr R.num]:=fullcircle scaled w shifted (.5w,.5h);
+%
+ remove_overlap(make_list(1,R.num) R)() R;
+ find_BB make_list(1,R.num) R;
+ write_preamble jobname;
+ for i:=1 upto R.num:
+ fix_fill_cmyk 0,((i-1)/(R.num-1))[1,0],1,0; fill_C R[i];
+ endfor;
+ write_postamble;
+endchar;
+end.
+%%\end
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf
new file mode 100644
index 00000000000..f5dda5c552e
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf
@@ -0,0 +1,33 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ROES-02.MF, ``DOORMAT'':
+% Another example making use of both expanding stroke and removing overlaps;
+% ---
+input mftoeps; eps_mode_setup; input roex;
+tracingexpanding:=1; tracingremoving:=1;
+% ---
+beginchar("0",1in#,1in#,0);
+ path A[\\],B[\\];
+ A.n:=5; B.n:=5; % large values may cause exceedingly long processing...
+ A.b:=(1/(2A.n+1))*w; B.b:=(1/(2B.n+1))*h;
+ for i:=1 upto A.n:
+ A[i]:=((0,0)..(-1/2A.b,1/3h)..(1/2A.b,2/3h)..(0,h)) shifted ((2i-.5)*A.b,0);
+ endfor
+ for i:=1 upto B.n:
+ B[i]:=((0,0)..(1/3w,-1/2B.b)..(2/3w,1/2B.b)..(w,0)) shifted (0,(2i-.5)*B.b);
+ endfor
+ expand_stroke(make_list(1,A.n)A, make_list(1,B.n)B)(1/2A.b)R;
+ remove_overlap(make_list(1,R.num)R)()R;
+ find_BB make_list(1,R.num) R;
+ write_preamble jobname;
+ for i:=1 upto R.num:
+ fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi;
+ draw_C R[i];
+ endfor;
+ write_postamble;
+endchar;
+end.
+%%\end
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf
new file mode 100644
index 00000000000..7df45b013a9
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf
@@ -0,0 +1,49 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw write_preamble write_postamble find_BB set_BB fill_C clip_C
+%%% draw fix_fill_cmyk fix_draw_cmyk
+% ROES-03.MF, ``OLYMPIC CIRCLES'':
+% Yet another example making use of both expanding stroke and removing
+% overlaps; it also demonstrates repositioning of the picture in such
+% a way that the lower left corner of the bounding box coincides with
+% the origin of coordinate system.
+input mftoeps; eps_mode_setup; input roex;
+tracingremoving:=1; tracingexpanding:=1;
+% ---
+beginchar("0",in#,in#,0); % temporary values
+ path A[];
+ for i:=1,2,3,4,5:
+ A[i]:=fullcircle scaled w shifted
+ (floor(i/4)*(1/2sqrt(3)*w,0)+1/2w*(up rotated (120i+60)));
+ endfor
+ expand_stroke (A1,A2,A3,A4,A5) (.5mm) R;
+ remove_overlap (make_list(1,R.num)R) () R;
+% setting of intermediate colors:
+ k:=0; % the number of intermediate colors
+ C[incr k]=0; M[k]=1; Y[k]=1; K[k]:=0;
+ C[incr k]=0; M[k]=0; Y[k]=1; K[k]:=0;
+ C[incr k]=0.25; M[k]=0; Y[k]=0.75; K[k]:=0;
+ C[incr k]=1; M[k]=0.5; Y[k]=0; K[k]:=0;
+ C[incr k]=0.3; M[k]=1; Y[k]=0; K[k]:=0;
+ l:=30; % the number of interpolation steps
+ m=l*(k-1); % the number of strips
+ find_BB make_list(1,R.num)R;
+% repositioning of the picture:
+ for i:=1 upto R.num: R[i]:=R[i] shifted -llxy; endfor
+ m*w'=xh_crd:=xh_crd-xl_crd; xl_crd:=0;
+ h'=yh_crd:=yh_crd-yl_crd; yl_crd:=0;
+% exporting:
+ write_preamble jobname;
+ clip_C make_list(1,R.num)R;
+ n:=0;
+ for i:=1 upto k-1: for j:=0 upto l-1:
+ n:=n+1;
+ fix_fill_cmyk
+ forsuffixes $=C,M,Y,K: (j/(l-1))[$[i],$[i+1]] if str$ <> "K": , fi endfor;
+ fill_C unitsquare xscaled 11/10w' yscaled h' shifted ((n-1)*w'-1/20w',0);
+ endfor endfor
+ write_postamble;
+endchar;
+end.
+%%\end
diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf
new file mode 100644
index 00000000000..04585e9416f
--- /dev/null
+++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf
@@ -0,0 +1,91 @@
+%%%%
+%%%% This file belongs to the ROEX package.
+%%%%
+%%% draw find_BB fill_C fix_fill_cmyk write_preamble write_postamble
+%%% length cycle join
+%%% / //
+% ROES-04.MF, ``STAR FLOWERS'':
+% An example of removing overlaps of a single self-intersecting curve;
+% the sample curves (separate EPS files are generated for different
+% curves) are based upon a regular star polygon backbone;
+% the first curve is just such a polygon, the remaining two are
+% smooth variations (observe setting |epsil.time:=1/500| in the third case);
+% after removing overlaps objects are repositioned in such a way that
+% the lower left corner of the bounding box coincides with the origin
+% of coordinate system.
+%%%%
+%% % an innocent formatting trick: the underscore character ending a name
+%% % will be typeset as an superscript asterisk
+%% \let\oriunderscore\_
+%% \newif\ifbgroupopen\bgroupopenfalse
+%% \def\altdblbackslash#1{\bgroup\bgroupopentrue\it#1}
+%% \def\optegroup{\ifbgroupopen\egroup\fi}
+%% \def\underscoreasasterisk#1{%
+%% \ifx#1\relax\optegroup^*\else\oriunderscore#1\fi}
+%% \def\\#1{%
+%% \let\_\underscoreasasterisk
+%% \altdblbackslash{#1\relax}\optegroup
+%% \let\_\oriunderscore}
+% ---
+input mftoeps; eps_mode_setup; input roex; tracingremoving:=1;
+max_idx:=500; % better increase the default value
+% ---
+primarydef i // n =
+ (if n=0: 0 else: i/n fi) % why not to divide by 0?
+enddef;
+% ---
+h#=1in#; w#=1in#;
+% ---
+beginchar("0",w#,h#,0);
+ pickup pencircle scaled 1;
+ for case:=0,1,2:
+ path p, V[\\][\\]; pair R; save x,y; numeric N, K, A, twirl;
+ twirl:=180;
+% star polygons should fullfil |GCC(K,N)=1|, |1<K<N/2|
+% (|N| is the number of nodes, |K| is a `leap')
+ if case=0: % A
+ N=9; K=4; def join = -- enddef; twirl:=0;
+ elseif case=1: % B
+ N=7; K=2; def join = .. tension 3 .. enddef;
+ elseif case=2: % C
+ N=13; K=4; def join = .. tension 3 .. enddef; epsil.time:=1/500;
+ fi
+ A=180-(360/N)*K; R=1in*right; z0=origin;
+ for i:=1 upto N-1: z[i]=z[i-1]+R; R:=R rotated (180-A); endfor
+ p:=z0 for i:=1 upto N-1: join z[i] endfor join cycle;
+ if twirl<>0:
+ p:=z0{(direction 0 of p) rotated twirl}
+ for i:=1 upto N-1: join {(direction i of p) rotated twirl}z[i] endfor
+ join cycle;
+ fi
+ remove_overlap (p)()R; % dummy recombining
+ col_min:=infinity; col_max:=-infinity;
+ for i:=-EDGE_.num upto EDGE_.num: if i<>0:
+ col_min:=min(EDGE_.col[i],col_min); col_max:=max(EDGE_.col[i],col_max);
+ fi endfor;
+ find_BB p;
+ for k:=col_min upto col_max: if k<>0:
+ vardef good_colors(expr i,j) = (i=k) enddef;
+ message "recombine_edges: color=" & decimal(k);
+ recombine_edges(V[k]);
+ for l:=1 upto V[k]num: V[k][l]:=V[k][l] shifted -llxy; endfor
+ fi endfor;
+ xh_crd:=xh_crd-xl_crd; xl_crd:=0;
+ yh_crd:=yh_crd-yl_crd; yl_crd:=0;
+ write_preamble jobname & char(ASCII("a")+case);
+ for k:=col_min upto col_max: if k<>0:
+ if V[k]num>0:
+ if k>0:
+ fix_fill_cmyk 0,3/4(((k-1)//(col_max-1))**1/2)[1,0],1,0;
+ else:
+ fix_fill_cmyk 3/4(((1+k)//(1+col_min))**1/2)[1,0],1,0,0;
+ fi
+ fill_C make_list(1,V[k]num)V[k];
+ fi
+ fi endfor % |for k|
+ write_postamble;
+ endfor % |for case|
+endchar;
+% ---
+end.
+%%\end