Debian Codegraph @

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

raw
1 % circlespeedprofile.mp
2 % L. Nobre G.
3 % 2012
4
5 prologues := 1;
6
7 beginfig(1);
8 numeric u, s, a, ai, as, af, dist, b, ray;
9 pen one;
10 pair poi, ref, tip, cen, contactpoi, toppoi;
11 u = 10cm;
12 s = 0.5;
13 ai = 270;
14 as = -8;
15 af = -90-as;
16 one = pencircle scaled 0.015u;
17 draw (-0.5u*(1+s,1))--(u,-0.5u) withpen one withcolor 0.5white;
18 draw fullcircle scaled u withpen one;
19 contactpoi = (0,-0.5u);
20 toppoi = (0,0.5u);
21 cen = 0.5*(contactpoi+toppoi+(s*u,0));
22 ray = abs( cen-toppoi );
23 draw fullcircle scaled 2ray shifted cen withpen one withcolor red;
24 ref = (0,-0.5u);
25 ahangle := 30;
26 ahlength := 0.03u;
27 for a=ai step as until af:
28 poi := 0.5u*dir(a);
29 dist := abs( poi-ref );
30 tip := poi+s*dist*dir(0.5*a-45);
31 drawarrow poi--tip;
32 endfor;
33 % path prof;
34 % prof = for a=ai step as until af:
35 % hide( poi := 0.5u*dir(a);
36 % dist := abs( poi-ref);
37 % tip := (poi+s*dist*dir(0.5*a-45));
38 % drawarrow poi--tip;)
39 % tip.. endfor cycle;
40 % draw prof withpen one withcolor red;
41 endfig;
42
43 end.