Debian Codegraph @

texmf-dist/doc/metapost/mp-geom2d/exemples/polaires/pol02-en.mp

raw
1 input geom2d;
2
3 labeloffset := 6;
4 gddU:=0.8cm;
5
6 vardef r(expr t) = 1+cos(t) enddef;
7 vardef rp(expr t) = (r(t)*cos(t),r(t)*sin(t)) enddef;
8
9 def DrawDoubleVector(expr o,d)= drawdblarrow ((o-d)--(o+d)) gddInPlace enddef;
10
11 beginfig(1);
12 Frame(10,10,2,5,3.5,3.5);
13 Axis;
14 gddBegin;
15 Graduations; Units(1);
16
17 drawoptions(withcolor LightSlateGrey);
18 draw fullcircle shifted (0.5,0) gddInPlace withPen(1,Gold);
19
20 nb = 80;
21 pas = 2Pi / nb;
22 for i=0 upto nb:
23 theta := i * pas;
24 draw (fullcircle scaled 2cos(theta)
25 shifted (cos(theta)*cos(theta),cos(theta)*sin(theta))) gddInPlace;
26 endfor;
27
28
29 DrawDoubleVector(rp(0),(0,0.3)) withPen(1,LightPink);
30 DrawDoubleVector(rp(Pi/3),(0.3,0)) withPen(1,LightPink);
31 DrawDoubleVector(rp(Pi/2),(0.2,0.2)) withPen(1,LightPink);
32 DrawDoubleVector(rp(2Pi/3),(0,0.3)) withPen(1,LightPink);
33 DrawDoubleVector(rp(-Pi/3),(0.3,0)) withPen(1,LightPink);
34 DrawDoubleVector(rp(-Pi/2),(0.2,-0.2)) withPen(1,LightPink);
35 DrawDoubleVector(rp(-2Pi/3),(0,0.3)) withPen(1,LightPink);
36
37 gddArrow Segment(origine,(-0.3,0)) withPen(1,LightPink);
38 gddDraw PolarCurve(r,-Pi,Pi,100) withPen(1.5,Indigo);
39
40 gddDrawPoint Point(0,0);
41 gddDrawPoint Point(2,0);
42 gddDrawPoint PairTOPoint(rp(Pi/3));
43 gddDrawPoint PairTOPoint(rp(-Pi/3));
44 gddDrawPoint PairTOPoint(rp(2Pi/3));
45 gddDrawPoint PairTOPoint(rp(-2Pi/3));
46 gddDrawPoint Point(0,1);
47 gddDrawPoint Point(0,-1);
48
49 gddLabel.urt(textext("\(\mathcal{C}\)"),(1,0)) withcolor Magenta;
50 gddEnd;
51 endfig;
52 end