
Escribí este código para representar esquemáticamente el concepto de energía potencial química. Esta imagen será parte de un diagrama representativo de las transformaciones de energía en una celda voltaica: energía potencial química -> energía eléctrica (= trabajo eléctrico) (transductor: Lámpara) -> energía radiante -> energía interna. Pido ayuda para dos tareas: 1) agregar transparencia y mejorar la representación del tubo de ensayo, 2) mejorar la representación de la zanahoria (si es posible). Gracias de antemano.
\starttext
\startMPpage
picture tube, base, carrot;
path p;
pair t;
numeric xx, y;
color carrotcolor, aquaU, aquaD, tubecolor;
carrotcolor :=(235/255, 137/255, 33/255);
aquaU := (2/255, 132/255, 130/255);
aquaD := (122/255, 186/255, 122/255);
tubecolor :=(183/255, 110/255, 184/255);
%draw the essay tube
draw origin--origin shifted (3cm,0cm) withpen pencircle scaled 1cm withcolor tubecolor;
draw origin--origin shifted (3cm,0cm) withpen pencircle scaled .8cm withcolor white;
fill fullcircle shifted (-0.01cm,0) xscaled .6cm yscaled .9cm withpen pencircle scaled .1cm withcolor white;
draw fullcircle shifted (-.010cm,0) xscaled .61cm yscaled .9cm withpen pencircle scaled .1cm withcolor tubecolor;
tube := currentpicture scaled .4;currentpicture:=nullpicture;
%draw the rectangle base
linejoin := mitered; linecap := butt;
fill (0,0)--(0,2cm)--(3cm,2cm)--(3cm,0)--cycle withcolor aquaD;
draw (0,0)--(0,2cm)--(3cm,2cm)--(3cm,0)--cycle withpen pencircle scaled 1mm withcolor aquaU;
base:=currentpicture; currentpicture:=nullpicture;
% draw the carrot tubercle
p:= origin..(-.1cm,.15cm)..(-.1cm,2.15cm)..(0,2.15cm)..(.1cm,2.15cm)..(.1cm,.15cm)..cycle;
drawfill p withcolor transparent(1,.5,carrotcolor);
draw p ;
% draw the green leaves
linejoin :=mitered; linecap:=rounded;
for i=2 step .1 until 4:
t:= point i of p;
xx:=uniformdeviate( 1 )*1cm + xpart(t)-uniformdeviate( 1 )*1cm;
y:=uniformdeviate( 1.5 )*1cm + ypart(t);
draw t..(xx,y) withpen pencircle scaled 1.mm withcolor green;
endfor;
carrot := currentpicture scaled .45; currentpicture:=nullpicture;
%include all drawings
draw base;
draw tube rotated -135 shifted (2cm,1.5cm) ;
draw carrot rotated 45 shifted (2cm,.5cm) ;
\stopMPpage
\stoptext