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.

94<br />

This rectangle is a scaled instance of the predefined METAFUN path fullsquare which is centered<br />

around the origin.<br />

pickup pencircle scaled 2mm ;<br />

path p ; p := fullsquare scaled 2cm ;<br />

draw p withcolor .625white ;<br />

On this path, halfway between two of its corners, we define a point q:<br />

pair q ; q := .5[llcorner p, lrcorner p] ;<br />

We draw this point in red, using:<br />

draw q withcolor .625red ;<br />

As you can see, this point is drawn on top of the path.<br />

There are four of those midpoints, and when we connect them, we get:<br />

Because path p is centered around the origin, we can simply rotate point q a few times.<br />

draw q -- q rotated 90 -- q rotated 180 -q<br />

rotated 270 -- cycle withcolor .625red ;<br />

There are situations, where you don't want the red path to be drawn inside another path, or more<br />

general: where you want points to touch instead of being overlayed.<br />

A few more details Only this far

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

Saved successfully!

Ooh no, something went wrong!