Anyway, I decided I should try to make a “tree generating algorithm.” The usual gdk line drawing suspects were a bit too weak for this, so I started looking into cairo, and ended up writing a little GTK + cairo app that generated the image you see above.
Here’s how the app works: I created this notion of “cells.” Each cell is a square, which has a position (x, y coordinate), direction (angle) size, “turning,” and age. In the beginning of the program, there are just three cells, with size = 1, direction = up, (in radians), age = 0. With each iteration of the simulation, I scan each cell. Thee is some probability that each cell will spawn a new cell, with some limits based on the cells age (cells too young, or too old can’t make new cells.) The new cells inherit the parent cell’s direction with some small modification, partly random, partly the parent’s “turning.” The coloration is based on the cells age, so younger cells are lighter and older cells are darker. As cells age, they become bigger, to some limit.
That’s pretty much the whole algorithm, and that alone is enough to generate a picture like you see above.
This is my favorite kind of programming project. Small enough to do in one night, but big enough to get some really cool looking output. Damn computers are so fucking cool sometimes. This is one of those times.