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.2 COMMON OBJECTS. 22<br />

For both options [r] and [q] the angle is computed and then the point-sweep method is used.<br />

If the absolute value of the radius is less than half the distance between the points, then no such arc<br />

exists. In this case, the angle is just set equal to ±180 degrees (as if the radius were changed to half<br />

the distance).<br />

\sector{〈c〉,〈r〉,〈θ 1 〉,〈θ 2 〉}<br />

This figure macro produces the sector of the circle with center at the point 〈c〉 and radius 〈r〉,<br />

from the angle 〈θ 1 〉 to the angle 〈θ 2 〉. Both angles are measured in degrees anticlockwise from the<br />

direction parallel to the x axis. The sector forms a closed path. Note: \sector and \arc[p] have<br />

the same parameters, but in a different order. 12<br />

\ellipse[〈θ〉]{〈c〉,〈r x 〉,〈r y 〉}<br />

This figure macro produces an ellipse with the x radius 〈r x 〉 and y radius 〈r y 〉, centered at the point<br />

〈c〉. The optional parameter 〈θ〉 provides a way of rotating the ellipse by 〈θ〉 degrees anticlockwise<br />

around its center. Ellipses may also be created by differentially scaling a circle and perhaps rotating<br />

the result. See subsection 4.10.2.<br />

\fullellipse{〈C〉,〈M 1 〉,〈M 2 〉}<br />

\halfellipse{〈M 1 〉,〈M 2 〉,〈M 3 〉}<br />

\quarterellipse{〈M 1 〉,〈A〉,〈M 2 〉}<br />

For any parallelogram there is a unique ellipse incribed in it which is tangent to the sides at their<br />

midpoints. The above allows one to obtain that ellipse and parts of it. The input to \fullellipse<br />

is the center 〈C〉 of that parallelogram and the midpoints 〈M 1 〉 and 〈M 2 〉 of two adjacent sides. For<br />

\halfellipse, one supplies the midpoints 〈M 1 〉, 〈M 2 〉, and 〈M 3 〉 of three successive sides. Lastly,<br />

\quarterellipse requires the midpoints of two adjacents sides and the corner 〈A〉 between them.<br />

Internally, a quarter-circle is transformed to produce the quarter-ellipse and the other two are built<br />

up out of two or four such quarter-ellipses.<br />

The reasoning behind my choice of parameters is based on the anticipated use of these commands.<br />

For example, I wanted \quarterellipse to be used to round a corner represented by the<br />

three points M 1 , A and M 2 . In order for the quarter-ellipse to have the same direction at M 1 and M 2<br />

as the polygon M 1 AM 2 , the associated parallelogram has to have midpoints at M 1 and M 2 .<br />

\plr{(〈r 0 〉,〈θ 0 〉),(〈r 1 〉,〈θ 1 〉), ...}<br />

When dealing with arcs and circles, it is useful to work in polar coordinates. The macro \plr<br />

causes METAFONT to replace the specified list of polar coordinate pairs by the equivalent list of<br />

rectangular (cartesian) coordinate pairs. Through \plr, commands designed for rectangular coordinates<br />

can be applied to data represented in polar coordinates. It must be cautioned that this wholesale<br />

conversion of a list applies only to commands that take a list consisting of an arbitrary number of<br />

points, such as \polyline.<br />

The effect of \plr is to apply a METAFONT command, polar, to each point in the list, producing<br />

a new list. This METAFONT command can also be used separately in any situation where a<br />

single METAFONT point is required. For example, to connect the point (2,3) to the point with polar<br />

coordinates (1,135) write<br />

\polyline{(2,3),polar(1,135)}<br />

This last circle-producing macro I wrote for my own use. It produces a circle associated with the<br />

hyperbolic geometry of a disk or a half-plane.<br />

12 This apparently was unintended, but we now have to live with it so as not to break existing .tex files.

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

Saved successfully!

Ooh no, something went wrong!