www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/FreeBoundaryof2DDelaunayTriangulationExample.m

    %% Free Boundary of 2-D Delaunay Triangulation  
% Use |freeBoundary| when you want to highlight the outer edges of a 2-D
% Delaunay triangulation.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a triangulation from a random set of points. 
x = gallery('uniformdata',[20,1],0);
y = gallery('uniformdata',[20,1],1);
DT = delaunayTriangulation(x,y);  

%% 
% Find the free boundary edges. 
fe = freeBoundary(DT)';  

%% 
% Plot the mesh and highlight the free boundary edges in red. 
triplot(DT);
hold on;
plot(x(fe),y(fe),'-r','LineWidth',2) ; 
hold off;