|MATLAB Function Reference|
Consider a set of coplanar points . For each point in the set , you can draw a boundary enclosing all the intermediate points lying closer to than to other points in the set . Such a boundary is called a Voronoi polygon, and the set of all Voronoi polygons for a given point set is called a Voronoi diagram.
plots the bounded cells of the Voronoi diagram for the points
y. Cells that contain a point at infinity are unbounded and are not plotted.
uses the triangulation
TRI instead of computing it via
plots the diagram with color and line style specified.
h = voronoi(...)
h, handles to the line objects created.
[vx,vy] = voronoi(...)
returns the finite vertices of the Voronoi edges in
vy so that
plot(vx,vy,'-',x,y,'.') creates the Voronoi diagram.
For the topology of the Voronoi diagram, i.e., the vertices for each Voronoi cell, use |
Use one of these methods to plot a Voronoi diagram:
voronoiplots the diagram. See Example 1.
[vx,vy] = voronoi(...). This syntax returns the vertices of the finite Voronoi edges, which you can then plot with the
plotfunction. See Example 2.
n = 2to get the indices of each cell, and then use
patchand other plot functions to generate the figure. Note that
patchdoes not fill unbounded cells with color. See Example 3.
Example 1. This code uses the
voronoi function to plot the Voronoi diagram for 10 randomly generated points.
Example 2. This code uses the vertices of the finiteVoronoi edges to plot the Voronoi diagram for the same 10 points.
Note that you can add this code to get the figure shown in Example 1.
Example 3. This code uses
patch to fill the bounded cells of the same Voronoi diagram with color.
If you supply no triangulation
voronoi function performs a Delaunay triangulation of the data that uses Qhull . This triangulation uses the Qhull joggle option (
'QJ'). For information about Qhull, see http://www.geom.umn.edu/software/qhull/. For copyright information, see http://www.geom.umn.edu/software/download/COPYING.html.
 Barber, C. B., D.P. Dobkin, and H.T. Huhdanpaa, "The Quickhull Algorithm for Convex Hulls," ACM Transactions on Mathematical Software, Vol. 22, No. 4, Dec. 1996, p. 469-483. Available in HTML format at http://www.acm.org/ pubs/citations/journals/toms/1996-22-4/p469-barber/ and in PostScript format at ftp://geom.umn.edu/pub/software/qhull-96.ps.
 National Science and Technology Research Center for Computation and Visualization of Geometric Structures (The Geometry Center), University of Minnesota. 1993.