# Exterior Distance

Exterior distance rendering

Formalizes the dwell gradient idea, in that closeness of dwell bands is related to closeness to the boundary of the set. In Heinz-Otto Peitgen and Dietmar Saupe’s “The Science of Fractal Images” (1988) Appendix D, Yuval Fisher bounds the distance \(d(c, M)\) between a point \(c\) outside \(M\) and \(M\) itself by:

\[\frac{\sinh G(c)}{2 e^{G(c)} \left|\frac{d}{dc}G(c)\right|} < d(c, M) < \frac{2 \sinh G(c)}{\left|\frac{d}{dc}G(c)\right|}\]

where \(G(c)\) is the potential of the point \(c\). The upper bound can be approximated by using a large escape radius; for escaped \(z\):

\[d = 2 \frac{\left|z\right| \log \left|z\right|} {\left|\frac{\partial}{\partial c}z\right|}\]

There is a point in the Mandelbrot set within \(d\). No point in the Mandelbrot set is within \(\frac{d}{4}\). Compare with pixel spacing to know if the Mandelbrot set might intersect a pixel.

A complex-valued distance estimate (with directional information) can be calculated by:

\[d = 2 \frac{z \log \left|z\right|}{\frac{\partial}{\partial c}z}\]

Distance estimation (2010) and Circular wavefronts (2010) use distance estimates to give progressively finer approximations to the exterior, while Adaptive super-sampling using distance estimate (2014) describes an adaptive supersampling method.

# 1 C99 Code

#include <complex.h>
#include <math.h>

double _Complex m_exterior_distance
    (int N, double R, double _Complex c)
{
    double _Complex z = 0;
    double _Complex dc = 0;
    for (int n = 0; n < N; ++n)
    {
        if (cabs(z) > R)
            return 2 * z * log(cabs(z)) / dc;
        dc = 2 * z * dc + 1;
        z = z * z + c;
    }
    return 0;
}