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
- 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)
Find the nearest point in the unit disk:
Find the nearest point in a MeshRegion:
With one argument you get a RegionNearestFunction:
Apply the function to lists of points to compute many nearest points:
Scope (16)
Special Regions (7)
Point sets:
Line:
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:
Formula Regions (2)
The nearest point on a disk represented as an ImplicitRegion:
The nearest point on a disk represented as a ParametricRegion:
Mesh Regions (4)
The nearest point in a 1D BoundaryMeshRegion:
The nearest point in a 0D MeshRegion in 1D:
The nearest point in a 0D MeshRegion in 2D:
The nearest point in a 0D MeshRegion in 3D:
Derived Regions (3)
The distance to a RegionIntersection:
The distance to a TransformedRegion:
The distance to a RegionBoundary:
Applications (3)
Visualize the nearest points in a region:
The nearest points along two circles:
Visualize a region by mapping uniform points to the region using RegionNearest:
Properties & Relations (4)
Only one point is returned in case there is a tie:
Visualize the nearest point chosen in red:
A point is a RegionMember if the nearest point to the region is itself:
RegionNearest is closely related to RegionDistance:
The distance to the nearest point is minimal:
Nearest gives nearest points for finite point regions:
Text
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.
APA
Wolfram Language. (2014). RegionNearest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionNearest.html