23.10.2014 Views

mfpic-doc.pdf.

mfpic-doc.pdf.

mfpic-doc.pdf.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.10 AFFINE TRANSFORMS. 58<br />

In oversimplified terms, \dashed invokes the transformation, but not \store. More precisely,<br />

the rendering macros have the side effect of adding ink to the page (or subtracting it). To know where<br />

to place this ink, a calculation is performed that translates graph coordinates to actual positions. The<br />

above transforms work by modify the parameters used in that calculation. On the other hand, \store<br />

merely stores the output of the immediately following prefix or figure macro. See the beginning of<br />

section 4.4 for a discussion of input, output and side effects of MFPIC prefix and figure macros.<br />

The following transformation prefixes provide a means of actually creating and storing a transformed<br />

path. In the terms just discussed, their input is a path, their output is the transformed path,<br />

and they have no side effects.<br />

\rotatepath{〈p〉,〈θ〉}...<br />

\shiftpath{〈v〉}...<br />

\scalepath{〈p〉,〈s〉}...<br />

\xscalepath{〈x〉,〈s〉}...<br />

\yscalepath{〈y〉,〈s〉}...<br />

\slantpath{〈y〉,〈s〉}...<br />

\xslantpath{〈y〉,〈s〉}...<br />

\yslantpath{〈x〉,〈s〉}...<br />

\reflectpath{〈p 1 〉,〈p 2 〉}...<br />

\xyswappath...<br />

\transformpath{〈transformer〉}...<br />

These are modifying macros that all return the result of applying an affine transformation to<br />

the following path. They differ in the transformation applied and the data needed in the mandatory<br />

argument. I have found them extremely useful, and better than coords environments when I need<br />

to draw a figure, together with several slightly different versions of it. If \store is used just before<br />

one of these prefixes, it stores the transformed path rather than the original.<br />

\rotatepath rotates the following path by 〈θ〉 degrees about point 〈p〉.<br />

\shiftpath shifts the following path by the vector 〈v〉.<br />

\scalepath scales (magnifies or shrinks) the following path by the factor 〈s〉, in such a way<br />

that the point 〈p〉 is kept fixed. That is<br />

\scalepath{(0,0),2}\rect{(0,0),(1,1)}<br />

is essentially the same as \rect{(0,0),(2,2)}, while<br />

\scalepath{(1,1),2}\rect{(0,0),(1,1)}<br />

is the same as \rect{(-1,-1),(1,1)}. In both cases the rectangle is doubled in size. In the first<br />

case the lower left corner stays the same, while in the second case the the upper right corner stays<br />

the same.<br />

\xscalepath is similar to \scalepath, but only the x-direction is scaled, and all points with<br />

first coordinate equal to 〈x〉 remain fixed. \yscalepath is similar, except the y-direction is affected.<br />

\slantpath applies a slant transformation to the following path, keeping points with second<br />

coordinate equal to 〈y〉 fixed. That is, a point p on the path is moved right by an amount proportional<br />

to the height of p above the line y = 〈y〉, with s being the proportionality factor. Points below that line<br />

move left. Vertical lines in the path will acquire a slope of 1/s, while horizontal lines stay horizontal.<br />

\xslantpath is an alias for \slantpath<br />

\yslantpath is similar to \xslantpath, but exchanges the roles of x and y coordinates.<br />

\reflectpath returns the mirror image of the following path, where the line determined by the<br />

points 〈p 1 〉 and 〈p 2 〉 is the mirror.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!