Debian Codegraph @

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

raw
1 % twoDcolision.mp
2 % L. Nobre G.
3 % 2013
4
5 verbatimtex \documentclass{article}\begin{document} etex;
6
7 beginfig(1);
8 ahangle := 30;
9 numeric angthe, angalf, xpoin;
10 numeric radthe, vini;
11 numeric ysize, xsize, margs, units, i, dim;
12 pair vone, vinic, vtwo;
13 path xaxis, yaxis, vonep, vinicp, vtwop, auxil;
14 pen thick, usual, vthin;
15 angthe = 65;
16 dim = 50;
17 units = 0.8mm;
18 ahlength := 2.5units;
19 margs = 8units;
20 xsize = 75units;
21 ysize = 40units;
22 radthe = 23units;
23 vini = xsize-2.5*margs;
24 thick = pencircle scaled 0.5units;
25 usual = pencircle scaled 0.2units;
26 vthin = pencircle scaled 0.1units;
27 yaxis = ( 0, -vini/2 )--( 0, ysize-margs );
28 xaxis = ( -margs, 0 )--( xsize-margs, 0 );
29 pickup usual;
30 drawarrow xaxis;
31 label.bot( btex $x$ etex, point 1 of xaxis );
32 drawarrow yaxis;
33 label.lft( btex $y$ etex, point 1 of yaxis );
34 pickup thick;
35 vinic = vini*right;
36 vinicp = origin--vinic;
37 drawarrow vinicp;
38 label.urt( btex $\vec{v}_i$ etex, vinic );
39 vone = vini*cosd(angthe)*dir(angthe);
40 vonep = origin--vone;
41 drawarrow vonep;
42 label.ulft( btex $\vec{v}_1$ etex, vone );
43 vtwo = vini*sind(angthe)*dir(angthe-90);
44 vtwop = origin--vtwo;
45 drawarrow vtwop;
46 label.lrt( btex $\vec{v}_2$ etex, vtwo );
47 pickup vthin;
48 draw fullcircle scaled radthe cutafter vonep;
49 draw fullcircle scaled vini shifted (vinic/2);
50 label.urt( btex $\Theta$ etex, ( radthe/2, 0 ) );
51 z1 = dir(angthe)*margs/2;
52 z2 = dir(angthe-45)*margs/sqrt(2);
53 z3 = dir(angthe-90)*margs/2;
54 draw z1--z2--z3;
55 endfig;
56
57 verbatimtex \end{document} etex
58
59 end;