How can I get the area of each polygon of a voronoi diagram?

N
NILESH PANDEY · Mar 23, 2023 · 2.3K views
Question
I need to find areas of all the polygons inside a voronoi diagram and then alot diffrent properties based on different areas. I know the co-ordiantes of all the polygons but cannot distinguish between the ones forming the specific polygon  
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 24, 2026
x = rand(10,1) ;  y = rand(10,1) ;
[v,c] = voronoin([x y]) ;

figure
hold on
voronoi(x,y)
A = zeros(length(c),1) ;
for i = 1:length(c)
    v1 = v(c{i},1) ; 
    v2 = v(c{i},2) ;
    patch(v1,v2,rand(1,3))
    A(i) = polyarea(v1,v2) ;
end

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!