Do You Know the Mandelbox Fractal?

A Mandelbox is a box shaped 3d object with a fractal surface and like the Mandelbrot set, a Mandelbox set is calculated by applying a formula repeatedly to every point in space.

The Mandelbrot equation is: z = z2 + c

The Mandelbox equation is: v = s * ballFold(r, f*boxFold(v)) + c
– v: 3d point
– boxFold(v) means for each axis a:

if v[a] > 1 
    v[a] =  2 - v[a]
else if v[a] < -1
    v[a] = -2 - v[a]

– ballFold(r, v) means for v’s magnitude m:

if m < r
    m = m/r^2
else if m < 1 
    m = 1/m^2	

The standard Mandelbox uses this formula with s=2, r=0.5 and f=1.

[source] | [via]