Significant performance improvements to fractal dimension code.

The key idea here is to compute the distance between each sample
and each element, and then sort them.  Once minimum distances to
interfaces are smaller than the distance to the elements, the loop
can be truncated.