[Prev][Next][Up]VSFCF - CVM 1.1[Bib][Respond][Find][Help]

Philosophical Considerations and Drawing Algorithms

Trying to represent fractal sets pictorially leads to some philosophical concerns. A (one-dimensional) straight line in the plane has zero thickness; so we would not be able to see a true representation. Thus we depict it with a thickened (two-dimensional) infinite strip and are able to imagine the true line as the center line. A similar approach is applied to other smooth curves in the plane. But fractals are typically far from being smooth -- they may, for example, be self similar at arbitrarily small scale and have no tangent lines anywhere. So a thickened fractal may be very different from the original.

There are additional complications in representing fractal sets graphically. It can be difficult to determine whether a given point is in a fractal set. For example, to determine if a point c is in the classical Mandelbrot set, M, one typically iterates the function f(z)=z2+c many times starting at z=0 (e.g., see [PR, p. 191]). If one gets any |z|>2, then c is not in M. However, we don't know when to expect this process to halt. So usually a threshold number is set and if all z up to that number of iterations have magnitude less than or equal to 2 then it is assumed for drawing purposes that c is in M. (See [Ew] for further discussion of representing the Mandelbrot set.) Some fractals, such as the snowflake curve, are limits of a sequence of piecewise smooth arcs. Then a common way to represent the fractal is to draw one of the approximating arcs - this may be as close as the human eye can perceive but will be a "fattened" arc.

Yet another difficulty arises from the fact that on a computer screen we are viewing discrete pixels. (This is true on paper too, although then there are more dots per inch.) Thus a whole two-dimensional pixel may be turned on to indicate a piece of a fractal of dimension less that two. In some algorithms (typically for the Mandelbrot set) the center point of the pixel is tested and that determines the coloring of the whole pixel. In drawing a piecewise smooth arc however (as in the snowflake curve approximations), if any part of the pixel is in the curve then the whole pixel is turned on. Since we are typically representing a fractal of dimension less that two with two-dimensional pixels, perhaps the best we can do is to illuminate a superset of the actual fractal. In most of our figures, we illuminate a pixel if and only if some part of the curve hits the pixel. For the Hilbert curve approximations for example (Figure 6 or Figure 12) at a depth of n, the curve is contained in 4n congruent square regions that are images of the unit square under sequences of n applications of the contracting IFS together with connecting segments. Furthermore, the curve contains those segments and all the corners of the squares. Thus, when the squares are smaller than a pixel (both horizontally and vertically), they can't "straddle" a single pixel. So we illuminate the (1, 2, or 4) pixels that the 4 corners hit and these pixels contain the whole square region.

Most of the pictures in this web document were drawn in "vga" mode for which the screen is 640×480 pixels. For the subset of the screen used, the curve was drawn in a square with 460 pixels per side. In drawing the Hilbert curve for example, the contraction factor is at most 1/2, and since 29=512>460, 9 iterations of IFS functions are sufficient for the best possible representation in this sense. Note that higher resolutions do not necessarily give a better representation - if pixels are small enough a set of dimension less than two will be invisible to the eye.

An alternative method of drawing these figures that is much faster (it allows "real time" drawing), but not quite as accurate takes advantage of the self similarity of the fractals that we are considering. For the Hilbert curve, for example, one can draw one small part, and then reflect appropriately and repeatedly to get the full picture. If the software doesn't permit reflection but does allow translation, then 4 small parts can be drawn (for each of the 4 orientations of the curve) and these can be translated and pieced together to make the next size pieces, and this can be iterated until we get the full picture. However, typically there will be a type of "graphical round off error" caused by the need to draw in full pixel pieces.

Yet another fast drawing algorithm that is commonly used with IFS's is to start with any point and to randomly and repeatedly apply any of the IFS functions. After very few applications we will be so close to the attractor that for most viewing methods we can't see the difference. Even better, by starting at a point of the attractor, all points will remain in the attractor. The top part of the snowflake curve in Figure 2 was drawn this way with 10,000 points; the other two sides were just rotated versions of it.

[Next] Software and Source Codes
[Up] Table of contents
[Prev] Three Dimensional Space-Filling Curves

Communications in Visual Mathematics, vol 1, no 1, August 1998.
Copyright © 1998, The Mathematical Association of America. All rights reserved.
Created: 18 Aug 1998 --- Last modified: 18 Aug 1998 23:59:59
Comments to: CVM@maa.org