summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/mpattern/test.mp
blob: a6cd1a8f86ea5b78807a4523a4c543525d920286 (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
input mpattern;
prologues:=1;

beginpattern(szachy_i);
   patterncolor(.8);
   fill unitsquare scaled 4mm;
   fill unitsquare scaled 4mm shifted (4mm,4mm);
endpattern;

beginpattern(szachy_ii);
   fill unitsquare scaled 3mm withcolor .7white;
   fill unitsquare scaled 3mm shifted (3mm,3mm) withcolor .7white;
endpattern;

beginfig(1);
   fill fullcircle scaled 30mm withpattern szachy_i;

   picture q;
   q:=currentpicture; clearit;

   draw q shifted (10mm*right) rotated 30 scaled .5;

   fill unitsquare scaled 20mm withpattern szachy_ii;
endfig;

beginpattern(checker);
   u:=1mm;
   fill unitsquare scaled u;
   fill unitsquare scaled u shifted (u,u);
   patternbbox(0,0,2u,2u);
   patterntransform(identity slanted .17);
endpattern;

beginpattern(rotated_checker);
   fill unitsquare scaled 4mm rotated 45 withcolor .7white;
   patterntransform(identity rotated 30);
endpattern;

beginfig(11);
   path p;
   z1=(1cm,1cm);
   p=fullcircle scaled 3cm;
   fill p withpattern checker;
   unfill p shifted z1;
   fill p shifted z1 withpattern rotated_checker;
endfig;

beginpattern(tt);
   fill unitsquare scaled 2mm rotated 45 withcolor .5white;
   z1=llcorner currentpicture;
   z2=lrcorner currentpicture;
   z3=urcorner currentpicture;
   z4=ulcorner currentpicture;
%   draw z1--z2--z3--z4--cycle;
   patterntransform(identity rotated 30 slanted .2 yscaled 3);
   patternstep((1.1*xpart(urcorner currentpicture-ulcorner currentpicture),
   2/3*xpart(urcorner currentpicture-ulcorner currentpicture)));
endpattern;

beginpattern(ttt);
   fill unitsquare scaled 2mm rotated 45 withcolor .5white;
   z1=llcorner currentpicture;
   z2=lrcorner currentpicture;
   z3=urcorner currentpicture;
   z4=ulcorner currentpicture;
%   draw z1--z2--z3--z4--cycle;
   patterntransform(identity rotated 30 slanted .2);
   patternstep((1.1*xpart(urcorner currentpicture-ulcorner currentpicture),
   2/3*xpart(urcorner currentpicture-ulcorner currentpicture)));
endpattern;

beginpattern(tr);
   u:=4mm;
   z1=(0,0);
   z2=(u,0);
   z3=(u,2u);
   z4=(0,2u);
   z12=.5[z1,z2];
   z23=.5[z2,z3];
   z34=.5[z3,z4];
   z41=.5[z4,z1];
   draw z12--z23--z34--z41--cycle;
   draw z23--z41;
   draw z1--z2;
   draw z3--z4;
   patternbbox(z1,z3);
   patterntransform(identity slanted .1 rotated 11);
   patternstep(1.2(x2-x1),1.2(y3-y1));
endpattern;

beginfig(12);
   path p;
   z1=(1cm,1cm);
   p=fullcircle scaled 3cm;
   fill p withpattern tt;
   draw p;
   unfill p shifted z1;
   fill p shifted z1 withpattern tr;
   draw p shifted z1;
endfig;

beginpattern(ll);
   pickup pencircle scaled .3;
   draw origin--4up;
   patternbbox(left,4up+right);
   patterntransform(identity rotated -45);
endpattern;

beginpattern(lll);
   pickup pencircle scaled .3;
   draw origin--4up;
   patternbbox(left,4up+right);
   patterntransform(identity rotated 45);
endpattern;

beginpattern(literki);
   label(btex \font\q=ptmr8r at 5pt\q abcd etex,origin);
   z1=ulcorner currentpicture;
   z2=urcorner currentpicture;
   patterntransform(identity slanted .17);
endpattern;

beginpattern(cm_literki);
   label(btex \font\q=cmr5\q xyz XYZ ZYX zyx etex,origin);
   z1=ulcorner currentpicture;
   z2=urcorner currentpicture;
   patterntransform(identity slanted .17);
endpattern;

beginfig(13);
   label(btex \font\q=ptmr8r at 90pt\q ABCD etex, origin) withpattern ll;
endfig;

beginfig(14);
   picture a; a=btex \font\q=ptmbi8r at 90pt\q ABCD etex;
   draw a withpattern literki;
   undraw a shifted (20up+10right);
   draw a shifted (20up+10right) withpattern checker;
   undraw a shifted (40up+20right);
   draw a shifted (40up+20right) withpattern lll;
   draw a shifted (40up+20right) withpattern ll;
   undraw a shifted (60up+30right);
   draw a shifted (60up+30right) withpattern cm_literki;
endfig;

end.