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.12 FOR ADVANCED USERS. 69<br />

METAFONT has no general command for calculating the lengths of paths; METAPOST does, but it is<br />

quite slow. Thus neither program has an efficient method for finding the described point, so MFPIC<br />

uses METAFONT/METAPOST macros that are faster, but less accurate than they could be. Still, the<br />

results should (except in pathological cases) be accurate to within a couple of percent of the length<br />

of the path. If they are not, adjust the value of the fraction. These remarks about accuracy also hold<br />

for any other command (such as \partpath in subsection 4.4.2) that take the fraction of a path<br />

length as a parameter.<br />

The pathpoint command is not a basic METAFONT command, but is defined by the GRAFBASE<br />

macros that accompany MFPIC.<br />

METAFONT pairs can conveniently be viewed as complex numbers. So grafbase also contains<br />

some functions useful in complex analysis (my research field). In what follows a, z and w denote<br />

pair variables or constants, and each function interprets them as complex numbers. Also t denotes<br />

an angle in radians. There are both numeric and pair valued functions, the type of each is noted after<br />

the description:<br />

Arg z The principle argument of z in radians (numeric).<br />

Log z The principle logarithm of z (pair).<br />

cis t (cost,sint), same as dir degrees(t) (pair).<br />

zexp w The complex exponential, e w (pair).<br />

zsqrt w The (principal) complex square root: that z with −π/2 ≤ Argz ≤ π/2 and<br />

z 2 = w (pair).<br />

sgn z The signum, sgn(0,0) = (0,0) otherwise sgnz = z/|z| (pair).<br />

conj z The complex conjugate, ¯z (pair).<br />

Moebius(a) z The Möbius transformation (z + a)/(1 + āz) (pair)<br />

pshdist(z,w) The pseudohyperbolic distance between z and w: |z−w|/|1− ¯wz| (numeric).<br />

kelvin(z) The Kelvin transform 1/¯z (pair)<br />

METAFONT will happily add and subtract pairs but to multiply and divide complex numbers<br />

requires new operations. These are given by (z zmul w) and (z zdiv w). They operate on pairs<br />

and produce pairs.<br />

4.12.6 MANIPULATING METAFONT PICTURE VARIABLES<br />

\tile{〈tilename〉,〈unit〉,〈wd〉,〈ht〉,〈clip〉}<br />

〈MFPIC drawing commands〉<br />

\endtile<br />

In this environment, all drawing commands contribute to a tile. A tile is a rectangular picture<br />

which may be used to fill the interior of closed paths. Actually, a tile is a composite object. After<br />

\tile{Nick, ... } ... \endtile a picture variable Nick.pic is created as well as numeric<br />

variable Nick.wd and Nick.ht. These are needed by the \tess command, below.<br />

The units of drawing are given by 〈unit〉, which should be an explicit dimension (like 1pt or<br />

.2in). The tile’s horizontal dimensions are 0 to 〈wd〉 · 〈unit〉 and its vertical dimensions 0 to 〈ht〉 ·<br />

〈unit〉, so 〈wd〉 and 〈ht〉 should be pure numbers. If 〈clip〉 is true then the drawing is clipped to be<br />

within the tile’s boundary.<br />

By using this macro, you can design your own fill patterns (to use them, see the \tess macro<br />

below), but see the warning about memory use by the \tess command. The 〈tilename〉 is globally<br />

defined by this command.<br />

\tess{〈tilename〉}...<br />

This rendering macro tiles the interior of a closed path with a tessellation comprised of copies of<br />

the tile specified by 〈tilename〉. The tile must have been previously created by \tile{〈tilename〉,

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

Saved successfully!

Ooh no, something went wrong!