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
|
prologues:=3;
if scantokens(mpversion) > 1.005:
outputtemplate :=
else:
filenametemplate
fi
"%j-%c.mps";
verbatimtex
%&latex
\documentclass[11pt]{article}
\usepackage[charter]{mathdesign}
\usepackage[T1]{fontenc}
\renewcommand*{\ttdefault}{lmtt}
\begin{document}
etex
% Set unit size to 54bp = 3/4in
u:=54;
path p,q;
% Define circle of radius 3/4in
p:=fullcircle scaled (2*u);
% Define circle of radius 3/8in
q:=fullcircle scaled u;
beginfig(1);
% Fill annulus
fill p withcolor (3/5,4/5,1);
unfill q;
% Draw big circle
draw p;
% Draw small circle
draw q;
endfig;
beginfig(2);
% Fill annulus
fill p--reverse q--cycle withcolor (3/5,4/5,1);
% This loop draws arrows around the big circle
N:=12;
for n=1 upto N:
drawarrow subpath ((n-1)/N*length(p),n/N*length(p)) of p;
endfor;
% These 3 commands draw the "cut"
drawarrow (u,0)--(5*u/6,0);
draw (5*u/6,0)--(2*u/3,0);
drawarrow (u/2,0)--(2*u/3,0);
% This loop draws arrows around the small circle
for n=1 upto N:
drawarrow subpath ((n-1)/N*length(p),n/N*length(p)) of reverse q;
endfor;
% Label p and q
label.urt(btex \texttt{p} etex,(u/sqrt(2),u/sqrt(2)));
label.llft(btex \texttt{q} etex,(u/2/sqrt(2),u/2/sqrt(2)));
endfig;
beginfig(3);
% Fill annulus
fill p--reverse q--cycle withcolor (3/5,4/5,1);
% Draw big circle
draw p;
% Draw small circle
draw q;
% Above is used to determine the bbox of the annulus
picture h;
h:=currentpicture; % Store the currentpicture
currentpicture:=nullpicture; % Clear the currentpicture
% Create magenta background
fill bbox h withcolor (1,0,1);
% Fill the big circle
fill p withcolor (3/5,4/5,1);
% Unfill the small circle
unfill q;
% Draw the big circle
draw p;
% Draw the small circle
draw q;
endfig;
end
|