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.

Details

Examples

open allclose all

Basic Examples  (2)

Find the nearest point in the unit disk:

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

Plot it:

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

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]=

Scope  (16)

Applications  (3)

Properties & Relations  (4)

See Also

RegionNearestFunction  RegionDistance  SignedRegionDistance  Nearest  ArgMin  NArgMin  RegionMember  RegionWithin

Introduced in 2014
(10.0)