Debian Codegraph @

texmf-dist/doc/metapost/mp-geom2d/exemples/construction/ogiveentiers.mp

raw
1 input geom2d;
2
3 beginfig(1);
4 % les points de base pour l'ogive
5 O = Point(0,0);
6 A = Point(-3,0);
7 A2 = Point(-4,0);
8 B = Point(3,0);
9 B2 = Point(4,0);
10 % la droite de base de l'ogive
11 AB = Droite(A,B);
12 % on se prend une droite quelconque
13 Ct = Point(0.8,-2); % point quelconque
14 AC = Droite(A,Ct); % droite quelconque
15 % on prend trois longueures égales sur la droite
16 longueurTier := 1.4;
17 C1 = ReportSurDroite(A,AC,longueurTier);
18 C2 = ReportSurDroite(C1,AC,longueurTier);
19 C3 = ReportSurDroite(C2,AC,longueurTier);
20 % on définit la droite qui passe par B et le dernier point
21 BC = Droite(B,C3);
22 % on construit une droite perpendiculaire à BC
23 D = Point(-4,0);
24 perpD = DroitePerpendiculaire(BC,D);
25 DD = IntersectionDroites(perpD,BC);
26 % on projette C2 et C1 sar la droite AB pour diviser [AB] en 3 parties
27 % égales
28 perpC2 = DroitePerpendiculaire(perpD,C2);
29 perpC1 = DroitePerpendiculaire(perpD,C1);
30 D1 = IntersectionDroites(AB,perpC1);
31 D2 = IntersectionDroites(AB,perpC2);
32 % on construit l'enveloppe de l'ogive
33 C_DA = CercleCP(D2,A);
34 C_DB = CercleCP(D1,B);
35 C_DA2 = CercleCP(D2,A2);
36 C_DB2 = CercleCP(D1,B2);
37 % on construit le point P pour la projection finale
38 C_AB = CercleCP(A,B);
39 C_BA = CercleCP(B,A);
40 P = IntersectionCercles(C_BA,C_AB);
41 % on prend 5 longueures égales sur la droite quelconque du début
42 longueurCinq :=0.8;
43 F1 = ReportSurDroite(A,AC,longueurCinq);
44 F2 = ReportSurDroite(F1,AC,longueurCinq);
45 F3 = ReportSurDroite(F2,AC,longueurCinq);
46 F4 = ReportSurDroite(F3,AC,longueurCinq);
47 F5 = ReportSurDroite(F4,AC,longueurCinq);
48 % on projette les points sur AB pour diviser [AB] en 5 parties égale
49 BF5 = Droite(B,F5);
50 perpF5 = DroitePerpendiculaire(BF5,A2);
51 CC = IntersectionDroites(BF5,perpF5);
52 perpF4 = DroitePerpendiculaire(perpF5,F4);
53 perpF3 = DroitePerpendiculaire(perpF5,F3);
54 perpF2 = DroitePerpendiculaire(perpF5,F2);
55 perpF1 = DroitePerpendiculaire(perpF5,F1);
56 G1 = IntersectionDroites(AB,perpF1);
57 G2 = IntersectionDroites(AB,perpF2);
58 G3 = IntersectionDroites(AB,perpF3);
59 G4 = IntersectionDroites(AB,perpF4);
60 % on projette les Gi sur l'ogive avec le point P
61 PG1 = Droite(P,G1);
62 PG2 = Droite(P,G2);
63 PG3 = Droite(P,G3);
64 PG4 = Droite(P,G4);
65 I1 = IntersectionDroiteCercle(PG1,C_DA,1);
66 I2 = IntersectionDroiteCercle(PG2,C_DA,2);
67 I3 = IntersectionDroiteCercle(PG3,C_DB,2);
68 I4 = IntersectionDroiteCercle(PG4,C_DB,2);
69 % à partir des 2 points issus de la division en 3 de [AB]
70 % on trace les séparations des pierres qui constituent l'ogive
71 Dvoute1 = Droite(D2,I1);
72 Dvoute2 = Droite(D2,I2);
73 Dvoute3 = Droite(D1,I3);
74 Dvoute4 = Droite(D1,I4);
75
76 % les tracés
77 drawoptions(withcolor 1.3*Grey);
78 trace perpC2; trace perpC1;
79 trace AB;
80 trace AC;
81 trace BC;
82 trace perpD;
83 trace SigneOrtho(B,DD,A2,0.2);
84
85 drawoptions(withcolor Bisque);
86 trace BF5;
87 trace perpF5;trace perpF4;trace perpF3;trace perpF2;trace perpF1;
88 trace SigneOrtho(B,CC,A2,0.2);
89
90 drawoptions(withcolor SteelBlue withpen pencircle scaled 0.85pt);
91 trace gddTraceArcDeCercle(C_DA,Pi/2,Pi);
92 trace gddTraceArcDeCercle(C_DA2,Pi/2,Pi);
93 trace gddTraceArcDeCercle(C_DB2,0,Pi/2);
94 trace gddTraceArcDeCercle(C_DB,0,Pi/2);
95
96 drawoptions();
97 trace gddTraceArcDeCercle(C_AB,0,-Pi/2) dashed evenly;
98 trace gddTraceArcDeCercle(C_BA,Pi,3Pi/2) dashed evenly;
99
100 drawoptions(withcolor DarkSalmon);
101 trace PG1; trace PG2; trace PG3; trace PG4;
102
103 drawoptions(withcolor SteelBlue withpen pencircle scaled 0.85pt);
104 trace Dvoute1; trace Dvoute2; trace Dvoute3; trace Dvoute4;
105 drawoptions();
106
107 gddCouleurPoint := DarkRed;
108 pointe O;
109 pointe A;
110 pointe B; pointe D;
111 pointe B2;
112
113 gddCouleurPoint := Bisque;
114 pointe F1; pointe F2; pointe F3; pointe F4; pointe F5;
115 pointe G1; pointe G2;pointe G3;pointe G4;
116 gddCouleurPoint := 1.3*Grey;
117 pointe DD;
118 pointe C1; pointe C2; pointe C3;
119 pointe D1; pointe D2;
120
121 gddCouleurPoint := DarkSalmon;
122 pointe P;
123 pointe I1; pointe I2; pointe I3; pointe I4;
124 Fenetre(-5,-7,5,5);
125 endfig;
126 end.