答案1
下面是一个示例,展示了如何picture
按照@egreg 的建议使用变量:
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
z1 = -z5 = 70 right;
z3 = 70 up;
z2 = whatever[z1,z3]; z2 = whatever * (z3-z1) rotated 90;
z4 = whatever[z3,z5]; z4 = whatever * (z5-z3) rotated 90;
picture truss;
truss = image(
draw z1--z3--z5--cycle;
draw origin -- z2;
draw origin -- z3;
draw origin -- z4;
);
draw truss slanted .4 shifted 84 up dashed withdots scaled 1/2 withcolor red;
draw truss dashed dashpattern(on 4 off 2 on 1/2 off 2);
endfig;
end.