答案1
这是开胃菜元帖子,向您展示一种使用相关子元素来组织绘图的方法。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
picture t[], c;
z0 = origin;
z1 = 55 right rotated -5;
z2 = 60 right rotated 60;
z3 = 65 right rotated 20;
c = image(fill fullcircle scaled 3 withcolor background; draw fullcircle scaled 3;);
t1 = image(draw c shifted z1;);
t2 = image(
draw z1--z2;
draw c shifted z1;
draw c shifted z2;
);
t3 = image(
fill z0--z1--z2--cycle withcolor .9[red,white];
draw z0--z1--z2--cycle;
draw c shifted z0;
draw c shifted z1;
draw c shifted z2;
);
t4 = image(
fill z0--z1--z2--cycle withcolor .9[red,white];
fill z3--z1--z2--cycle withcolor .7[red,white];
draw z0--z3 dashed withdots scaled .3 withcolor .7 white;
draw z0--z1--z2--cycle; draw z1--z3--z2;
draw c shifted z0;
draw c shifted z1;
draw c shifted z2;
draw c shifted z3;
);
for i=1 upto 4:
draw t[i] shifted(80i-80,0);
endfor
endfig;
end.