0

If I define a picture, how can I scale the picture by a scale factor? For example, if the scale factor is 5, then the target will be as 5 times as the size of the defined picture. The scale factor could be less than 1. The picture could be complex. It is something like zoom in or zoom out the defined picture. I am sorry I can't give a minimum code.

2

You can do <picture> scaled <numeric>. Taking an example from the Metapost manual:

beginfig(22);
path a, b, aa, ab;
a = fullcircle scaled 2cm;
b = a shifted (0,1cm);
aa = halfcircle scaled 2cm;
ab = buildcycle(aa, b);
picture pa, pb;
pa = thelabel(btex $A$ etex, (0,-.25cm));
pa := pa scaled 2;
pb = thelabel(btex $B$ etex, (0,1.5cm));
fill a withcolor .7white;
fill b withcolor .7white;
fill ab withcolor .4white;
unfill bbox pa;
draw pa;
unfill bbox pb;
draw pb;
label.lft(btex $U$ etex, (-1cm,.5cm));
draw bbox currentpicture;
endfig;
end.

enter image description here

| improve this answer | |
  • My mistake is draw pa scaled 5cm. The scale factor should be 5 for my example. Thank you @ egreg – warem Nov 13 '17 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.