Making Fractals with MetaPost

Sierpinski's Sieve rendered with MetaPost I’ve played a lot with MetaPost today — I’ve been making fractals. It’s a lot of fun to make graphics with MetaPost, and making the fractals was no exception.

I’ve made three kinds of fractals: Koch Curves, Hilbert Curves and finally the one shown at the right, Sierpinski’s Sieve. The last one is also know as Sierpinski’s Triangle, for obvious reasons.

You can download the sourcecode and a document here: /downloads/metafractals/. If you’re trying to remake the document, then please note that the images are called filenameN.mps instead of just filename.N. This is because PDFLaTeX works best with those filenames. So you’ll have to rename the files generated by MetaPost before running LaTeX/PDFLaTeX. If you’re running Zsh, then you could use this very little shell-script:

#!/bin/zsh
for basename in $*; do
    mpost $basename
    for file in ${basename%.mp}.<0->; do
        mv $file ${file/./}.mps
    done
done

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI (optional)
Your Comment (smaller size | larger size)

Formatted using Markdown: use blank lines to separate paragraphs, * for emphasis, and backticks (`) around code.

(Googlebot visited this page Sunday, December 18, 2005)