RegionNearest

RegionNearest[reg,p]
gives a point in the region reg that is nearest the point p.

RegionNearest[reg]
gives a RegionNearestFunction[] that can be repeatedly applied to points.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Find the nearest point in the unit disk:

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

Plot it:

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

Find the nearest point in a MeshRegion:

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

With one argument you get a RegionNearestFunction:

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

Apply the function to lists of points to compute many nearest points:

In[3]:=
Click for copyable input
Out[3]=
Introduced in 2014
(10.0)