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.

2<br />

0<br />

1<br />

Using ( ) is not mandatory but makes the expression look less complicated.<br />

0<br />

"z0..z1..cycle"<br />

"(z0..z1..cycle) cutafter directionpoint (1,1) of (z0..z1..cycle)"<br />

1<br />

We will apply these commands in the next chapters, but first we will finish our introduction in<br />

METAPOST. We have seen how a path is constructed and what can be done with it. Now it is time<br />

to demonstrate how such a path is turned into a graphic.<br />

1.4 Angles<br />

You can go from angles to vectors and vice versa using the angle and dir functions. The next<br />

example show both in action.<br />

pickup pencircle scaled 2mm ;<br />

draw (origin -- dir(45) -- dir(0) -- cycle)<br />

scaled 3cm withcolor .625red ;<br />

draw (origin -- dir(angle(1,1)) -- dir(angle(1,0)) -- cycle)<br />

scaled 3cm shifted (3.5cm,0) withcolor .625yellow ;<br />

draw (origin -- (1,1) -- (1,0) -- cycle)<br />

scaled 3cm shifted (7cm,0) withcolor .625white ;<br />

Angles Welcome to MetaPost<br />

23

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

Saved successfully!

Ooh no, something went wrong!