home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-06 | 4.1 KB | 106 lines | [TEXT/ALFA] |
- Biomorph 0.77 was the latest in a long stream of fractal-generating
- programs. It was never finished but nonetheless has some neat features:
- namely, the ability to accept plug-in codes for other functions. The
- Add Resource/Delete Resource menu options were never implemented, so
- adding codes is done through ResEdit or other means.
-
- I hereby give away all aspects of this code for any use whatsoever.
- In return, the recipient agrees to accept the code as-is, with no
- warranty of any kind. This code was done by a Mac hacker with more
- experience in UNIX & X than Mac.
-
- 5/94 Brent Burton
- brentb@math.tamu.edu
- --------------------------
-
- Introduction
- ------------
-
- Welcome to the world of "biomorphs." Biomorphs are a graphical represen-
- tation of an iterated function of two complex variables. They do not differ
- much (in theory) from other common fractals, such as the Mandelbrot set, but
- the algorithm used to define them is a little different.
-
- Biomorphs have been investigated by A.K. Dewdney in his "Computer
- Recreations" column in _Scientific_American_. His specific article dealing
- with biomorphs appeared in a late 1989 or early 1990 issue. Also, there is a
- book entitled, _The_Blind_Watchmaker_ that investigates evolutionary develop-
- ment of biomorphs through an included program. ( I'm sorry for the vagueness
- above; I don't remember the issue date and since I never have seen the pro-
- gram, I don't know who wrote it.)
-
- Biomorphs get their name because of the interesting images generated that
- have an eery similarity to natural simple creatures. Protozoa, amoebas and
- other similar creatures with their cillia and other physical structures are
- easily obtainable with the biomorph algorithm and "adequately complex" gener-
- ating functions.
-
-
- Generation (Basic ideas)
- ----------
-
- Images of Mandelbrot sets are fairly easy to generate by the following
- algorithm:
-
- define a maximum number of iterations (250, say);
- for (each point in the image region to draw) do:
- {
- z0 = (0,0);
- C = (real_value, imag_value); /* of the current location in region */
-
- while (TRUE)
- {
- z = z0^2 + C;
- if (magnitude(z) > 2.0) or (number of iterations > maximum iterations)
- then
- { plot_point (real_value, imag_value, color based on # iterations);
- exit the while loop;
- }
- z0 = z; (old value of z is now the last z calculated)
- }
- }
-
- The basic idea above is used in the generation of biomorphs. However, the
- conditions are a little different; they are more specific.
- In the original algorithm presented by A.K.Dewdney, the maximum iteration
- number was 10 and the magnitude squared of the complex variable had a limit
- of 100. The algorithm is:
-
- for (each point in the image region) do
- {
- z0 = make_complex( real_value, imag_value); (of the current point)
- z = z0; /* saves one iteration by directly assigning it. */
- z.mag=0; /* initial value */
-
- num_iterations = 1;
- while ( num_iterations <=10 AND
- real_part(z) <= 10.0 AND
- imag_part(z) <= 10.0 AND
- magnitude(z) <= 100 ) /* magnitude is really squared here. */
- {
- z = f(z0, C); /* some function of old z value and C */
- z.mag = z.r*z.r + z.i*z.i; /* sqrt is not taken for speed. */
- num_iterations++;
- }
-
- if ( |z.r| <10.0 OR |z.i| < 10.0 ) then
- paint the current pixel black; /* biomorphs are generally B/W */
- }
-
-
- The generating function f(z0, C) is the most important aspect in
- generating biomorphs. (As distributed, my program uses the function:
-
- z = z0^3 - z0 + C;
-
- [The best idea for changing the function would be to allow the user to
- type in the function to use and then parsing that function. However,
- this is very complex (I didn't know about yacc and lex when I wrote
- this) and recompilation was much easier for a different function.]
-
- You can achieve drastically different images by tweaking the above algorithm's
- conditions, like increasing the iterations and in-/de-creasing the magnitude
- and boundaries.
-
-
-