%% Free Boundary of Delaunay Triangulation
% Perform a direct query of a 2-D triangulation created with DelaunayTri.
% Create a Delaunay triangulation.

x = rand(20,1);
y = rand(20,1);
dt = DelaunayTri(x,y);

% Compute the free boundary of the triangulation, and then plot the triangulation with the free boundary edges in red.

fe = freeBoundary(dt)';
triplot(dt)
hold on
plot(x(fe),y(fe),'-r','LineWidth',2)
hold off

% In this instance the free edges correspond to the convex hull of (x,y).
% Copyright 2020 The MathWorks, Inc.