RegionNearestFunction

RegionNearestFunction[reg,]

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

Details

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:

Simplex:

Visualize the nearest points on a 2D simplex:

Polygon:

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:

Introduced in 2014
 (10.0)