MATLAB Function Reference | ![]() ![]() |
Syntax
voronoi(x,y) voronoi(x,y,TRI) h = voronoi(...,'LineSpec') [vx,vy] = voronoi(...)
Definition
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.
Description
voronoi(x,y)
plots the Voronoi diagram for the points x
,y
.
voronoi(x,y,TRI)
uses the triangulation TRI
instead of computing it via delaunay
.
h = voronoi(...,'LineSpec')
plots the diagram with color and line style specified and returns handles to the line objects created in h
.
[vx,vy] = voronoi(...)
returns the vertices of the Voronoi edges in vx
and vy
so that plot(vx,vy,'-',x,y,'.')
creates the Voronoi diagram.
Examples
This code plots the Voronoi diagram for 10 randomly generated points.
rand('state',0); x = rand(1,10); y = rand(1,10); [vx, vy] = voronoi(x,y); plot(x,y,'r+',vx,vy,'b-'); axis equal
See Also
convhull
, delaunay
, dsearch
, trimesh
, trisurf
, voronoin
![]() | volumebounds | voronoin | ![]() |