summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/metapost/PfCAfficheur.mp
blob: 166cd229792df5b6dd0f79325ab3fcd9f5559d1b (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
u:=1cm;

vardef Afficheur(expr nb,creux)=
  pair Aa[];
  Aa1=u*(-0.5,-1);
  Aa2-Aa1=u*(1,0);
  Aa4-Aa2=u*(0,2);
  Aa3=1/2[Aa2,Aa4];
  Aa5-Aa4=Aa1-Aa2;
  Aa6-Aa3=Aa1-Aa2;
  pair Bb[];
  Bb1=Aa1 xscaled0.7 yscaled 0.85;
  Bb2=Aa2 xscaled0.7 yscaled 0.85;
  Bb4=Aa4 xscaled0.7 yscaled 0.85;
  Bb5=Aa5 xscaled0.7 yscaled 0.85;
  Bb3=1/2[Bb2,Bb4];
  Bb6=1/2[Bb1,Bb5];
  Bb7=1/2[Bb6,Bb3]+(0,4);
  Bb8=1/2[Bb6,Bb3]-(0,6);
  pair Cc[];
  Cc1=u*(0.4,-0.85)+(0,-1);
  ecarth:=1.5;
  ecartv:=0.05;
  path ASegment[];
  ASegment[1]=1/10[Bb1,Bb2]--9/10[Bb1,Bb2];
  ASegment[2]=1/10[Bb2,Bb3]--9/10[Bb2,Bb3];
  ASegment[3]=1/10[Bb3,Bb4]--9/10[Bb3,Bb4];
  ASegment[4]=1/10[Bb4,Bb5]--9/10[Bb4,Bb5];
  ASegment[5]=1/10[Bb5,Bb6]--9/10[Bb5,Bb6];
  ASegment[6]=1/10[Bb6,Bb1]--9/10[Bb6,Bb1];
  ASegment[7]=1/10[Bb6,Bb3]--9/10[Bb6,Bb3];
  color fondsegment;
  fondsegment=0.2[LightSteelBlue,white];
  save $;
  picture $;
  $=image(
      fill Aa1--Aa2--Aa4--Aa5--cycle withcolor LightSteelBlue;
    draw Aa1--Aa2--Aa4--Aa5--cycle withcolor LightSteelBlue;
    if creux=0:
      fill (unitsquare scaled 2) shifted Cc1 withcolor fondsegment;
    else:
      fill (unitsquare scaled 2) shifted Cc1 withcolor Crimson;
    fi;
    if nb=1:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[2];
      draw ASegment[3];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[1];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions();
    fi;
    if nb=2:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[2];
      draw ASegment[5];
      drawoptions();
    fi;
    if nb=3:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[5];
      draw ASegment[6];
      drawoptions();
    fi;
    if nb=4:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[5];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[1];
      draw ASegment[4];
      draw ASegment[6];
      drawoptions();
    fi;
    if nb=5:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[3];
      draw ASegment[6];
      drawoptions();
    fi;
    if nb=6:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[3];
      drawoptions();
    fi;
    if nb=7:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[1];
      draw ASegment[5];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions();
    fi;
    if nb=8:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions();
    fi;
    if nb=9:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[7];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[6];
      drawoptions();
    fi;
    if nb=0:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[6];
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[7];
      drawoptions();
    fi;
    if nb=10:
      drawoptions(withpen pensquare scaled2 withcolor Crimson);
      fill (unitsquare scaled 2) shifted Bb7 withcolor Crimson;
      fill (unitsquare scaled 2) shifted Bb8 withcolor Crimson;
      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
      draw ASegment[1];
      draw ASegment[2];
      draw ASegment[3];
      draw ASegment[4];
      draw ASegment[5];
      draw ASegment[6];
      draw ASegment[7];
      drawoptions();
    fi;
    );
  $
enddef;

endinput;