
このコードは、化学ポテンシャル エネルギーの概念を図式的に表すために作成しました。この画像は、電池内のエネルギー変換の代表的な図の一部になります。化学ポテンシャル エネルギー -> 電気エネルギー (= 電気仕事) (トランスデューサー: ランプ) -> 放射エネルギー -> 内部エネルギー。次の 2 つのタスクについてご協力をお願いします。1) 試験管の透明度を追加して表現を改善する、2) ニンジンの表現を改善する (可能な場合)。よろしくお願いします。
\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