[Math] The gradient of a distance function.

calculus

In level set a distance function is defined as:

$$
d(\vec{x})=\min(\left|\vec{x}-\vec{x}_{I}\right|)
$$
where $\vec{x}_{I}$is a point on the interface, for two spatial dimensions it can be a curve.

Furthermore, since $d$ is Euclidean distance, then:

$$\left|\nabla d\right|=1$$

I know how to envaluate a gradient of a explicit function like $f(x,y)=x^2+y^2$, but this distance function behaves quite strange offering no access to caculate.

What have I done is below, maybe I need some more knowledge and your help:

$$
\left|\nabla d\right| = \sqrt{\left(\frac{\partial d}{\partial x}\right)^2+\left(\frac{\partial d}{\partial y}\right)^2}
$$

Best Answer

Given a closed set $A$ in the plane (e.g., an ellipse, or an amoeba) the function $$f({\bf z}):=d({\bf z},A)$$ depends on the exact shape of $A$ in an intricate way, so that in general there is no simple expression for $f$, let alone for $\nabla f$.

In the following case one can give a simple answer: If for a given ${\bf z}_0\notin A$ there is a uniquely defined nearest point ${\bf w}_0\in\partial A$ then $\nabla f({\bf z}_0)$ is the unit vector in direction ${\bf z}_0-{\bf w}_0$ attached at ${\bf z}_0$.

Sketch of proof: Assume that $A$ touches the $y$-axis from the left at ${\bf w}_0=(0,0)$ and that ${\bf z}_0=(a,0)$ for some $a>0$. Then obviously ${\bf w}_0$ is the point of $A$ nearest to ${\bf z}_0$. In order to circumvent the necessary calculations we now replace the boundary curve $\partial A$ near ${\bf w}_0$ by a circular arc of the same curvature $\kappa_0$ and having vertical tangent there. Then the level lines of $f$ become circles with center at $\bigl(-{1\over\kappa_0},\>0\bigr)$. These circles intersect the positive $x$-axis vertically. It follows that $\nabla f({\bf z}_0)=(1,0)$, as claimed.

Related Question