You should see a big black circle, three smaller black circles, probably some light blue circles, and a fractal in black. Sometimes the picture fills in in stages. Sometimes it looks like Da Vinci's man in the square. I've tried this applet on Firefox 1.5, Explorer 5.2, and Safari 1.3.1, all on Mac OS X 10.3.9. All the browsers run it much slower than AppletViewer does; Firefox is the worst.
The program plugs
expressions for the centers and radii of the transformations of the big circle
into the set of three equations for the smallestcircleenclosingthreecircles.
That produces three quadratic equations that boil down to one, which gets
solved and backsubstituted. When there are two solutions, the program
uses the smaller of the two. The solution for the big circle, run through
the transformations, produces the smaller black circles that enclose what I call
the "parts": the subsets of the fractal corresponding to each of
the transformations.
The idea was to get an easytocalculate, small enough, but not toosmall bounding shape for a fractal, to help place and scale the fractal on a page. (People who have worked with random IFS fractals may understand the kind of guesswork methods I was avoiding.) I think this method does pretty well. You may notice that sometimes the fractal is over to one side of the circle and the circle could be noticeably smaller and still enclose the whole fractal. That's partly because the method insists that the big circle touch all three smaller circles. Sometimes it would seem possible to use a circle that touches only two of the smaller circles, and the third would still be inside. Haven't tried that yet.



The Light Blue CirclesThe light blue circles are "crumbs" of the fractal. When one or more of the transformations has a scale that is large (say, .9), both recursive and "chaotic" methods of drawing IFS fractals have problems with the long tails that large scale factors produce. If the biggest scale factor of any of the transformations is greater than .5, I replace that transformation by the current set of transformations, each through the transformation being replaced. Now instead of n transformations I have 2n  1 transformations that represent an equivalent fractal. I keep doing that until the scale of the largest transformation is less than .5. The blue circles are the big circle through the transformed transformations.
Method for the Fractal DimensionThe fractal dimension of a fractal is roughly its density, from sparse to squiggly to lumpy. The fractal dimension helps set the relative "weight" of each transformation, the fraction of points to draw for that transformation. If you don't get this right, the fractal won't look evenly shaded. Also the fractal dimension helps decide how many points to draw altogether, to give it the rightlooking density.

I've seen some difficultlooking methods of determining the fractal dimension,
so I thought I'd describe this simple one. Say we have three transformations, each with
a scale factor s_{n}. Then this equation
can be solved for the fractal dimension d:
s_{1}^{d} + s_{2}^{d} + s_{3}^{d} = 1 This is just a power law relating the "amount of stuff" in a part of the fractal to the linear scale of that part's transformation. Each s_{n}^{d} is the weight of one part, the fraction of stuff in that part. I calculate d with a binary search.
Source CodeThe source is in davinci.tgz (tar, gzipped). The main file is AffineFractalApplet.java, and there are a lot of small files, one to a class, mostly a library for doing graphics and geometry in a way that works in Java 1.1. In AffineFractalApplet there is also a commentedout section for writing a postscript file that produces the same picture. Enjoy.Steve

