Borrar filtros
Borrar filtros

how to bound voronoi polygons

14 visualizaciones (últimos 30 días)
Mukesh Singh Bisht
Mukesh Singh Bisht el 1 de Ag. de 2022
Comentada: Bruno Luong el 1 de Ag. de 2022
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

Respuestas (1)

Bruno Luong
Bruno Luong el 1 de Ag. de 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 comentarios
Mukesh Singh Bisht
Mukesh Singh Bisht el 1 de Ag. de 2022
How can I convert the voronoi cells to polyshape obejct?
Bruno Luong
Bruno Luong el 1 de Ag. de 2022
Click on the link on polyshape I give above. Mostly you construct the object by giving the vertices coordinates.

Iniciar sesión para comentar.

Categorías

Más información sobre Voronoi Diagram en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by