Why aren't some of the lines in my Voronoi diagram displayed?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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,:))
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Voronoi Diagram finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!