Debian Codegraph @

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

raw
1 input geom2d;
2
3 beginfig(1);
4 % base points for the 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 % the base line of the ogive
11 AB = Line(A,B);
12 % we take an arbitrary line
13 Ct = Point(0.8,-2); % arbitrary point
14 AC = Line(A,Ct); % arbitrary line
15 % we take three equal lengths on the line
16 longueurTier := 1.4;
17 C1 = ReportOnLine(A,AC,longueurTier);
18 C2 = ReportOnLine(C1,AC,longueurTier);
19 C3 = ReportOnLine(C2,AC,longueurTier);
20 % we define the line passing through B and the last point
21 BC = Line(B,C3);
22 % we construct a perpendicular line to BC
23 D = Point(-4,0);
24 perpD = PerpendicularLine(BC,D);
25 DD = LinesIntersection(perpD,BC);
26 % we project C2 and C1 onto the line AB to divide [AB] into 3 equal parts
27 perpC2 = PerpendicularLine(perpD,C2);
28 perpC1 = PerpendicularLine(perpD,C1);
29 D1 = LinesIntersection(AB,perpC1);
30 D2 = LinesIntersection(AB,perpC2);
31 % we construct the envelope of the ogive
32 C_DA = CircleCP(D2,A);
33 C_DB = CircleCP(D1,B);
34 C_DA2 = CircleCP(D2,A2);
35 C_DB2 = CircleCP(D1,B2);
36 % we construct the point P for the final projection
37 C_AB = CircleCP(A,B);
38 C_BA = CircleCP(B,A);
39 P = CirclesIntersection(C_BA,C_AB);
40 % we take 5 equal lengths on the initial arbitrary line
41 longueurCinq :=0.8;
42 F1 = ReportOnLine(A,AC,longueurCinq);
43 F2 = ReportOnLine(F1,AC,longueurCinq);
44 F3 = ReportOnLine(F2,AC,longueurCinq);
45 F4 = ReportOnLine(F3,AC,longueurCinq);
46 F5 = ReportOnLine(F4,AC,longueurCinq);
47 % we project the points onto AB to divide [AB] into 5 equal parts
48 BF5 = Line(B,F5);
49 perpF5 = PerpendicularLine(BF5,A2);
50 CC = LinesIntersection(BF5,perpF5);
51 perpF4 = PerpendicularLine(perpF5,F4);
52 perpF3 = PerpendicularLine(perpF5,F3);
53 perpF2 = PerpendicularLine(perpF5,F2);
54 perpF1 = PerpendicularLine(perpF5,F1);
55 G1 = LinesIntersection(AB,perpF1);
56 G2 = LinesIntersection(AB,perpF2);
57 G3 = LinesIntersection(AB,perpF3);
58 G4 = LinesIntersection(AB,perpF4);
59 % we project the Gi points onto the ogive using point P
60 PG1 = Line(P,G1);
61 PG2 = Line(P,G2);
62 PG3 = Line(P,G3);
63 PG4 = Line(P,G4);
64 I1 = LineCircleIntersection(PG1,C_DA,1);
65 I2 = LineCircleIntersection(PG2,C_DA,2);
66 I3 = LineCircleIntersection(PG3,C_DB,2);
67 I4 = LineCircleIntersection(PG4,C_DB,2);
68 % from the 2 points resulting from dividing [AB] into 3 parts
69 % we draw the separations of the stones that make up the ogive
70 Dvoute1 = Line(D2,I1);
71 Dvoute2 = Line(D2,I2);
72 Dvoute3 = Line(D1,I3);
73 Dvoute4 = Line(D1,I4);
74
75 % drawings
76 drawoptions(withcolor 1.3*Grey);
77 gddDraw perpC2; gddDraw perpC1;
78 gddDraw AB;
79 gddDraw AC;
80 gddDraw BC;
81 gddDraw perpD;
82 gddDraw OrthoSign(B,DD,A2,0.2);
83
84 drawoptions(withcolor Bisque);
85 gddDraw BF5;
86 gddDraw perpF5;gddDraw perpF4;gddDraw perpF3;gddDraw perpF2;gddDraw perpF1;
87 gddDraw OrthoSign(B,CC,A2,0.2);
88
89 drawoptions(withcolor SteelBlue withpen pencircle scaled 0.85pt);
90 gddDraw gddDrawCircleArc(C_DA,Pi/2,Pi);
91 gddDraw gddDrawCircleArc(C_DA2,Pi/2,Pi);
92 gddDraw gddDrawCircleArc(C_DB2,0,Pi/2);
93 gddDraw gddDrawCircleArc(C_DB,0,Pi/2);
94
95 drawoptions();
96 gddDraw gddDrawCircleArc(C_AB,0,-Pi/2) dashed evenly;
97 gddDraw gddDrawCircleArc(C_BA,Pi,3Pi/2) dashed evenly;
98
99 drawoptions(withcolor DarkSalmon);
100 gddDraw PG1; gddDraw PG2; gddDraw PG3; gddDraw PG4;
101
102 drawoptions(withcolor SteelBlue withpen pencircle scaled 0.85pt);
103 gddDraw Dvoute1; gddDraw Dvoute2; gddDraw Dvoute3; gddDraw Dvoute4;
104 drawoptions();
105
106 SetPointColor(DarkRed);
107 gddDrawPoint O;
108 gddDrawPoint A;
109 gddDrawPoint B; gddDrawPoint D;
110 gddDrawPoint B2;
111
112 SetPointColor(Bisque);
113 gddDrawPoint F1; gddDrawPoint F2; gddDrawPoint F3; gddDrawPoint F4;
114 gddDrawPoint F5;
115 gddDrawPoint G1; gddDrawPoint G2;gddDrawPoint G3;gddDrawPoint G4;
116 SetPointColor(1.3*Grey);
117 gddDrawPoint DD;
118 gddDrawPoint C1; gddDrawPoint C2; gddDrawPoint C3;
119 gddDrawPoint D1; gddDrawPoint D2;
120
121 SetPointColor(DarkSalmon);
122 gddDrawPoint P;
123 gddDrawPoint I1; gddDrawPoint I2; gddDrawPoint I3; gddDrawPoint I4;
124 Window(-5,-7,5,5);
125 endfig;
126 end.
127