summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/reuleaux.mp
blob: 2bc0763ace7cc726ec1483dc89f0b83fd1dab032 (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
% reuleaux.mp
% L. Nobre G.
% 2012

prologues := 1;

beginfig(1);
  numeric u, desv, ray;
  path rouletri, pathpart, pa, pb, pc, border;
  u = 150mm;
  desv = u*sqrt(3)/3;
  ray = (sqrt(3)/3-0.5)*u/2;
  pathpart = halfcircle scaled u cutafter (origin--u*dir(60));
  pathpart := pathpart shifted (desv*dir(-150)/2);
  pa = pathpart;
  pb = pathpart rotated 120;
  pc = pathpart rotated -120;
  rouletri = pa--pb--pc--cycle;
  draw rouletri;
  border=(u/4,u/4)--(-u/4,u/4)--(-u/4,-u/4)--(u/4,-u/4)--cycle;
  draw border shifted (ray*up);
endfig;

beginfig(2);
  draw border withcolor red;
  numeric i, N, astep;
  N = 4;
  astep = 3*N;
  for i=astep step astep until 360:
    draw rouletri rotated (-i/3) shifted (ray*dir(i-90));
  endfor;
endfig;

end.