Why aren't some of the lines in my Voronoi diagram displayed?
2 ビュー (過去 30 日間)
古いコメントを表示
Why aren't some of the lines in my Voronoi diagram displayed?
When I try to display my Voronoi diagram, I discovered that there are some pairs of points between which no separation line is drawn. Is this a MATLAB limitation? If so, how can I display all the separation lines? An example which displays this behavior is:
rand('seed',12), xy = rand(2,21);
voronoi(xy(1,:),xy(2,:))
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
Lines which go to infinity are not displayed by MATLAB's VORONOI function. You can correct this by altering those lines by adding some points which are sufficiently far away from the region of interest, then setting the axis limits to hide those additional points. This will avoid interfering with the lines which do display, but will allow the other lines to appear.
In the example above, the region of interest is the area where x is between 0 and 1 inclusive and y is between 0 and 1 inclusive. Therefore, points which are 1 unit away or more will not interfere with the existing lines which do not go to infinity. Open a new figure and execute the following commands:
xy2 = [xy [2;0] [0;2] [-1;0] [0;-1]];
voronoi(xy2(1,:),xy2(2,:))
axis([0 1 0 1])
The points (2, 0), (0, 2), (-1, 0), and (0, -1) are the additional points.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Voronoi Diagram についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!