This is an implementation of original Matlab software of
Per-Olof Persson. Excerpt (modified) from the reference below:
The algorithm is based on a mechanical analogy
between a triangular mesh and a n-D truss structure. In
the physical model, the edges of the Delaunay triangles
of a set of points correspond to bars of a truss. Each
bar has a force-displacement relationship $f(\ell,
\ell_{0})$ depending on its current length
$\ell$ and its unextended length
$\ell_{0}$.
External forces on the structure come at the
boundaries, on which external forces have normal
orientations. These external forces are just large enough
to prevent nodes from moving outside the boundary. The
position of the nodes are the unknowns, and are found by
solving for a static force equilibrium. The hope is that
(when fh = function(p) return(rep(1,nrow(p)))),
the lengths of all the bars at equilibrium will be nearly
equal, giving a well-shaped triangular mesh.
See the references below for all details. Also, see the
comments in the source file of distmesh2d.