Burning Ship fractal

The Burning Ship fractal, first described and created by Michael Michelitsch and Otto E. Rössler in 1992, is generated by iterating the function:

in the complex plane which will either escape or remain bounded. The difference between this calculation and that for the Mandelbrot set is that the real and imaginary components are set to their respective absolute values before squaring at each iteration. The mapping is non-analytic because its real and imaginary parts do not obey the Cauchy–Riemann equations.[1]

Implementation

The below pseudocode implementation hardcodes the complex operations for Z. Consider implementing complex number operations to allow for more dynamic and reusable code. Note that the typical images of the Burning Ship fractal display the ship upright: the actual fractal, and that produced by the below pseudocode, is inverted along the x-axis.

 1 For each pixel (x, y) on the screen, do:
 2 {
 3     x = scaled x coordinate of pixel (scaled to lie in the Mandelbrot X scale (-2.5, 1))
 4     y = scaled y coordinate of pixel (scaled to lie in the Mandelbrot Y scale (-1, 1))
 5        
 6     
 7     zx = x; // zx represents the real part of z
 8     zy = y; // zy represents the imaginary part of z 
 9 
10   
11     iteration = 0
12     max_iteration = 1000
13   
14     while (zx*zx + zy*zy < 4  AND  iteration < max_iteration) 
15     {
16         xtemp = zx*zx - zy*zy + x
17         zy = abs(2*zx*zy + y) //abs returns the absolute value
18         zx = abs(xtemp)
19 
20         iteration = iteration + 1
21     }
22 
23     if (iteration == max_iteration) //Belongs to the set
24         return insideColor;
25 
26     return iteration * color;
27 }

References

  1. Michael Michelitsch and Otto E. Rössler (1992). "The "Burning Ship" and Its Quasi-Julia Sets". In: Computers & Graphics Vol. 16, No. 4, pp. 435–438, 1992. Reprinted in Clifford A. Pickover Ed. (1998). Chaos and Fractals: A Computer Graphical Journey — A 10 Year Compilation of Advanced Research. Amsterdam, Netherlands: Elsevier. ISBN 0-444-50002-2
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.