How to close voronoi shapes?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
clc
clear all
n= 10;
x=10*rand(1,n);
y=10*rand(1,n);
[vx,vy] =voronoi(x,y);
[v,c] = voronoin([x(:) y(:)]);
close all
plot(x,y,'r+',vx,vy,'b-');
axis equal
figure(2)
for j=1:length(vx(1,:))
line([vx(1,j) vx(2,j)],[vy(1,j) vy(2,j)])
end
axis equal
This code plots n points and creates a voronoi diagram based on them, but some of the voronoi cells might not be closed shapes. How can I close them (for example create a line from the shape points to close the shape--attached image is an example of a non closed shape).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164864/image.gif)
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Voronoi Diagram in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!