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

\cbclosed...<br />

\qbclosed...<br />

These are modifying macros that close the following path. The first closes with a cubic B-spline,<br />

the second with a quadratic B-spline. They will close any given curve, but the command \cbclosed<br />

is meant to close a cubic B-spline (see above). That is, \cbclosed\cspline should produce the<br />

same result as \closedcspline with the same argument. The corresponding statements are true of<br />

\qbclosed: it is meant to close a quadratic B-spline and \qbclosed\qspline should produce the<br />

same result as \closedqspline with the same argument.<br />

4.12.2 BÉZIERS<br />

The power user, having noticed that \curve and \cyclic insert some direction modifiers into the<br />

path created, may have decided that there is no MFPIC command to create a simple METAFONT<br />

default style path, for example (1,1)..(0,1)..(0,0)..cycle. If so, he or she has forgotten about<br />

\mfobj: the command<br />

\mfobj{(1,1)..(0,1)..(0,0)..cycle}<br />

will produce, in the .mf file, exactly this path, but surround it with the TEX wrapping needed to<br />

make MFPIC’s prefix macro system work. However, the syntax of more complicated paths can be<br />

extremely lengthy, so we offer this interface:<br />

\mfbezier[〈tens〉]{〈list〉}<br />

\closedmfbezier[〈tens〉]{〈list〉}<br />

These figure macros uses the METAFONT path join operator ‘..tension 〈tens〉..’ to connect<br />

the points in the list. If the tension option [〈tens〉] is omitted, the value set by \settension (initially<br />

1) is used. One can get a cyclic path by prepending \bclosed (with matching tension option),<br />

but it will not produce the same result as \closedmfbezier. These are cubic Bézier’s (but you<br />

know that if you are a power user). Quadratic Béziers (as in LATEX’s picture environment) can be<br />

obtained with the following:<br />

\qbeziers{〈list〉}<br />

\closedqbeziers{〈list〉}<br />

These figure macros produce quadratic Bézier curves, the equivalent of a sequence of LATEX<br />

\qbezier commands. Note the plural forms, to distinguish the first from the LATEX command, and<br />

to indicate that they can draw a series of quadratic Béziers.<br />

In the 〈list〉, the first, third, fifth, etc., are the points to connect, while the second, fourth, etc., are<br />

the control points. The open version requires an ending point, and so needs an odd number of points<br />

in the list. The closed version assumes the first point is the ending, and so requires an even number<br />

in the list. If the number of ponts is wrong, no error is produced: the last point is simply repeated to<br />

get the required number.<br />

The curve will not automatically be smooth; that depends on the choice of the control points.<br />

\cbeziers{〈list〉}<br />

\closedcbeziers{〈list〉}<br />

These figure macros produce a series of cubic Bézier curves. In the 〈list〉, the first, fourth, seventh,<br />

etc., are the points to connect, while the second and third, fifth and sixth, etc., are pairs of<br />

control points. The closed version uses the starting point as the ending point, and so needs a number<br />

of points divisible by 3 (n = 3k). The open version requires an explicitly given ending node (so<br />

n = 3k + 1). If the number of ponts is wrong, no error is produced: the last point or last two points<br />

are simply repeated to get the required number.

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

Saved successfully!

Ooh no, something went wrong!