This project took far longer than half an hour, but it's pretty cool. While doodling in Bio, I thought of a way to programmatically draw any recursively-defined shape. By this, I mean any shape that contains a scaled-down version of the entire shape. This is a property found in many fractals.
Traditionally, and in all of the fractal-drawing software of this type I've seen, the shapes are defined with turtle-style commands (turn right, draw a line, turn left, and so on). There exists a specific system called L-System that can define recursive pictures, and with a lot of work can probably define everything my program can, with the exception of curves. However, when looking at the shape, I do not always find the long list of turtle instructions or L-System rules to be intuitive. I decided to instead use traditional Euclidean x and y coordinates, and Python code as the rule defining the next iteration. This way, I can sketch out a shape on a piece of paper and enter its code very quickly and clearly. It is much easier to me to enter a shape in terms of x and y.
I had an idea for drawing curved lines that turned out very well. The code actually draws an arc of a circle, but positioned so that the arc passes through the two points. A parameter specifies how much curvature should be given.
Looking at the still images is only half of it: I added an easy way to draw animations! There are a lot of really cool animations defined in the samples. (Play them by removing the # and pressing draw.)
Here is the code (71k). (Requires Python 2.5, cross-platform). All you need to do is unzip the file, open main.py, load a shape from the shapes menu and start playing with it! The argument to the .draw() method is the number of iterations (don't make this too big). You are encouraged to tweak the code or create your own shapes.
I wrote this just for fun, and it's (unfortunately) not connected with anything I'm doing at school.
Planned for the next version:
Drawing images, ellipses, text. Save images as PNG files, anti-alias option. Making variable names consistent... and a revolutionary improvement that is still in the works.