summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/mfpic/examples/forfun.tex
blob: 76fcdbb8b7032892acabd81e16524598b62032d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
% File: forfun.tex
% A part of mfpic 1.10 2012/12/03
%
\nopagenumbers
\input mfpic.tex
\usemetapost
\usetruebbox
\opengraphsfile{fun}

\mfpicunit=2bp

\noindent
\mfpic{-1.25}{118.5}{-11.25}{40}
%
% "meta"-ness:
%
\mfsrc{h:=25;   % height of "m"  These are graph units
       s:=10;   % width of stems
}
%
% Calculate key points:
%
% "m"
%
\mfsrc{%
  z1=(0,0);
  y1=y2=y5=y6=y9=y10;
  x2-x1=x6-x5=x10-x9=s;
  x6-x1=x10-x5=h;
  z15-z1=z3-z2=z4-z5=z7-z6=z8-z9=z11-z10=(0,h/2);
  y12=y1+h; x12=.5[x6,x9];
  y14=y12; x14=.5[x2,x5];
  z13= arcppp(z7,z14,z15) intersectionpoint arcppp(z11,z12,z4);}
%
% "f"
%
\mfsrc{%
  z21=z10; % start "f" at "m"'s end
  z22=z21+(s,0);
  z23=z22+(0,h-s);
  z24=z23+(3s/4,0);
  z25=z24+(0,s);
  z26=z23+(0,s);
  z27=z26+(0,s/4);
  z28=z27+(s/4,0)+ (s/4)*dir(30);
  z29=z28+s*dir(30);
  x30=x21; y30=y27;}%
%
% "p"
%
\mfsrc{%
  x31=x24;
  y31=y21;
  z32=z31-(0,s);
  z33=z32+(s,0);
  z35=(x33,h/2);
  z39=z31+(h,h)/2; %center of round part
  z34=(z33--z35) intersectionpoint (fullcircle scaled h shifted z39);
  z36=z39+(h/2,0);
  z37=z31+(0,h/2);}%
%
% "i"
%
\mfsrc{%
  z41=(x36,y31);
  z42=z41+(s,0);
  z43=z42+(0,h);
  z44=z41+(0,h);
  x45=0.5[x41,x42]; y45=y43 + s/2 +3/50;}% Center of dot
%
% "c"
%
\mfsrc{%
  z51=z42;
  z52=z51+(h,h)/2; %center
  z53=z52+(h/2)*dir(15);
  z54=z52-(h/2,0);
  z55=z52+(h/2)*dir(-15);
  z56=z52+(s/4)*dir(-15);
  z57=z52-(s/4,0);
  z58=z52+(s/4)*dir(15);}%
%
\penwd{2.5*\the\mfpicunit}
\mfsrc{%
%
% Calculate bounding box
%
% Need to account for half the thickness of pen;
% penwd is in absolute units so we need to convert.
% This is a displacement, so use invvconv (not invzconv):
  begingroup
    save border,ll,ur;
    pair border,ll,ur; border:= invvconv((penwd,penwd))/2;
    ll=(0,y32)-border;
    ur=(x55,y27+5s/4)+border;}
%
\gfill[yellow]\rect{ll,ur} % background
\mfsrc{endgroup;}
%
\fillcolor{blue}
\drawcolor{green}
%
% "m"
\mftitle{m}
\draw\gfill\lclosed
 \connect
  \lines{z15,z1,z2,z3}
  \arc[s]{z3,z4,-180}
  \lines{z4,z5,z6,z7}
  \arc[s]{z7,z8,-180}
  \lines{z8,z9,z10,z11}
  \arc[t]{z11,z12,z13}
  \arc[t]{z13,z14,z15}
 \endconnect
%
% "f"
\mftitle{f}
\draw\gfill\lclosed
 \connect
  \lines{z21,z22,z23,z24,z25,z26,z27}
  \arc[s]{z27,z28,-150}
  \lines{z28,z29}
  \arc[s]{z29,z30,150}
 \endconnect
%
% "p"
\mftitle{p}
\draw\gfill\lclosed
 \connect
  \lines{z31,z32,z33,z34}
  \arc[t]{z34,z36,z37}
 \endconnect
\draw\gfill[yellow]\circle{z39,(h/2-s)}
%
% "i"
\mftitle{i}
\draw\gfill\polygon{z41,z42,z43,z44}
\draw\gfill\circle{z45,s/2}
%
% "c"
\mftitle{c}
\draw\gfill\lclosed
 \connect
  \arc[t]{z53,z54,z55}
  \arc[t]{z56,z57,z58}
 \endconnect
% uncoment to exhibit the points
%\pointsize2bp
%\pointfillfalse
%\penwd{.2pt}
%\point{z1,z2,z3,z4,z5,z6,z7,z8,z9,z10,z11,z12,z13,z14}
%\point{z21,z22,z23,z24,z25,z26,z27,z28,z29,z30}
%\point{z31,z32,z33,z34,z35,z36,z37}
%\point{z41,z42,z43,z44,z45}
%\point{z51,z52,z53,z54,z55,z56,z57,z58}
% done
\endmfpic

\closegraphsfile % {fun}
\bye