%% 2-D Delaunay Triangulation
% Compute the Voronoi vertices and regions of a 2-D Delaunay triangulation.
% Create a Delaunay triangulation from a set of 2-D 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);

%
% Compute the Voronoi vertices and regions.

[V,r] = voronoiDiagram(DT);

%
% Display the connectivity of the Voronoi region associated with the 3rd point in the triangulation.

r{3}

%
% Display the coordinates of the Voronoi vertices bounding the 3rd region. The Inf values indicate that the region contains points on the convex hull.

V(r{3},:)

% Copyright 2012 The MathWorks, Inc.