how to bound voronoi polygons
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Bruno Luong
2022-8-1
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 个评论
Bruno Luong
2022-8-1
Click on the link on polyshape I give above. Mostly you construct the object by giving the vertices coordinates.
另请参阅
类别
在 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!