%% 2-D Delaunay Triangulation
% Locate and plot the attachments to a specified vertex in a 2-D Delaunay triangulation.
% Create a Delaunay triangulation from a set of 2-D points.

x = gallery('uniformdata',[20,1],0);
y = gallery('uniformdata',[20,1],1);
TR = delaunayTriangulation(x,y);

%
% Find the triangles attached to the 5th vertex.

V = vertexAttachments(TR,5);
V{:}

%
% Plot the triangulation, and plot the triangles attached to vertex 5 in red.

triplot(TR)
hold on  
triplot(TR(V{:},:),x,y,'Color','r')

% Copyright 2015 The MathWorks, Inc.