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.

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.
for each pixel on the screen, do:
x := scaled x coordinate of pixel
y := scaled y coordinate of pixel
zx := x // zx represents the real part of z
zy := y // zy represents the imaginary part of z
iteration := 0
max_iteration := 1000

while do
xtemp := zx*zx - zy*zy + x
zy := abs // abs returns the absolute value
zx := abs
iteration := iteration + 1
if iteration = max_iteration then // Belongs to the set
return insideColor
return iteration × color