RegionDistance

RegionDistance[reg,p]

gives the minimum distance from the point p to the region reg.

RegionDistance[reg]

gives a RegionDistanceFunction[] that can be applied repeatedly to different points.

Details

  • RegionDistance is also known as point-to-region distance, distance transform, distance field and minimum region distance.
  • The distance between points q and p is taken to be Norm[p-q].
  • Region distance is effectively given by MinValue[{Norm[p-q],qreg},q].

Examples

open allclose all

Basic Examples  (2)

Find the distance from a point to the unit disk:

In[1]:=
Click for copyable input
Out[1]=

Plot the distance as a function of position:

In[1]:=
Click for copyable input
Out[1]=

Find the distance from a point to a MeshRegion:

In[1]:=
Click for copyable input
Out[1]=

With one argument, you get a RegionDistanceFunction:

In[2]:=
Click for copyable input
Out[2]=

Apply the distance function lists of points to compute many distances:

In[3]:=
Click for copyable input
Out[3]=

Scope  (15)

Applications  (5)

Properties & Relations  (4)

See Also

RegionDistanceFunction  RegionNearest  SignedRegionDistance  Norm  MinValue  NMinValue  RegionMember  RegionWithin  DistanceTransform

Introduced in 2014
(10.0)