RegionNearest
✖
RegionNearest
Details

- The distance between points q and p is taken to be Norm[p-q].
- RegionNearest is effectively given by ArgMin[{Norm[p-q],q∈reg},q].
- RegionNearest can be used with symbolic regions and points in GeometricScene.

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Find the nearest point in the unit disk:

https://wolfram.com/xid/09b0ef5bm-h4c3pr


https://wolfram.com/xid/09b0ef5bm-jju9cc

Find the nearest point in a MeshRegion:

https://wolfram.com/xid/09b0ef5bm-b5gwzp

With one argument you get a RegionNearestFunction:

https://wolfram.com/xid/09b0ef5bm-e7jq48

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

https://wolfram.com/xid/09b0ef5bm-bi09wv

Scope (16)Survey of the scope of standard use cases
Special Regions (7)
Point sets:

https://wolfram.com/xid/09b0ef5bm-bij3y1


https://wolfram.com/xid/09b0ef5bm-cdjz4a


https://wolfram.com/xid/09b0ef5bm-k0p5c3

https://wolfram.com/xid/09b0ef5bm-b5o963

Line:

https://wolfram.com/xid/09b0ef5bm-ntr1p


https://wolfram.com/xid/09b0ef5bm-c2h6od


https://wolfram.com/xid/09b0ef5bm-crz78j

https://wolfram.com/xid/09b0ef5bm-oahg3

Rectangle can be used in 2D:

https://wolfram.com/xid/09b0ef5bm-jv162

Cuboid generalizes it to any dimension:

https://wolfram.com/xid/09b0ef5bm-elo97m

Visualize the nearest points on a rectangle:

https://wolfram.com/xid/09b0ef5bm-cb5t0s

https://wolfram.com/xid/09b0ef5bm-dl95d9


https://wolfram.com/xid/09b0ef5bm-khpg86


https://wolfram.com/xid/09b0ef5bm-s9hi8

Visualize the nearest points on a 2D simplex:

https://wolfram.com/xid/09b0ef5bm-q9huz

https://wolfram.com/xid/09b0ef5bm-bxxjv4


https://wolfram.com/xid/09b0ef5bm-n06s0x

Visualize the nearest points in a hexagon:

https://wolfram.com/xid/09b0ef5bm-ifc9dj

https://wolfram.com/xid/09b0ef5bm-hulmg

Disk can be used in 2D:

https://wolfram.com/xid/09b0ef5bm-c9koyz

Ball generalizes a disk in any dimension:

https://wolfram.com/xid/09b0ef5bm-h10zot

Visualize the nearest points on a 3D ball:

https://wolfram.com/xid/09b0ef5bm-kmzxz

https://wolfram.com/xid/09b0ef5bm-iay2op

Disk can be an ellipse in 2D:

https://wolfram.com/xid/09b0ef5bm-2vzam

Ellipsoid generalizes ellipses to any dimension:

https://wolfram.com/xid/09b0ef5bm-iwctvx

Plot the nearest points on an ellipse:

https://wolfram.com/xid/09b0ef5bm-my8lut

https://wolfram.com/xid/09b0ef5bm-l4jbke

Formula Regions (2)
The nearest point on a disk represented as an ImplicitRegion:

https://wolfram.com/xid/09b0ef5bm-e3pxnh

https://wolfram.com/xid/09b0ef5bm-bbebm2


https://wolfram.com/xid/09b0ef5bm-m8ukuf


https://wolfram.com/xid/09b0ef5bm-jirj3

https://wolfram.com/xid/09b0ef5bm-f09o8a

The nearest point on a disk represented as a ParametricRegion:

https://wolfram.com/xid/09b0ef5bm-el6xm7

https://wolfram.com/xid/09b0ef5bm-ffcksa


https://wolfram.com/xid/09b0ef5bm-g849lt

Using a rational parametrization of the disk:

https://wolfram.com/xid/09b0ef5bm-ky4tf

https://wolfram.com/xid/09b0ef5bm-by6xm0


https://wolfram.com/xid/09b0ef5bm-hv7e8z

https://wolfram.com/xid/09b0ef5bm-gj39yx


https://wolfram.com/xid/09b0ef5bm-gibioi

Mesh Regions (4)
The nearest point in a 1D BoundaryMeshRegion:

https://wolfram.com/xid/09b0ef5bm-nejktm


https://wolfram.com/xid/09b0ef5bm-ekay2x


https://wolfram.com/xid/09b0ef5bm-f6bccz

https://wolfram.com/xid/09b0ef5bm-ceuwni


https://wolfram.com/xid/09b0ef5bm-di3wdk


https://wolfram.com/xid/09b0ef5bm-fqmu4o

https://wolfram.com/xid/09b0ef5bm-idlvw


https://wolfram.com/xid/09b0ef5bm-kh906

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

https://wolfram.com/xid/09b0ef5bm-btvxtc


https://wolfram.com/xid/09b0ef5bm-ik7sz


https://wolfram.com/xid/09b0ef5bm-citaof


https://wolfram.com/xid/09b0ef5bm-fsnj3j

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

https://wolfram.com/xid/09b0ef5bm-8ds1n

https://wolfram.com/xid/09b0ef5bm-je81r2


https://wolfram.com/xid/09b0ef5bm-s2678


https://wolfram.com/xid/09b0ef5bm-i80ee2

https://wolfram.com/xid/09b0ef5bm-d60kip


https://wolfram.com/xid/09b0ef5bm-b3zcwl


https://wolfram.com/xid/09b0ef5bm-b8poha

https://wolfram.com/xid/09b0ef5bm-chjbp1


https://wolfram.com/xid/09b0ef5bm-j04042

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

https://wolfram.com/xid/09b0ef5bm-kp5ocx

https://wolfram.com/xid/09b0ef5bm-d417z5


https://wolfram.com/xid/09b0ef5bm-bmbb55


https://wolfram.com/xid/09b0ef5bm-d6wqd3

https://wolfram.com/xid/09b0ef5bm-efldpv


https://wolfram.com/xid/09b0ef5bm-wmdcy


https://wolfram.com/xid/09b0ef5bm-crt8vj

https://wolfram.com/xid/09b0ef5bm-bf8122


https://wolfram.com/xid/09b0ef5bm-chm3ht


https://wolfram.com/xid/09b0ef5bm-cc4as

https://wolfram.com/xid/09b0ef5bm-b3r9b


https://wolfram.com/xid/09b0ef5bm-c72n9z

Derived Regions (3)
The distance to a RegionIntersection:

https://wolfram.com/xid/09b0ef5bm-iri6pf

https://wolfram.com/xid/09b0ef5bm-9e68l


https://wolfram.com/xid/09b0ef5bm-bvehq

The distance to a TransformedRegion:

https://wolfram.com/xid/09b0ef5bm-c2wj44

https://wolfram.com/xid/09b0ef5bm-wbcwf


https://wolfram.com/xid/09b0ef5bm-k1y8k2

The distance to a RegionBoundary:

https://wolfram.com/xid/09b0ef5bm-lstt5

https://wolfram.com/xid/09b0ef5bm-bjh3h5


https://wolfram.com/xid/09b0ef5bm-dao2kz

Applications (3)Sample problems that can be solved with this function
Visualize the nearest points in a region:

https://wolfram.com/xid/09b0ef5bm-mgv8i7
The nearest points along two circles:

https://wolfram.com/xid/09b0ef5bm-c8zs88

Visualize a region by mapping uniform points to the region using RegionNearest:

https://wolfram.com/xid/09b0ef5bm-ks1xh9

Find the altitude of a triangle:

https://wolfram.com/xid/09b0ef5bm-4h9btt

https://wolfram.com/xid/09b0ef5bm-e5zzur

https://wolfram.com/xid/09b0ef5bm-3csd0h

https://wolfram.com/xid/09b0ef5bm-u7fgv7

https://wolfram.com/xid/09b0ef5bm-kxq96p

Properties & Relations (4)Properties of the function, and connections to other functions
Only one point is returned in case there is a tie:

https://wolfram.com/xid/09b0ef5bm-6nqoqt

https://wolfram.com/xid/09b0ef5bm-jfspe3

Visualize the nearest point chosen in red:

https://wolfram.com/xid/09b0ef5bm-5c9ucm

A point is a RegionMember if the nearest point to the region is itself:

https://wolfram.com/xid/09b0ef5bm-qdojf5

https://wolfram.com/xid/09b0ef5bm-mbbak9


https://wolfram.com/xid/09b0ef5bm-h4jhtl

RegionNearest is closely related to RegionDistance:

https://wolfram.com/xid/09b0ef5bm-itfn4t
The distance to the nearest point is minimal:

https://wolfram.com/xid/09b0ef5bm-bglbo1


https://wolfram.com/xid/09b0ef5bm-dux0f3


https://wolfram.com/xid/09b0ef5bm-elibhs

Nearest gives nearest points for finite point regions:

https://wolfram.com/xid/09b0ef5bm-fu5j25

https://wolfram.com/xid/09b0ef5bm-iqtmrh


https://wolfram.com/xid/09b0ef5bm-4fjj2

Wolfram Research (2014), RegionNearest, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionNearest.html.
Text
Wolfram Research (2014), RegionNearest, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionNearest.html.
Wolfram Research (2014), RegionNearest, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionNearest.html.
CMS
Wolfram Language. 2014. "RegionNearest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionNearest.html.
Wolfram Language. 2014. "RegionNearest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionNearest.html.
APA
Wolfram Language. (2014). RegionNearest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionNearest.html
Wolfram Language. (2014). RegionNearest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionNearest.html
BibTeX
@misc{reference.wolfram_2025_regionnearest, author="Wolfram Research", title="{RegionNearest}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/RegionNearest.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_regionnearest, organization={Wolfram Research}, title={RegionNearest}, year={2014}, url={https://reference.wolfram.com/language/ref/RegionNearest.html}, note=[Accessed: 25-March-2025
]}