voronoi

Computes or plots the Voronoi diagram of 2-D points.

Category: Mathematics > Computational Geometry

Syntax

voronoi(x, y)

Plots the Voronoi diagram of the points (x, y).

[vx, vy] = voronoi(x, y)

Returns the edges of the diagram as two matrices instead of plotting.

Description

The Voronoi cell of a point is the region of the plane closer to that point than to any other. voronoi finds the shared boundaries between these cells. They are dual to the Delaunay triangulation: the Voronoi vertices are the circumcenters of the Delaunay triangles.

For cell-by-cell information (vertices of each cell), use voronoin or voronoiDiagram.

Input arguments

x, y
Vectors with the coordinates of the generating points.

Output arguments

vx, vy
Each column describes one edge: the first row holds the start, the second the end of the edge. Edges that go to infinity are clipped to a finite length.

Example

Edges of a Voronoi diagram

x = [0 1 0 1 0.5];
y = [0 0 1 1 0.5];
[vx, vy] = voronoi(x, y);
disp(size(vx))
Output
     2     8

See also

voronoin voronoiDiagram delaunay triplot