Intersection of voronoi edges and a rectangle
Ältere Kommentare anzeigen
This code generates a Voronoi plot with n random points, and a rectangle containing each closed Voronoi cell. How can I find the intersection points between the rectangle, and the voronoi edges (edges generated in figure 2)?
clc
clear all
n= 10;
x=10*rand(1,n);
y=10*rand(1,n);
h=voronoi(x,y);
[vx,vy] =voronoi(x,y);
[v,c] = voronoin([x(:) y(:)]);
close all
plot(x,y,'r+',vx,vy,'b-');
rectangle('Position',[0,0,12,12]);
axis equal
figure(2)
for j=1:length(vx(1,:))
line([vx(1,j) vx(2,j)],[vy(1,j) vy(2,j)])
rectangle('Position',[0,0,12,12]);
end
axis equal
2 Kommentare
THERESA NYOROH
am 6 Nov. 2019
Bearbeitet: THERESA NYOROH
am 6 Nov. 2019
Hello everyone, Mine is a question I need the syntax for constructing a voronoi diagram showing the values of its vertices as well as calculating the Euclidean distance and the voronoi circle.pls, I'm really in need of this code with an explanation of what each line of code does. Thanks
Bruno Lopes
am 20 Feb. 2022
You can use this code: https://it.mathworks.com/matlabcentral/fileexchange/34428-voronoilimit-varargin
It is the best I found on the internet.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Voronoi Diagrams finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!