voronoin
Voronoi vertices and cells for points in n dimensions.
Category: Mathematics > Computational Geometry
Syntax
[V, C] = voronoin(X)
Returns the Voronoi vertices V and a cell array C of the cells for the points X.
Description
Each cell holds the indices of the vertices of the Voronoi region around one input point. If the region is unbounded, its list contains 1, which refers to the infinite vertex in the first row of V. Only cells without 1 are closed polygons.
In the example below, the four corner points have unbounded cells, while the central point has a bounded cell made from the four finite vertices.
Input arguments
X- m-by-n matrix with one point per row.
Output arguments
V- Voronoi vertices, one per row. The first row is all
Inf. C- Cell array.
C{k}lists the rows ofVthat form the cell of pointX(k,:).
Example
Voronoi cells of five points
X = [0 0; 1 0; 1 1; 0 1; 0.5 0.5];
[V, C] = voronoin(X);
V
C{5}
Output
V = 5×2
Inf Inf
1.0000 0.5000
0.5000 0
0 0.5000
0.5000 1.0000
ans = 1×4
2 3 4 5