Saturday, April 11, 2009

Making Trees

I've been making trees this morning.

Some years ago, I bought an intriguing book: The Algorithmic Beauty of Plants, by Prusinkiewicz and Lindenmayer. I occasionally pick it up and read pieces, and always find it fascinating. The book does a great job describing the concept of L-systems, named for the second author, in which a few very simple rules can generate incredibly complex patterns. Studying how plants grow, the authors realized that the rules governing plant growth can be approximated with algorithms, producing very realistic-looking results.

I recently came across a piece of software that reminded me of the book, and led me back to re-examine it. Context Free Art allows you to write little recursive programs that output graphics, suitable for implementing some of the algorithms described in the book. (You can make all sorts of amazingly beautiful things with Context Free, plant-like things being but one example.)

There turn out to be several other programs that try to render L-systems and their kin. I found a few of them still lurking around on the web, but the Unix versions are old enough that getting them to compile on my Mac looks to be a chore and a half; I found a Java applet that is buggy, but works for the most part and I can still compile it. I'd most like to play with fractint -- I remember it fondly from the DOS days, and it turns out that someone put L-system interpretation into it -- but the last port to the Mac was for OS 9. I may have to revisit this, and see if I can get it to run under DOSBox... If so, I'll post the outcome here.