(Adapted from an article published in the IBM Technical Disclosure Bulletin, Vol. 40 No. 03 (March, 1997), pages 235-237.)

## Auto-generating Fractal Movie

Timothy D. Greer

Disclosed is a method for generating a looping animation resulting in the appearance of continuous magnification (or de-magnification) of a fractal. The method generates an animation based on a self-similarity relation intrinsic to the fractal itself and therefore avoids the need for special calculation and planning on the part of the user.

The method creates a looping series of N digital images which, shown in sequence, display the effect of flying ever deeper into a fractal, specifically a fractal from the class representable by iterated function systems. The exposition that follows assumes that the fractal is defined as an iterated function system, that the range of the fractal is two-dimensional, and that the particular function the user chooses to scale with is an affine mapping. However, relaxing these assumptions -- to scale three-dimensional fractals, for example -- is generally straightforward, and the method described, suitably augmented, is still useful. A requirement which cannot be relaxed, however, is that the particular scaling function chosen must be invertible.

Start with an iterated function system fractal defined with the J mappings

f , f , ... f 1 2 J Select one of these mappings, say the ith mapping, to use for scaling. As stated above, the mapping selected must be invertible. By the (fractal) properties of iterated function systems, the image of the entire fractal is contained in the range of f , and likewise in the i 2 range of f (the composition of f with itself). These images of the i i 2 fractal are distorted according to the functions f and f . i i The desired series of images is obtained by transforming the range of 2 f into that of f in a series of smooth steps, and mapping these i i regions into the desired display window to produce the actual pictures.

Define a display window (e.g. (100,100) x (144,144) for a 45x45 pixel window) and scale the fractal to it. This scaling can be done automatically as described in [1]. The re-scaled fractal is now defined by J mappings g , each corresponding j to an original mapping f . j

Re-scale to fit just the range of the ith mapping in the window by using the inverse of the ith mapping (of the scaled-to-the-window fractal) as the new scaling factor, as described in [2]. That is, for each mapping g of the window-scaled fractal, re-scale to get j a fractal defined by the J mappings -1 h = g g g , where g is the window-scaled version of the original j i j i i -2 chosen mapping f . Alternatively, one may wish to re-scale with g or i i even higher powers in order to ensure that no extraneous points from other mappings protrude into the display window. The portion of the re-scaled fractal which is in the window is the first frame in the movie.

Create the N-1 additional frames by determining N-1 additional re-scalings, using equally-spaced steps to transform the unit vectors in each of the coordinate directions into their images under the ith mapping, (x) [a b](x) (e) g ( ) = [ ]( ) + ( ) i (y) [c d](y) (f) This is done as follows. Using the variables a-f as defined in the matrix representation above, define 2 2 2 2 r = sqrt(a + c ) R = sqrt(b + d ) t = arctan(c/a) T = arctan(d/b) - pi/2 where sqrt() is the square root function, arctan() is the arctangent function, and pi is the mathematical constant 3.14159.... The jth mapping of the fractal for the (n+1)th frame of the movie is then -1 l = k h k j n j n where h is as defined earlier, and k is the affine mapping whose j n matrix part takes (working now in polar coordinates) the point (1, 0) to the point (1 - n(1-r)/N, nt/N), and the point (1, pi/2) to the point (1 - n(1-R)/N, nT/N + pi/2), and choosing the scalar part of k so that k has the same fixed point n n as g . i

If N is even and the chosen transformation f includes a reflection, i then the formulas above lead to a non-invertible transformation k n when n=N/2. This difficulty can be circumvented by replacing n=N/2 with e+N/2, where e is a small number between 0 and 1/N.

- At this point, for each of the N frames intended for the movie, there is an iterated function system fractal defined with J mappings. Display the portion of each fractal within the defined window; this is the corresponding frame for the movie. This movie gives the impression of continuous de-magnification. For magnification instead, reverse the frame sequence.

Because the function f used as the basis of the re-scalings is one of i the original fractal's mappings, the frame sequence generated will align with itself end-to-end. So if the sequence were continued, the N+1st frame would be the same as the 1st frame, N+2 would be the same as 2, and so on. Thus the sequence can be shown repetitively and still appear to flow smoothly. However, while the above procedure assures smooth alignment between frames N and 1, two other sources of jerky appearance need to be considered. One is the appearance in the window of parts of the fractal not in the range of the function f . As these i parts may appear in the Nth frame but not in the 1st frame, their sudden disappearance (or appearance, if the movie is shown backward) is jarring. This problem usually can be eliminated -1 by using higher powers of g in step two above, but if the range i of f overlaps with the range of some other mapping of the original i fractal, the result may be unacceptable. The resulting sequence will align properly, but the outline of the desired fractal may be lost among -1 points from its image under the mapping f , the inverse mapping. iClever use of color can circumvent this problem and even turn it to advantage. Poor use of color is the second potential source of jerkiness. This disclosure covers only the procedure for producing frames with proper alignment, and will not address color.

### References

- Greer, Timothy D. "Method for Scaling Fractal for Display by Finding Upper Bound on Extent", IBM Technical Disclosure Bulletin, Vol. 36 No. 6A (June 1993), pp. 489-491.
- Greer, Timothy D. "Method for Finding Geometrically Similar Fractal Confined to Fixed Region", IBM Technical Disclosure Bulletin Volume 34, No. 7B (December 1991), pp. 24-25.

*Note:*I have published an improvement to the above algorithm.

**The information provided, and views expressed on this site are my own and do not represent the IBM Corporation.**