Debian Codegraph @

texmf-dist/doc/metapost/featpost/example/reuleaux.mp

raw
1 % reuleaux.mp
2 % L. Nobre G.
3 % 2012
4
5 prologues := 1;
6
7 beginfig(1);
8 numeric u, desv, ray;
9 path rouletri, pathpart, pa, pb, pc, border;
10 u = 150mm;
11 desv = u*sqrt(3)/3;
12 ray = (sqrt(3)/3-0.5)*u/2;
13 pathpart = halfcircle scaled u cutafter (origin--u*dir(60));
14 pathpart := pathpart shifted (desv*dir(-150)/2);
15 pa = pathpart;
16 pb = pathpart rotated 120;
17 pc = pathpart rotated -120;
18 rouletri = pa--pb--pc--cycle;
19 draw rouletri;
20 border=(u/4,u/4)--(-u/4,u/4)--(-u/4,-u/4)--(u/4,-u/4)--cycle;
21 draw border shifted (ray*up);
22 endfig;
23
24 beginfig(2);
25 draw border withcolor red;
26 numeric i, N, astep;
27 N = 4;
28 astep = 3*N;
29 for i=astep step astep until 360:
30 draw rouletri rotated (-i/3) shifted (ray*dir(i-90));
31 endfor;
32 endfig;
33
34 end.