Orbit Trap Fractals

September 01, 2020

Orbit trap fractals use the same general recurrence function as typical escape-time fractals: z ↦ f(z), calculated over and over. But in the orbit trap method, a region of the image called a "trap” is defined. As the value of z changes ("orbits") with each calculation, if the point lands within the trap region, the pixel will be filled with a color based on how far the point falls from the center of that trap.

The traditional escape-time Mandelbrot set is shown on the left, with the same Mandelbrot equation drawn with an orbit trap along the y-axis on the right.

Mandelbrot Set Fractal Orbit Trap Fractal

Many trap shapes are possible, which lead to many interesting results.

Orbit Trap Pseudocode

FOR each pixel (Px, Py) in the image:
    z := complex(Px, Py) scaled to data range
    FOR N iterations:
        # Recurrence function f(z) calculates a new Z
        z := f(z)
        # Orbit traps define the color
        FOR each orbit_trap:
            IF z within trap_area:
                distance := abs(normalized distance to trap_center)
                color := palette[trap_number, iteration, distance]
                IF trap_image[Px, Py] has not been set:
                    # Option - remove above IF and always set color
                    # to reverse trap order
                    trap_image[Px, Py] := color
final_image := composite(all trap_images)

Gallery of Orbit Trap Fractals

Back