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!