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.4 MODIFYING THE FIGURES. 32<br />

\partpath{〈frac1〉,〈frac2〉}. . .<br />

\subpath{〈num1〉,〈num2〉}. . .<br />

\trimpath{〈dim 1 〉,〈dim 2 〉}. . .<br />

\trimpath{〈dim〉}. . .<br />

These macros modify the following path by producing only a part of it. In \partpath the parameters<br />

〈frac1〉 and 〈frac2〉 should be numbers between 0 and 1. The path produced travels the<br />

same course as the path that follows, but starts at the point that is the fraction 〈frac1〉 of the original<br />

length along it, and ends at the point 〈frac2〉 of its original length. If 〈frac1〉 is greater than 〈frac2〉,<br />

the sense of the path is reversed. In \subpath, the two numbers should be between 0 and the number<br />

of Bézier segments in the path. This is mainly for experienced METAFONTers and provides an<br />

MFPIC interface to METAFONT’s ‘subpath’ operation.<br />

The \trimpath macro takes two dimensions separated by commas and trims those lengths off<br />

the initial and terminal ends of the following path. Alternatively, it takes one dimension and and<br />

trims that length off of both ends. If any of 〈dim 1 〉, 〈dim 2 〉 or 〈dim〉 is missing, it is taken to be 0pt.<br />

This works by finding the points of intersection between the path and circles around the endpoints<br />

with the given dimensions as radii. If the path is shorter than either dimension, it will not intersect<br />

either circle and nothing will be trimmed. Similar problems can occur, at one end or the other, if the<br />

path is shorter than the sum of the dimensions.<br />

\parallelpath{〈dist〉}...<br />

This modifying macro takes the following path and returns a path that follows beside it, keeping<br />

a fixed distance 〈dist〉 to the left. If 〈dist〉 is negative, it keeps to the right. Left or right is from the<br />

point of view of a traveller following the given path from start to finish. The distance is a pure number<br />

in graph coordinates. Note: this should be compared to the first optional argument of \doubledraw<br />

(see subsection 4.5.1), which requires an absolute dimension like 2pt, even though it is implemented<br />

using the internal code of \parallelpath.<br />

The calculation of the parallel path is approximate and rather inefficient. It is likely to produce<br />

inexplicable small loops where it tries to follow the inside of tight turns (radius less than 〈dist〉).<br />

Actual corners, (which might be thought of as turns of radius 0) are usually detected and dealt with<br />

in a reasonable manner. However, if the path is made up of segments of length 〈dist〉 or less, this is<br />

unlikely to work correctly at all.<br />

\arccomplement. . .<br />

This macro, to work properly, must be followed by an arc of a circle. It produces the complementary<br />

arc. That is, it produces the circular arc, which would, if appended to the following arc,<br />

complete the circle. The complementary arc will have the same direction, clockwise or anticlockwise,<br />

as the original. The arc that follows doesn’t have to be produced by \arc, as in the following<br />

example:<br />

\draw[blue]\arccomplement<br />

\draw[red]\partpath{0,.333}<br />

\circle{(0,0),1}<br />

This will draw 1/3 of this circle in red and the rest of it in blue.<br />

METAFONT cannot check if a path is really a circular arc. The METAFONT code, like that of<br />

\makesector (see subsection 4.4.1), selects three key points on the arc, then it produces the rest<br />

of the circle much the same way as the internal code of \arc[t] (the three point option for \arc).<br />

Thus, it will produce some arc from the end of any following path to its beginning (or a straight<br />

line if the three chosen points happen to lie in a straight line). However, the result needn’t bear any<br />

significant relation to the original path.

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

Saved successfully!

Ooh no, something went wrong!