29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

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.

60<br />

1.19 Cutting and pasting<br />

When enhancing or building a graphic, often parts of already constructed paths are needed. The<br />

subpath, cutbefore and cutafter operators can be used to split paths in smaller pieces. In order<br />

to do so, we must know where we are on the path that is involved. For this we use points on the<br />

path. Unfortunately we can only use these points when we know where they are located. In this<br />

section we will combine some techniques discussed in previous sections. We will define a few<br />

macros, manipulate some paths and draw curves and points.<br />

4<br />

3<br />

5<br />

This circle is drawn by scaling the predefined path fullcircle. This path is constructed using<br />

8 points. As you can see, these points are not distributed equally along the path. In the following<br />

graphic, the second and third point of the curve are colored red, and point 2.5 is colored yellow.<br />

Point 0 is marked in black. This point is positioned halfway between point 2 and 3.<br />

It is clear that, unless you know exactly how the path is constructed, other methods should be<br />

available. A specific point on a path is accessed by point ... of, but the next example demonstrates<br />

two more alternatives.<br />

path p ; p := fullcircle scaled 3cm xscaled 2 ;<br />

pickup pencircle scaled 5mm ;<br />

draw p withcolor .625white ;<br />

draw point 3 of p withcolor .625red ;<br />

draw point .6 along p withcolor .625yellow ;<br />

draw point 3cm on p ;<br />

Welcome to MetaPost Cutting and pasting<br />

2<br />

6<br />

1<br />

7<br />

0<br />

8

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

Saved successfully!

Ooh no, something went wrong!