Debian Codegraph @

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

raw
1 % strength1defect.mp
2 % L. Nobre G.
3 % 2002
4
5 verbatimtex
6 \documentclass{article}
7 \usepackage{palatino}
8 \usepackage{concmath}
9 \usepackage{ccfonts}
10 \begin{document}
11 etex
12
13 color col[],cyan, magenta, yellow;
14 cyan=blue+green; magenta=red+blue;yellow=green+red;
15 col[-2]:=col[-1]:=col0:=black;
16 col1:=red;
17 col2:=(.2,.2,1); %blue
18 col3:=(1,.66,0); %orange
19 col4:=.85*green;
20 col5:=.9*magenta;
21 col6:=0.85*cyan;
22 col7:=.85*yellow;
23
24 beginfig(1);
25 numeric ymax, xmax, i, j, noise, twist, grid, size, u, actsize;
26 numeric extral, yposa, yposb, yposc;
27 pair actpos, direct, one, two;
28 path linea, lineb, linec, linex, liney;
29 color cola, colb, colc, colx;
30 picture pica, picb, picc;
31 u = 0.3mm;
32 xmax = 9;
33 ymax = 9;
34 noise = 1u;
35 extral = 1;
36 size = 5u;
37 yposa = 8;
38 yposb = 5;
39 yposc = 2;
40 % cola = (0.78,0.32,0.12);
41 % colb = (0.18,0.82,0.12);
42 % colc = (0.18,0.22,0.92);
43 colx = (0.78,0.75,0.72);
44 cola = col5;
45 colb = col4;
46 colc = col3;
47 grid = size + 3*noise;
48 linea = (grid*(-xmax-extral,yposa))--(grid*(xmax+extral,yposa));
49 lineb = (grid*(-xmax-extral,yposb))--(grid*(xmax+extral,yposb));
50 linec = (grid*(-xmax-extral,yposc))--(grid*(xmax+extral,yposc));
51 linex = (grid*(-xmax-2*extral,0))--(grid*(xmax+2*extral,0));
52 liney = (grid*(0,-ymax-2*extral))--(grid*(0,ymax+2*extral));
53 pica = thelabel.rt( btex A etex, grid*(xmax+extral,yposa) );
54 picb = thelabel.rt( btex B etex, grid*(xmax+extral,yposb) );
55 picc = thelabel.rt( btex C etex, grid*(xmax+extral,yposc) );
56 draw pica withcolor cola;
57 draw picb withcolor colb;
58 draw picc withcolor colc;
59 label.llft( btex $x$ etex, grid*(xmax+2*extral,0) );
60 label.llft( btex $y$ etex, grid*(0,ymax+2*extral) );
61 pickup pencircle scaled 2u;
62 draw linea withcolor cola;
63 draw lineb withcolor colb;
64 draw linec withcolor colc;
65 pickup pencircle scaled 0.5u;
66 drawarrow linex withcolor colx;
67 drawarrow liney withcolor colx;
68 pickup pencircle scaled u;
69 for i=-xmax upto xmax:
70 for j=-ymax upto ymax:
71 actpos:=(grid*i+noise*normaldeviate,grid*j+noise*normaldeviate);
72 direct:=unitvector(actpos);
73 actsize:=size/2;
74 one:=actpos-actsize*direct;
75 two:=actpos+actsize*direct;
76 draw one--two;
77 endfor;
78 endfor;
79 endfig;
80
81 verbatimtex
82 \end{document}
83 etex
84
85 end;