summaryrefslogtreecommitdiff
path: root/graphics/metapost/contrib/macros/mp-geom2d/doc/exemples/coniques/ellipse.mp
blob: b95e3d82d2f7e75f582f518159f3c81de5a98e0e (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
input geom2d;

beginfig(1);
    C = Point(3,2);
    A = Point(5,1);
    B = Point(3.5,3) ;
    E = Ellipse(C,A,B);
    F = EllipseF(C,A,2.5);
    D = Centre(F);
    pointe D;
    trace E;
    trace F;
    pointe C;
    pointe A;
    pointe B;
endfig;



beginfig(2);
  F1 = Point(3,1);
  F2 = Point(1.5,0.5);
  E := EllipseF(F1,F2,1.2);
  trace E;

  bboxmargin := 1cm;
  path cadre; cadre = bbox currentpicture;

  pair M;
  M = point 3.5 of (gddTraceObjet(E)) ;
  M' = PointImp(M);

  d:=Longueur(M',F1)+Longueur(M',F2);
  show d; % Pour vérifier que l'on obtient bien 2a

  trace Segment(F1,M');
  trace Segment(F2,M');
  D := TangenteEllipse(E,M);
  trace D;

  gddTaillePoint := 1.5;
  gddCouleurPoint := Yellow;
  pointe M';
  gddCouleurPoint := Gainsboro;
  pointe F1;
  pointe F2;

  setbounds currentpicture to cadre;
endfig;


beginfig(3);
  F1 := Point(3,1);
  F2 := Point(1.5,0.5);
  E := EllipseF(F1,F2,1.2);
  trace E;

  bboxmargin := 5cm;
  path cadre; cadre = bbox currentpicture;
  numeric M;
  P = Point(1,-1);
  C1 = CercleCP(P,F1);
  trace C1;
  C2 = Cercle(F2,2*DemiGrandAxe(E));
  trace C2;
  T1 = IntersectionCercles(C1,C2);
  T2 = IntersectionCercles(C2,C1);
  if(Longueur(F1,T1)<Longueur(F1,T2)):
    U = T1;
  else:
    U = T2;
  fi
  DU = Segment(F2,U);
  pair Ip;
  Ip := (gddTraceObjet(DU)) intersectionpoint (gddTraceObjet(E));
  M = PointImp(Ip);
  trace DU;
  marque.urt "M";
  marque.urt "P";
  marque.urt "F1";
  marque.urt "F2";
  marque.urt "T1";
  marque.urt "T2";
  
  setbounds currentpicture to cadre;
endfig;
beginfig(4);
  F1 := Point(3,1);
  F2 := Point(1.5,0.5);
  E := EllipseF(F1,F2,1.2);
  trace E;
  P := Point(4,1);
  bboxmargin := 5cm;
  path cadre; cadre = bbox currentpicture;
  T1 := TangenteExterieureEllipse(E,P,1); 
  trace T1;
  T2 := TangenteExterieureEllipse(E,P,2); 
  trace T2;
  marque.urt "P";
  pointe gddB[T1];

  pointe gddB[T2];
  setbounds currentpicture to cadre;
endfig;
end.