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.

DetailsDetails

  • RegionDistance is also known as point to region distance 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].

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Find the distance from a point to the unit disk:

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

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]=
Introduced in 2014
(10.0)