Debian Codegraph @

texmf-dist/doc/metapost/mp-geom2d/exemples/coniques/ellipse.mp

raw
1 input geom2d;
2
3 beginfig(1);
4 C = Point(3,2);
5 A = Point(5,1);
6 B = Point(3.5,3) ;
7 E = Ellipse(C,A,B);
8 F = EllipseF(C,A,2.5);
9 D = Centre(F);
10 pointe D;
11 trace E;
12 trace F;
13 pointe C;
14 pointe A;
15 pointe B;
16 endfig;
17
18
19
20 beginfig(2);
21 F1 = Point(3,1);
22 F2 = Point(1.5,0.5);
23 E := EllipseF(F1,F2,1.2);
24 trace E;
25
26 bboxmargin := 1cm;
27 path cadre; cadre = bbox currentpicture;
28
29 pair M;
30 M = point 3.5 of (gddTraceObjet(E)) ;
31 M' = PointImp(M);
32
33 d:=Longueur(M',F1)+Longueur(M',F2);
34 show d; % Pour vérifier que l'on obtient bien 2a
35
36 trace Segment(F1,M');
37 trace Segment(F2,M');
38 D := TangenteEllipse(E,M);
39 trace D;
40
41 gddTaillePoint := 1.5;
42 gddCouleurPoint := Yellow;
43 pointe M';
44 gddCouleurPoint := Gainsboro;
45 pointe F1;
46 pointe F2;
47
48 setbounds currentpicture to cadre;
49 endfig;
50
51
52 beginfig(3);
53 F1 := Point(3,1);
54 F2 := Point(1.5,0.5);
55 E := EllipseF(F1,F2,1.2);
56 trace E;
57
58 bboxmargin := 5cm;
59 path cadre; cadre = bbox currentpicture;
60 numeric M;
61 P = Point(1,-1);
62 C1 = CercleCP(P,F1);
63 trace C1;
64 C2 = Cercle(F2,2*DemiGrandAxe(E));
65 trace C2;
66 T1 = IntersectionCercles(C1,C2);
67 T2 = IntersectionCercles(C2,C1);
68 if(Longueur(F1,T1)<Longueur(F1,T2)):
69 U = T1;
70 else:
71 U = T2;
72 fi
73 DU = Segment(F2,U);
74 pair Ip;
75 Ip := (gddTraceObjet(DU)) intersectionpoint (gddTraceObjet(E));
76 M = PointImp(Ip);
77 trace DU;
78 marque.urt "M";
79 marque.urt "P";
80 marque.urt "F1";
81 marque.urt "F2";
82 marque.urt "T1";
83 marque.urt "T2";
84
85 setbounds currentpicture to cadre;
86 endfig;
87 beginfig(4);
88 F1 := Point(3,1);
89 F2 := Point(1.5,0.5);
90 E := EllipseF(F1,F2,1.2);
91 trace E;
92 P := Point(4,1);
93 bboxmargin := 5cm;
94 path cadre; cadre = bbox currentpicture;
95 T1 := TangenteExterieureEllipse(E,P,1);
96 trace T1;
97 T2 := TangenteExterieureEllipse(E,P,2);
98 trace T2;
99 marque.urt "P";
100 pointe gddB[T1];
101
102 pointe gddB[T2];
103 setbounds currentpicture to cadre;
104 endfig;
105 end.