# voronoiDiagram

Voronoi diagram of Delaunay triangulation

## Syntax

``````[V,r] = voronoiDiagram(DT)``````

## Description

example

``````[V,r] = voronoiDiagram(DT)``` returns the Voronoi vertices `V` and the Voronoi regions `r` of the points in a Delaunay triangulation. Each region in `r` represents the points surrounding a triangulation vertex that are closer to that vertex than any other vertex in the triangulation. The collection of Voronoi regions make up a Voronoi diagram.```

## Examples

collapse all

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}`
```ans = 1×4 1 10 7 4 ```

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},:)`
```ans = 4×2 Inf Inf 0.7000 -1.6500 -0.0500 -0.5250 -1.7500 0.7500 ```

## Input Arguments

collapse all

Delaunay triangulation, specified as a scalar `delaunayTriangulation` object.

Data Types: `delaunayTriangulation`

## Output Arguments

collapse all

Voronoi vertices, returned as a 2-column matrix (2-D) or a 3-column matrix (3-D). Each row of `V` contains the coordinates of a Voronoi vertex.

The Voronoi regions associated with points that lie on the convex hull of the triangulation vertices are unbounded. Bounding edges of these regions radiate to infinity. The first vertex in `V` represents the vertex at infinity and is designated with `Inf`.

Data Types: `double`

Voronoi regions, returned as a cell array whose elements contain the connectivity of the Voronoi vertices in `V`. The points in each row of `r` form the bounding region associated with the corresponding row in the `Points` property.

Data Types: `double`