how to bound voronoi polygons
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi.
I have a set of data points inside a circle of given radius and I am trying to form the closed Voronoi polygons for each data point and then calculate the area of polygon so formed. The problem is with the outermost points. For these points, the voronoi polygon so formed are not bounded or in some case the polygon goes beyond the circle. How can I form a closed polygon for these outermost point? Please help
PS: I have attached the data set and the figures (Fig 1 & Fig 2)showing the voronoi polygons for this data set. The radius of circle is 3 unit. Fig 1 shows only the voronoi polygons and Fig 2 shows the corresponding location of data points over the voronoi polygon
Code:
X = xlsread('Data.xlsx', 'Sheet1','A2:A1823');
Y = xlsread('Data.xlsx', 'Sheet1','B2:B1823');
% Voronoi polygon area
[vv,cc] = voronoin([X Y]);
Ar = zeros(length(cc),1) ; % area
for i = 1:length(cc)
v1 = vv(cc{i},1); v2 = vv(cc{i},2);
patch(v1,v2,rand(1,3))
Ar(i) = polyarea(v1,v2);
end
0 commentaires
Réponses (1)
Bruno Luong
le 1 Août 2022
Transform the voronoi cells to polyshape object, you can then make the intersection of the region you want to use to clip (the big circle).
2 commentaires
Bruno Luong
le 1 Août 2022
Click on the link on polyshape I give above. Mostly you construct the object by giving the vertices coordinates.
Voir également
Catégories
En savoir plus sur Voronoi Diagram dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!