%% 2-D Delaunay Triangulation
% Create and plot a Delaunay triangulation.

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
TR = delaunayTriangulation(x,y);
triplot(TR)

%
% Compute the identifications of the triangles attached to the edge defined by the starting point (0,0) and ending point (0.5,0.5). The respective vertex identifications of these points are 1 and 5.

ID = edgeAttachments(TR,1,5);
ID{:}

%
% The ConnectivityList property indicates which vertices belong to each triangle. The fourth triangle is defined by vertices (0.5,0.5), (0,0), and (1,0), and the first triangle is defined by vertices (0,1), (0,0), and (0.5,0.5).

TR.ConnectivityList
TR.Points

% Copyright 2012 The MathWorks, Inc.