23.10.2014 Views

mfpic-doc.pdf.

mfpic-doc.pdf.

mfpic-doc.pdf.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.10 AFFINE TRANSFORMS. 57<br />

\store{pth}\lclosed\reverse\curve{(0,0),(1,0),(1,1)}<br />

In fact, \store is a prefix macro that does nothing to the following curve except store it. It acts<br />

as a rendering macro with a null rendering, so the curve is not made visible unless other rendering<br />

macros appear before or after it. It allows the following path to be an argument, that is, enclosed<br />

in braces. This is solely to support files written for past MFPIC versions in which \store was not<br />

defined as a prefix macro.<br />

One use of \store is to create a shorthand for a path that is otherwise long and tedious to type.<br />

Another is to create ‘symbols’ or ‘arrowheads’ for use in \plotsymbol, \arrowhead and related<br />

commands.<br />

\mfobj{〈path expression〉}<br />

\mpobj{〈path expression〉}<br />

This figure macro produces the path represented by 〈path expression〉, which is either a path<br />

variable in which a path was previously stored, or a valid METAFONT expression combining such<br />

variables and constant paths. This allows the use of path variables or expressions as figure macros,<br />

permitting all prefix operations, etc.. Here are some examples of the use of \store and \mfobj.<br />

\store{my_f}{\cyclic{...}}<br />

% Store a closed curve.<br />

\dotted\mfobj{my_f}<br />

% Now draw it dotted,<br />

\hatch\mfobj{my_f}<br />

% and hatch its interior<br />

% Create two symbols<br />

% one outline:<br />

\store{MyTriang}{\polyline{(-.5,-.5),(.5,-.5),(0,.5),(-.5,-.5)}<br />

% one solid:<br />

\store{MySolidTriang}\polygon{(-.5,-.5),(.5,-.5),(0,.5)}<br />

% Use them as symbols:<br />

\plotsymbols{MyTriang}{(0,0),(2,2)}<br />

\arrowmid{MySolidTriang}\polyline{(1,1),(0,2)}<br />

Note: If a stored path has the same starting point as ending point, but is not closed then it will<br />

behave like Circle (for example) when used in \plotsymbol: only its outline is drawn, and its interior<br />

is erased when clearsymbols is in effect. If a closed path is stored, it behaves like SolidCircle:<br />

it is not drawn, but rather filled. If a path is stored that satisfies neither, it behaves like Asterisk,<br />

being simply drawn in all circumstances.<br />

The two forms \mfobj and \mpobj are absolutely equivalent; they differ only in spelling.<br />

It should be noted that every MFPIC figure is implicitly stored in the object curpath. So you<br />

can use \mfobj{curpath} and get the path defined by the most recently completed figure macro<br />

(possibly modified by prefixes).<br />

Getting back to coordinate transforms, if one changes the coordinate system and then stores and<br />

draws a curve, say by<br />

\coords<br />

\rotate{45 deg}<br />

\store{xx}{\rect{(0,0),(1,1)}}<br />

\dashed\mfobj{xx}<br />

\endcoords<br />

one will get a transformed picture, but the object \mfobj{xx} will contain the simple, unrotated<br />

rectangular path and drawing it later (outside the coords environment) will prove that. This is<br />

because the coords environment works at the drawing level, not at the definition level.

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

Saved successfully!

Ooh no, something went wrong!