以下宏仅在第一次调用时绘制一个黑色圆圈。其余三个圆圈未填充。我哪里做错了?
def big(expr z) =
begingroup
save a;
path a;
a = fullcircle scaled 3mm;
fill a withcolor black;
draw a shifted z;
endgroup
enddef;
beginfig(1)
big(origin); %black circle drawn
big((1cm,0)); % unfilled circle
big((2.5cm,0)); % unfilled circle
big((3cm,0)); % unfilled circle
endfig;
end;
答案1
第一个命令
fill a withcolor black;
绘制一个以原点为中心的实心圆。第二个命令
draw a shifted z;
绘制移动了 的圆z
。您想要的是也移动实心圆:
fill a shifted z withcolor black;
draw a shifted z;
或者更简单地说:
def big(expr z) =
begingroup
save a; path a;
a = fullcircle shifted z scaled 3mm;
fill a withcolor black;
draw a;
endgroup
enddef;