summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/profcollege/PfCAllumettes.mp
blob: 3ce248b99f6f59eb7819488b94a4f46fe14b4677 (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
numeric longallu,epallu;
longallu=41.5mm;
epallu=2mm;
ecartpoint=epallu-0.1mm;

color BurlyWood,PfCSoufre;
BurlyWood=(222,184,135)/256;
PfCSoufre=red;

vardef Allu(expr dep,arr)=
  save Retour;
  picture Retour;
  Retour=image(
      pair depa,arra;
    depa=dep+ecartpoint*unitvector(arr-dep);
    arra=arr+ecartpoint*unitvector(dep-arr);
    pair corps[];
    corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep);
    corps[4]=symetrie(corps[1],dep,arr);
    corps2=corps1+0.975*(arra-depa);
    corps3-corps2=corps4-corps1;
    path Corps;
    Corps=polygone(corps1,corps2,corps3,corps4);
    fill Corps withcolor if print: white else:BurlyWood fi;
    trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi];
    pair cera,cerb,cerc;
    cera=pointarc(cercles((0,0),1.5epallu),125);
    cerb=pointarc(cercles((0,0),1.5epallu),235);
    cerc=pointarc(cercles((0,0),1.5epallu),0);
    path bout;
    bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle;
    fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor if print:0.7white else: PfCSoufre fi;
    draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi];
    );
  Retour
enddef;

vardef OldAllu(expr dep,arr)=
  save Retour;
  picture Retour;
  Retour=image(
      pair depa,arra;
    depa=dep+ecartpoint*unitvector(arr-dep);
    arra=arr+ecartpoint*unitvector(dep-arr);
    pair corps[];
    corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep);
    corps[4]=symetrie(corps[1],dep,arr);
    corps2=corps1+0.975*(arra-depa);
    corps3-corps2=corps4-corps1;
    path Corps;
    Corps=polygone(corps1,corps2,corps3,corps4);
%    fill Corps withcolor if print: white else:BurlyWood fi;
%    trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi] dashed evenly;
    trace Corps dashed evenly;
    pair cera,cerb,cerc;
    cera=pointarc(cercles((0,0),1.5epallu),125);
    cerb=pointarc(cercles((0,0),1.5epallu),235);
    cerc=pointarc(cercles((0,0),1.5epallu),0);
    path bout;
    bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle;
    fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr))) withcolor white;
    draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr)));% withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi];
    );
  Retour
enddef;
  
u:=longallu+epallu;

vardef DefinirUnite(expr pfcechelle)=
    longallu:=longallu*pfcechelle;
    epallu:=epallu*pfcechelle;
    ecartpoint:=ecartpoint*pfcechelle;
    u:=longallu+epallu;
enddef;

endinput;