Documentation : section Objectif plus couleurs
[mp-gdd.git] / exemples / polaires / pol05.mp
1 input gdd;
2 input gdd-rep;
3 input gdd-lbl;
4 input gdd-tra;
5 input svgnames;
6
7 lblPreambule := "\usepackage[frenchb]{babel}"       &
8                 "\usepackage[garamond]{mathdesign}" &
9                 "\usepackage{amsmath}";
10
11 input gdd-fct;
12 input gdd-plt;
13
14 labeloffset := 6;
15 gddU:=1.2cm;
16
17 vardef r(expr t)  = sqrt(cos(2*t))  enddef;
18 vardef ri(expr t) = -sqrt(cos(2*t))  enddef;
19 vardef rh(expr t) = 1 / r(t) enddef;
20 vardef rhi(expr t) = 1 / ri(t) enddef;
21
22 vardef u(expr v) = sqrt(v*v+4) enddef;
23
24 vardef rp(expr t) = (r(t)*cos(t),r(t)*sin(t)) enddef;
25
26 def traceDoubleVecteur(expr o,d)= drawdblarrow ((o-d)--(o+d)) gddEnPlace enddef;
27
28 def avecCrayon(expr t,c) = withpen pencircle scaled t withcolor c enddef;
29
30
31 a = arccos(1/sqrt(3));
32
33
34
35 beginfig(1);
36
37
38  Repere(10,6,5,3,3,3);
39  Axes; 
40  Debut; 
41   Graduations;
42
43   drawoptions(withcolor Gainsboro);
44
45   nb = 40;
46   pas = Pi / (2*nb);
47
48   for i:=0 upto nb:
49     trace Droite((0,0),(cos(-Pi/4+i*pas),sin(-Pi/4+i*pas)));
50   endfor;
51
52   trace Droite((0,0),(1,1));
53   trace Droite((0,0),(-1,1));
54
55   trace CourbeEnPolaires(rh,-Pi/4+0.01,Pi/4-0.01,150)
56     avecCrayon(0.75,Crimson);
57   trace CourbeEnPolaires(rhi,-Pi/4+0.01,Pi/4-0.01,150)
58     avecCrayon(0.75,Crimson);
59
60
61   traceDoubleVecteur((0,0),0.25(1,1)) avecCrayon(1,LightSalmon);
62   traceDoubleVecteur((0,0),0.25(-1,1)) avecCrayon(1,LightSalmon);
63   traceDoubleVecteur((1,0),(0,0.2)) avecCrayon(1,LightSalmon);
64   traceDoubleVecteur((-1,0),(0,0.2)) avecCrayon(1,LightSalmon);
65   traceDoubleVecteur(rp(Pi/6),(0.2,0)) avecCrayon(1,LightSalmon);
66   traceDoubleVecteur(rp(-Pi/6),(0.2,0)) avecCrayon(1,LightSalmon);
67   traceDoubleVecteur(rp(5Pi/6),(0.2,0)) avecCrayon(1,LightSalmon);
68   traceDoubleVecteur(rp(-5Pi/6),(0.2,0)) avecCrayon(1,LightSalmon);
69
70   trace (0,0)--CourbeEnPolaires(r,-Pi/4+0.0001,Pi/4-0.0001,150)--cycle
71     avecCrayon(1.5,LightSlateGrey);
72   trace (0,0)--CourbeEnPolaires(ri,-Pi/4+0.0001,Pi/4-0.0001,150)--cycle
73     avecCrayon(1.5,LightSlateGrey);
74
75   pointe Point(0,0);
76
77  Fin;
78
79
80 endfig;
81
82 end

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.