记忆过往
总有一个人需要这些知识。本博客信息正在迁往
/
[置顶] matble中生成Voronoi图
分类: Voronoi 2012-02-16 14:38 3733人阅读评论(1) 收藏举报
plotpatchpropertiesmethodseachoutput
Definitions
Consider a set of coplanar points . For each point P in thPe set , you can drxaw a boundarPy
enclosing all the intermediate points lying closer to than to other points in Ptxhe set . Such a P
boundary is called a , and the setV oorfo naolil pVoolryognooni polygons for a given point set is
called a . Voronoi diagram
Visualization
Use one of these methods to plot a Voronoi diagram:
If you provide no output argument, voronoi plots the
diagram.
To gain more control over color, line style, and other
figure properties, use the syntax [vx,vy] = voronoi(...). This syntax returns the vertices of the
finite Voronoi edges, which you can then plot with the plot function.
To fill the cells with color, use voronoin with n = 2 to
get the indices of each cell, and then use patch and other plot functions to generate the figure.
Note that patch does not fill unbounded cells with color.
Examples
Example 1
This code uses the voronoi function to plot the Voronoi diagram for 10 randomly generated points.
x = gallery('uniformdata',[1 10],0);
y = gallery('uniformdata',[1 10],1);
voronoi(x,y)
Example 2
This code uses the vertices of the fi
matble中生成Voronoi图 来自淘豆网m.daumloan.com转载请标明出处.