Debian Codegraph @

texmf-dist/doc/metapost/mp-geom2d/exemples/courbes/cp01.mp

raw
1 input geom2d;
2
3
4 labeloffset := 6;
5 gddU:=1.2cm;
6
7 vardef f(expr t) = 2*cos(t)*cos(t)*cos(t) enddef;
8 vardef g(expr t) = 2*sin(t)*sin(t)*sin(t) enddef;
9
10
11 beginfig(1);
12 Repere(8,8,4,4,1.8,1.8);
13 Axes;
14 Debut;
15 Graduations; Unites(1);
16 drawoptions(withpen pencircle scaled 0.5 withcolor LightSlateGrey);
17 trace ((-2,-2)--(-2,2)--(2,2)--(2,-2)--cycle);
18
19 nb = 80;
20 pas = 2*Pi/nb;
21 for i=0 upto nb: trace (0,2*sin(i*pas))--(2*cos(i*pas),0); endfor;
22
23 fleche Segment((2,0),(1.2,0)) avecCrayon(1,RoyalBlue);
24 fleche Segment((-2,0),(-1.2,0)) avecCrayon(1,RoyalBlue);
25 fleche Segment((0,2),(0,1.2)) avecCrayon(1,RoyalBlue);
26 fleche Segment((0,-2),(0,-1.2)) avecCrayon(1,RoyalBlue);
27
28 trace Courbe(f,g,0,2*Pi,500) avecCrayon(1.5,DarkOrange);
29
30 pointe Point(0,0);
31 pointe Point(2,0);
32 pointe Point(0,2);
33 pointe Point(0,-2);
34 pointe Point(-2,0);
35
36 Fin;
37 endfig;
38 end