29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

14<br />

A zscaled specification takes a vector as argument:<br />

p zscaled (2,.5)<br />

The result looks like a combination of scaling and rotation, and conforms to the formula in the<br />

previous table.<br />

Transformations can be defined in terms of a transform matrix. Such a matrix is stored in a transform<br />

variable. For example:<br />

transform t ; t := identity scaled 2cm shifted (4cm,1cm) ;<br />

We use the associated keyword transformed to apply this matrix to a path or picture.<br />

p transformed t<br />

In this example we've taken the identity matrix as starting point but you can use any predefined<br />

transformation. The identity matrix is defined in such a way that it scales by a factor of one in both<br />

directions and shifts over the zero--vector.<br />

Transform variables can save quite some typing and may help you to force consistency when many<br />

similar transformations are to be done. Instead of changing the scaling, shifting and other transformations<br />

you can then stick to just changing the one transform variable.<br />

1.3 Constructing paths<br />

In most cases, a path will have more points than the few shown here. Take for instance a so called<br />

super ellipse.<br />

4<br />

3<br />

5<br />

These graphics provide a lot of information. In this picture the crosshair in the center is the origin<br />

and the dashed rectangle is the bounding box of the super ellipse. The bounding box specifies the<br />

position of the graphic in relation to the origin as well as its width and height.<br />

In the graphic on the right, you can see the points that make up the closed path as well as the<br />

control points. Each point has a number with the first point numbered zero. Because the path is<br />

closed, the first and last point coincide.<br />

We've used the commands .. and -- as path connecting directives. In the next series of examples,<br />

we will demonstrate a few more. However, before doing that, we define a few points, using the<br />

predefined z variables.<br />

Welcome to MetaPost Constructing paths<br />

2<br />

6<br />

0<br />

1<br />

7<br />

8

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

Saved successfully!

Ooh no, something went wrong!