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.

52<br />

The smoothed operation is a less subtle one, since it operates on the bounding box and thereby can<br />

result in a different shape.<br />

path p ; p := ((1,0)--(2,0)--(2,2)--cycle) xysized (4cm,2cm) ;<br />

drawpath p ; drawpoints p ;<br />

p := (p shifted (5cm,0)) smoothed .5cm ;<br />

drawpath p ; drawpoints p ;<br />

The next one, simplified, can be applied to paths that are constructed automatically. Instead of<br />

testing for duplicate points during construction, you can clean up the path afterwards.<br />

path p ; p :=<br />

((0,0)--(1,0)--(2,0)--(2,1)--(2,2)--(1,2)--(0,2)--(0,1)--cycle)<br />

xysized (4cm,2cm) ;<br />

drawpath p ; drawpoints p ;<br />

p := simplified (p shifted (5cm,0)) ;<br />

drawpath p ; drawpoints p ;<br />

A cousin of the previous operation is unspiked. This one removes ugly left overs. It works well<br />

for the average case.<br />

path p ; p :=<br />

((0,0)--(2,0)--(3,1)--(2,0)--(2,2)--(1,2)--(1,3)--(1,2)--(0,1)--cycle)<br />

xysized (4cm,2cm) ;<br />

drawpath p ; drawpoints p ;<br />

p := unspiked (p shifted (5cm,0)) ;<br />

drawpath p ; drawpoints p ;<br />

There are a couple of operations that manipulate the path in more drastic ways. Take randomized.<br />

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

drawpath p ; drawpoints p ;<br />

Welcome to MetaPost Some extensions

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

Saved successfully!

Ooh no, something went wrong!