Debian Codegraph @

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

raw
1 % aledlogo.mp
2 % L. Nobre G.
3 % 2007
4
5 input featpost3Dplus2D;
6
7 prologues := 1;
8
9 verbatimtex
10 \documentclass{article}
11 \usepackage{marvosym}
12 \begin{document}
13 etex
14
15 vardef calxtep( expr Beglim, Endlim, Instep ) =
16 ((Endlim-Beglim)/floor((Endlim-Beglim)/Instep))
17 enddef;
18
19 def drawfila( expr H, Ray, Astart, Afinis, Astep, Sray ) =
20 begingroup
21 save a, c, p, n, i, s, l, r, u, d, inc, rad, ba, bb, vertex;
22 numeric a, n, i, s, inc, sa, sb;
23 color c, p, l, r, u, d, rad, vertex;
24 path shape;
25 boolean ba, bb;
26 picture aux;
27 inc = -5;
28 sa = 2;
29 sb = 0.27;
30 vertex = (-0.7,0.9,0.15);
31 n = floor((Afinis-Astart)/Astep);
32 s = (Afinis-Astart)/n;
33 for i=0 upto n:
34 a := Astart+i*s;
35 p := (Ray*cosd(a),Ray*sind(a),H);
36 rad := (cosd(a),sind(a),0);
37 u := Sray*(blue*cosd(inc)+rad*sind(inc));
38 r := Sray*ncrossprod( p-f, u );
39 l := -r;
40 d := -u;
41 ba := (ypart rp(p)) < (ypart rp(vertex))
42 + sa*((xpart rp(p))-(xpart rp(vertex)));
43 bb := (ypart rp(p)) > (ypart rp(vertex))
44 + sb*((xpart rp(p))-(xpart rp(vertex)));
45 shape := rp(p+r+d)--rp(p+r+u)--rp(p+l+u)--rp(p+l+d)--cycle;
46 if ( uniformdeviate(1) < 0.5 ):
47 %% if ( uniformdeviate(1) < 0.7 ): %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %% if ( ba and bb ):
49 c := black;
50 unfill shape;
51 draw shape withcolor c;
52 aux := thelabel( btex \EyesDollar etex scaled (ps( p, 7 )), rp(p) );
53 draw aux withcolor c;
54 %%%% fill rp(p+r+d)--rp(p+r+u)--rp(p+l)--cycle withcolor c;
55 else:
56 %%%% c := 0.5white;
57 %% c := 0.5red;
58 c := black;
59 unfill shape;
60 draw shape withcolor c;
61 aux := thelabel( btex \EURhv etex scaled (ps( p, 9 )), rp(p) );
62 draw aux withcolor c;
63 %%%% fill rp(p+l+d)--rp(p+l+u)--rp(p+r)--cycle withcolor c;
64 fi;
65 %% fill rp(p+r+u)--rp(p+l+u)--rp(p+d)--cycle withcolor c;
66 %%%% fill rp(p+r)--rp(p+u)--rp(p+l)--rp(p+d)--cycle withcolor c;
67 %%%% fill shape withcolor c;
68 %%%% draw shape withcolor white withpen pensquare scaled 3pt;
69 %%%% fill rigorousfearpath( p, Sray ) withcolor c;
70 endfor
71 endgroup
72 enddef;
73
74 %SphericalDistortion := true;
75
76 beginfig(1);
77 numeric heig, bray, tray, vang, sray, ldis, fdis, cwid, cnum, ylen;
78 heig = 0.35;
79 bray = 0.95;
80 tray = 2.25;
81 vang = 95;
82 sray = 0.029;
83 ldis = 0.02;
84 fdis = 0.075;
85 cwid = 0.15;
86 cnum = 2;
87 ylen = -0.16;
88 f := (0,ylen,heig);
89 viewcentr := (0,tray,heig);
90 color thered;
91 thered = 0.66red;
92 numeric degperrad, asector, s;
93 degperrad = 180.0/3.14159;
94 numeric a, h, astep, ray, raystep, hstep, abeg, aend, astart, afinis, awid;
95 raystep = calxtep( bray, tray, fdis );
96 hstep = raystep/(tray-bray);
97 h = 1;
98 abeg = 0.5*(180-vang);
99 aend = 180-abeg;
100 for ray=tray step -raystep until bray:
101 awid := degperrad*cwid/ray;
102 asector := (vang-cnum*awid)/(cnum+1);
103 astep := degperrad*(ldis+2*sray)/ray;
104 for s=0 upto cnum:
105 astart := abeg+s*(asector+awid);
106 afinis := astart+asector;
107 drawfila( h, ray, astart, afinis, astep, sray );
108 endfor;
109 h := h - hstep;
110 endfor;
111 picture stor;
112 stor = currentpicture;
113 bboxmargin := 2cm;
114 fill bbox stor withcolor thered;
115 draw stor;
116 endfig;
117
118 beginfig(2);
119 numeric angout, anglow, rayout, distra, lifactor, lidist, madist;
120 numeric maleng, numstp, madstp, malstp, mafrac, i, j, begy, endy, xcoord;
121 color cenpos, vechor, vecver, yela, yelb, dblu, mgre;
122 pair ulc, llc, urc;
123 picture block;
124 angout=30;
125 anglow=-6;
126 lifactor=2;
127 lidist=3.5;
128 mafrac=0.6;
129 numstp=25;
130 f:=(7,6,5);
131 viewcentr:=(0,-1.4,0);
132 Spread:=35;
133 yela=(1,1,0.7);
134 yelb=(1,1,0.45);
135 background:=yelb;
136 dblu=0.4blue;
137 mgre=0.6green;
138 rayout=sind(angout);
139 distra=cosd(angout);
140 llc = point 0 of VGAborder;
141 ulc = point 3 of VGAborder;
142 urc = point 2 of VGAborder;
143 madist = abs( ulc-llc );
144 maleng = abs( urc-ulc );
145 malstp = maleng/numstp;
146 madstp = 5*malstp/3;
147 z2 = mafrac*(malstp,madstp);
148 z1 = mafrac*(0,madstp);
149 z3 = mafrac*(malstp,0);
150 fill origin--z1--z2--z3--cycle shifted (0.5*(1-mafrac)*(malstp,madstp))
151 withcolor mgre;
152 block = currentpicture;
153 currentpicture := nullpicture;
154 fill VGAborder withcolor dblu;
155 for i=0 upto numstp-1:
156 begy:= (ypart ulc) + madstp*(1+normaldeviate);
157 endy:= (ypart 0.5[llc,ulc]) + 4*madstp*normaldeviate;
158 xcoord:= (xpart llc) + i*malstp;
159 for j=begy step -madstp until endy:
160 draw block shifted (xcoord,j);
161 endfor;
162 endfor;
163 clip currentpicture to VGAborder;
164 cenpos:=distra*(-cosd(30)*cosd(anglow),-sind(30)*cosd(anglow),sind(anglow));
165 vechor:=rayout*(sind(30),-cosd(30),0);
166 vecver:=rayout*(cosd(30)*sind(anglow),sind(30)*sind(anglow),cosd(anglow));
167 drawoptions( withcolor yelb );
168 whatisthis(cenpos,vechor,vecver,3lidist,1+3*(lifactor-1));
169 fill rigorousfearpath( black, 1 ) withcolor yela;
170 cenpos:=distra*(cosd(30)*cosd(anglow),-sind(30)*cosd(anglow),sind(anglow));
171 vechor:=rayout*(sind(30),cosd(30),0);
172 vecver:=rayout*(-cosd(30)*sind(anglow),sind(30)*sind(anglow),cosd(anglow));
173 drawoptions( withcolor yelb );
174 whatisthis(cenpos,vechor,vecver,lidist,lifactor);
175 cenpos:=distra*(0,cosd(anglow),sind(anglow));
176 vechor:=rayout*(-1,0,0);
177 vecver:=rayout*(0,-sind(anglow),cosd(anglow));
178 whatisthis(cenpos,vechor,vecver,lidist,lifactor);
179 drawoptions();
180 produce_auto_scale;
181 endfig;
182
183 end.