ID = nearestNeighbor(TR,P)
returns the IDs of the vertices closest to the query points in P.
Each row in the matrix P contains the coordinates of a query
point.
Triangulation representation, specified as a scalar triangulation or delaunayTriangulation object.
nearestNeighbor does not support
delaunayTriangulation objects with constrained
edges.
Query points, specified as a matrix with 2 or 3 columns.
P contains the x-coordinates,
y-coordinates, and (possibly)
z-coordinates of the query points.
Data Types: double
x — x-coordinates column vector
x-coordinates of query points, specified as a column
vector.
Data Types: double
y — y-coordinates column vector
y-coordinates of query points, specified as a column
vector.
Data Types: double
z — z-coordinates column vector
z-coordinates of query points, specified as a column
vector.
Vertex IDs of the nearest neighbors to the query points, returned as a
column vector. A vertex ID is the row number of the corresponding vertex in
the Points property.
Data Types: double
d — Euclidean distances column vector
Euclidean distances from the query points to their nearest neighbors,
returned as a column vector the same length as ID.
Data Types: double
Extended Capabilities
Thread-Based Environment Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.