Signed distance function

From Wikipedia, the free encyclopedia
Jump to: navigation, search
A disk (top) and its signed distance function (bottom, in red). The x-y plane is shown in blue.
A more complicated set (top) and its signed distance function (bottom, in red).

In mathematics and applications, the signed distance function of a set Ω in a metric space, also called the oriented distance function, determines the distance of a given point x from the boundary of Ω, with the sign determined by whether x is in Ω. The function has positive values at points x inside Ω, it decreases in value as x approaches the boundary of Ω where the signed distance function is zero, and it takes negative values outside of Ω.


If (Ω, d) is a metric space, the signed distance function f is defined by

f(x) = \begin{cases}
   d(x, \Omega^c) & \mbox{ if } x\in\Omega \\
  -d(x, \Omega)&  \mbox{ if } x\in\Omega^c


 d(x, \Omega) = \inf_{y\in \Omega}d(x, y)

and inf denotes the infimum.

Algorithms for calculating the signed distance function include the efficient fast marching method (O(N log(N)), fast sweeping method[1] (O(N)) and the more general but slower level set method.

Signed distance functions are applied for example in computer vision.

Properties in Euclidean space[edit]

If Ω is a subset of the Euclidean space Rn with piecewise smooth boundary, then the signed distance function is differentiable almost everywhere, and its gradient satisfies the eikonal equation

|\nabla f|=1.

If the boundary of Ω is Ck for k≥2 (see differentiability classes) then d is Ck on points sufficiently close to the boundary of Ω.[2] In particular, on the boundary f satisfies

\nabla f(x) = N(x),

where N is the inward normal vector field. The signed distance function is thus a differentiable extension of the normal vector field. In particular, the Hessian of the signed distance function on the boundary of Ω gives the Weingarten map.

If, further, Γ is a region sufficiently close to the boundary of Ω that f is twice continuously differentiable on it, then there is an explicit formula involving the Weingarten map Wx for the Jacobian of changing variables in terms of the signed distance function and nearest boundary point. Specifically, if T(∂Ω,μ) is the set of points within distance μ of the boundary of Ω (i.e. the tubular neighbourhood of radius μ), and g is an absolutely integrable function on Γ, then

\int_{T(\partial\Omega,\mu)} g(x)\,dx = \int_{\partial\Omega}\int_{-\mu}^\mu g(u+\lambda N(u))\, \det(I-\lambda W_u) \,d\lambda \,dS_u,

where det indicates the determinant and dSu indicates that we are taking the surface integral.[3]

See also[edit]


  1. ^ [ZHAO, Hongkai. A fast sweeping method for eikonal equations. Mathematics of computation, 2005, 74. Jg., Nr. 250, S. 603-627.
  2. ^ Gilbarg 1983, Lemma 14.16.
  3. ^ Gilbarg 1983, Equation (14.98).


  • Stanley J. Osher and Ronald P. Fedkiw (2002). Level Set Methods and Dynamic Implicit Surfaces. Springer. 
  • Gilbarg, D.; Trudinger, N. S. (1983). Elliptic Partial Differential Equations of Second Order. Grundlehren der mathematischen Wissenschaften 224 (2nd ed.). Springer-Verlag.  (or the Appendix of the 1977 1st ed.)