# RegionNearestFunction

RegionNearestFunction[reg,]

represents a function whose values give the nearest point in the region reg.

# Examples

open allclose all

## Basic Examples(1)

Generate a region nearest function for a unit disk:

Apply the distance function to multiple points:

## Scope(16)

### Special Regions(7)

Point sets:

They work in any dimension:

Visualize the nearest points:

Line:

Visualize it:

Rectangle can be used in 2D:

Cuboid generalizes it to any dimension:

Visualize the nearest points on a rectangle:

Visualize the nearest points on a 2D simplex:

Visualize the nearest points in a hexagon:

Disk can be used in 2D:

Ball generalizes a disk in any dimension:

Visualize the nearest points on a 3D ball:

Disk can be an ellipse in 2D:

Ellipsoid generalizes ellipses to any dimension:

Plot the nearest points on an ellipse:

### Formula Regions(2)

The nearest point on a disk represented as an ImplicitRegion:

A cylinder:

The nearest point on a disk represented as a ParametricRegion:

Using a rational parametrization of the disk:

A cylinder:

### Mesh Regions(4)

The nearest point in a 1D BoundaryMeshRegion:

2D:

3D:

The nearest point in a 0D MeshRegion in 1D:

A 1D region:

The nearest point in a 0D MeshRegion in 2D:

A 1D region:

A 2D region:

The nearest point in a 0D MeshRegion in 3D:

A 1D region:

A 2D region:

A 3D region:

### Derived Regions(3)

The distance to a RegionIntersection:

The distance to a TransformedRegion:

The distance to a RegionBoundary:

## Applications(2)

Visualize the nearest points in a region:

Use Locator to find the nearest point to a country region:

## Properties & Relations(2)

RegionNearestFunction gives the same result when applied to a point as RegionNearest[r,p]:

Formulas returned by RegionNearest, evaluated at a point, coincide with RegionNearestFunction:

## Possible Issues(1)

RegionNearestFunction can only be generated for ConstantRegionQ regions:

Wolfram Research (2014), RegionNearestFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionNearestFunction.html.

#### Text

Wolfram Research (2014), RegionNearestFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionNearestFunction.html.

#### CMS

Wolfram Language. 2014. "RegionNearestFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionNearestFunction.html.

#### APA

Wolfram Language. (2014). RegionNearestFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionNearestFunction.html

#### BibTeX

@misc{reference.wolfram_2024_regionnearestfunction, author="Wolfram Research", title="{RegionNearestFunction}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/RegionNearestFunction.html}", note=[Accessed: 21-June-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_regionnearestfunction, organization={Wolfram Research}, title={RegionNearestFunction}, year={2014}, url={https://reference.wolfram.com/language/ref/RegionNearestFunction.html}, note=[Accessed: 21-June-2024 ]}