Main Content

voronoiDiagram

(Not recommended) Voronoi diagram of Delaunay triangulation

voronoiDiagram(DelaunayTri) is not recommended. Use voronoiDiagram(delaunayTriangulation) instead.

DelaunayTri is not recommended. Use delaunayTriangulation instead.

Description

example

[V,R] = voronoiDiagram(DT) returns the vertices V and regions R of the Voronoi diagram of the points DT.X. The region R{i} is a cell array of indices into V that represents the Voronoi vertices bounding the region. The Voronoi region associated with the i'th point, DT.X(i) is R{i}. For 2-D, vertices in R{i} are listed in adjacent order, i.e. connecting them will generate a closed polygon (Voronoi diagram). For 3-D the vertices in R{i} are listed in ascending order.

The Voronoi regions associated with points that lie on the convex hull of DT.X are unbounded. Bounding edges of these regions radiate to infinity. The vertex at infinity is represented by the first vertex in V.

Examples

collapse all

Create a 2-D Delaunay triangulation.

X = [ 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 = DelaunayTri(X);

Compute the Voronoi Diagram of the set of points.

[V,R] = voronoiDiagram(dt)
V = 10×2

       Inf       Inf
   -1.4500    0.6500
   -1.7500    0.7500
         0    0.2875
   -0.0500   -0.0500
    0.7000   -1.6500
    0.3833    0.3833
         0         0
    0.2875         0
   -0.0500   -0.5250

R=7×1 cell array
    {[   1 7 9 6]}
    {[ 1 3 2 4 7]}
    {[  1 6 10 3]}
    {[  2 3 10 5]}
    {[   2 5 8 4]}
    {[5 10 6 9 8]}
    {[   4 8 9 7]}

Input Arguments

collapse all

Delaunay triangulation representation, specified as a DelaunayTri object.

Output Arguments

collapse all

Coordinates of Voronoi vertices, returned as a matrix. V is a numv-by-ndim matrix, where numv is the number of vertices and ndim is the dimension of the space where the points reside.

Voronoi cells, returned as a cell array. R is a vector cell array with the same length as DT.X. The entries represent the Voronoi cell associated with each point.

More About

collapse all

Voronoi Diagram

The Voronoi diagram of a discrete set of points X decomposes the space around each point X(i) into a region of influence R{i}. Locations within the region are closer to point i than any other point. The region of influence is called the Voronoi region. The collection of all the Voronoi regions is the Voronoi diagram.

Convex Hull

The convex hull of a set of points X is the smallest convex polygon (or polyhedron in higher dimensions) containing all of the points of X.

Extended Capabilities

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced in R2009a