
Ich habe diesen Code geschrieben, um das Konzept der chemischen potentiellen Energie schematisch darzustellen. Dieses Bild wird Teil eines repräsentativen Diagramms der Energieumwandlung in einer Voltazelle sein: chemische potentielle Energie -> elektrische Energie (= elektrische Arbeit) (Wandler: Lampe) -> Strahlungsenergie -> innere Energie. Ich bitte um Hilfe bei zwei Aufgaben: 1) Transparenz hinzufügen und die Darstellung des Reagenzglases verbessern, 2) die Darstellung der Karotte verbessern (falls möglich). Vielen Dank im Voraus.
\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