3

With a valid figure, I would like to always produce the mirror figure. To clarify my thought, I'm looking for some tricks to do something like:

beginfig(1);
  ...
endfig;

beginfig(2);
  mirror(fig1);
endfig;

Is such a thing possible ?

5
picture keep;
beginfig(1);

... Metapost code ...

keep:=currentpicture;
endfig;

beginfig(2);
z1=.5[llcorner keep,lrcorner keep];
z2=.5[ulcorner keep,urcorner keep];
currentpicture:=keep reflectedabout (z1,z2);
endfig;
end

Before shipping out the first figure, we keep it into a picture variable. The operators llcorner and so on allow access at the bounding box of a picture.

A similar trick is used in manfnt.mf to draw the mirror image of the dangerous bend symbol (see the definitions of characters 127 and 126).

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.