FUNCTION REFERENCE

delaunayTriangulation.nearestNeighbor

Find the closest vertex to each query point in a Delaunay triangulation.

Find the closest vertex to each query point in a Delaunay triangulation.

Syntax

ID = nearestNeighbor(DT, Q)

Syntax

[ID, D] = nearestNeighbor(DT, Q)

Syntax

[ID, D] = DT.nearestNeighbor(Q)

Finds the nearest vertex in DT.Points to each row of Q (N-by-2 in 2-D or N-by-3 in 3-D), returning vertex indices ID and optional Euclidean distances D.

Example

DT = delaunayTriangulation([0 0; 1 0; 0 1]); [id, d] = DT.nearestNeighbor([0.1 0.2])

Example

DT = delaunayTriangulation([0 0 0; 1 0 0; 0 1 0; 0 0 1]); [id, d] = DT.nearestNeighbor([0.1 0.1 0.1])

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.