Documentation Center

  • Trial Software
  • Product Updates

voronoiDiagram

Class: delaunayTriangulation

Voronoi diagram

Syntax

[V,R] = voronoiDiagram(DT)

Description

[V,R] = voronoiDiagram(DT) returns the Voronoi vertices, V, and the Voronoi regions, R, of the points, DT.Points.

The Voronoi diagram of a set of points, such as DT.Points, decomposes the space around each point, DT.Points(j,:), into a region of influence, R{j}. Locations within the region, R{j}, are closer to point j than any other point in DT.Points. The region of influence is called the Voronoi region. The collection of all the Voronoi regions is the Voronoi diagram.

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

Input Arguments

DT

A Delaunay triangulation, see delaunayTriangulation.

Output Arguments

V

Voronoi vertices, returned as a matrix. Each row of V contains the coordinates of a Voronoi vertex.

R

Voronoi regions, returned as a vector cell array the same length as DT.Points. The elements of R are row numbers of V. The coordinates of the Voronoi vertices bounding a region are V(R{j},:). The Voronoi region associated with the point DT.Points(j) is R{j}.

Examples

expand all

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}
ans =

     1    10     7     4

Examine the coordinates of the Voronoi vertices bounding the region.

V(R{3},:)
ans =

       Inf       Inf
    0.7000   -1.6500
   -0.0500   -0.5250
   -1.7500    0.7500

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

See Also

| | |

Was this topic helpful?