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

    %% Compute the Voronoi Diagram of a 2-D Triangulation  

%% 
% Create a Delaunay triangulation from a set of points. 
P = [ 0.5    0
      0      0.5
     -0.5   -0.5
     -0.2   -0.1
     -0.1    0.1
      0.1   -0.1
      0.1    0.1 ];
DT = delaunayTriangulation(P);  

%% 
% Calculate the Voronoi vertices and regions. 
[V,R] = voronoiDiagram(DT);  

%% 
% Examine the connectivity of the Voronoi region associated with the third
% point in the triangulation. 
R{3}  

%% 
% Examine the coordinates of the Voronoi vertices bounding the region. 
V(R{3},:) 

%%
% The |Inf| values indicate that the region contains points on the convex hull.