|
|
下面的 macro dcircle 我希望当它的第二个参数为 1 时画一个带叉的圆,否则只画一个圆。圆的位置在 P。这段代码编译不过去,请问哪里错了?谢谢。
- def dcircle(expr P, del) =
- fill fullcircle scaled 7bp shifted P withcolor white;
- draw fullcircle scaled 7bp shifted P
- if del>0 :
- begingroup
- save x, y;
- x := xpart P;
- y := ypart P;
- draw (x + 7bp, y + 7bp)--(x - 7bp, y - 7bp)
- draw (x - 7bp, y + 7bp)--(x + 7bp, y - 7bp)
- endgroup
- fi;
- enddef;
- beginfig(1)
- pair A;
- A:=(0,0);
- dcircle(A, 1);
- endfig;
- beginfig(2)
- pair A,B;
- A:=(0,0);
- B:=(-0.65cm,-1cm);
- draw A--B;
- dcircle(A, 0);
- dcircle(B, 0);
- endfig;
- end;
复制代码 |
|