%% 2-D Delaunay Triangulation
% You can use the freeBoundary function to highlight the outer edges of a 2-D Delaunay triangulation.
% Create a triangulation from a 2-D set of points.

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

%
% Find the free boundary edges.

F = freeBoundary(TR);

%
% Plot the triangulation and highlight the free boundary edges in red.

triplot(TR)
hold on
plot(x(F),y(F),'-r','LineWidth',2)

% Copyright 2015 The MathWorks, Inc.