summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/micostufas.mp
blob: 1ac2ca3734da60bdec6fe9cbcc918c7cbf4cebd1 (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
35
36
37
38
39
40
41
% micostufas.mp
% L. Nobre G.
% 2013

prologues := 1;

beginfig(1);
  numeric u, basecant, altucnat, diagcant, baseestu, altuestu, diagestu;
  numeric aux, rayestu;
  u = 1cm;
  basecant = 0.5u;
  diagcant = 2.6u;
  altucant = diagcant +-+ 0.5basecant;
  baseestu = 6u;
  altuestu = 4u;
  diagestu = altuestu ++ 0.5baseestu;
  numeric angalpha, scalefac, cantdesv;
  angalpha = 180-2*angle(0.5baseestu,altuestu); %show angalpha;
  rayestu = altuestu/sind(angalpha);
  message "Raio de curvatura: " & decimal(rayestu/u);
  cantdesv = 0.25*(baseestu+basecant);
  path auxpa, cant, goticarch;
  cant = (-0.5basecant,0)--(0,altucant)--(0.5basecant,0);
  draw cant;
  draw cant shifted (-cantdesv,0);
  draw cant shifted (cantdesv,0);
  z1 = (-0.5*cosd(angalpha),0);
  auxpa = (halfcircle cutafter (origin--dir(angalpha))) shifted z1;
  aux = xpart point 0 of auxpa;
  scalefac = 0.5*baseestu/aux;
  goticarch = auxpa scaled scalefac;
  draw goticarch;
  draw goticarch xscaled -1;
  z0 = z1 scaled scalefac;
  drawarrow z0--(z0+rayestu*dir(angalpha/2));
  numeric comprimarco;
  comprimarco = rayestu*3.14159*angalpha/(180*u);
  message "Comprimento de cada arco: " & decimal(comprimarco);
endfig;

end.