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

    %% Attachments to Specific Vertex in 2-D Delaunay Triangulation  
% Locate and plot the attachments to a specific vertex.   

% Copyright 2015 The MathWorks, Inc.


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

%% 
% Find the triangles attached to the fifth vertex. 
ti = vertexAttachments(DT,5);
ti{:}  

%% 
% Plot the triangulation. Plot the triangles attached to vertex 5 in red.
triplot(DT)
hold on 
 
triplot(DT(ti{:},:),x,y,'Color','r')  % vertex 5 (in red)
hold off