# Distance estimation (12/11/12 - 20/11/12)

Interest in this was sparked by trying to understand how to draw Julia sets using something called the distance estimation method (DEM). This method can produce some fantastic results, such as the one shown below (image from the Wikipeda Julia Set page).

Click for larger

Unfortunately, a good explanation of the DEM is a bit hard to come by, so I tried to write a clearer description of how to use it. Leading up to the full DEM, it's helpful to understand simpler distance estimation calculations, such as closest distance from a point to a line, point to an isoline etc. I've put these into separate PDFs, available below.

**Distance from point to line** Calculate the shortest distance between a given point and a straight line.

**Distance from point to function** Calculate an estimate of the shortest distance between a given point and a function f(x).

**Distance from point to isoline** Calculate an estimate of the distance between a point and an isoline of a 2D function. Useful, for example, in plotting equipotential lines of electric fields.

**Drawing fractals using DEM** Drawing both the Mandelbrot and Julia sets using the DEM.

### 27/11/12: Zoom video

Here is a video of a zoom into the Mandelbrot set. It uses both distance estimation and escape time to represent the colour of each set point.