%% Nearest Neighbors in Delaunay Triangulation
% Create a Delaunay triangulation for a set of random points.

rng default
x = rand(10,1);
y = rand(10,1);
dt = DelaunayTri(x,y);

% Create a matrix of 2-D query points.

Q = [0.25 0.25; 0.5 0.5];

% Find the nearest neighbors to the query points.

pid = nearestNeighbor(dt,Q)

% Copyright 2020 The MathWorks, Inc.