![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175114/image.png)
Voronoi Diagram with Delaunay Triangulation overlay
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sean
el 17 de Jun. de 2014
Comentada: Sean
el 18 de Jun. de 2014
If I have some Voronoi Diagram:
clc
clear all
close all
n=5
x=10*rand(1,n)
y=10*rand(1,n)
voronoi(x,y)
[vx vy] =voronoi(x,y)
close all
plot(x,y,'r+',vx,vy,'b-'); axis equal
figure(2)
for j=1:length(vx(1,:))
line([vx(1,j) vx(2,j)],[vy(1,j) vy(2,j)])
end
axis equal
How can I use the Delaunay Triangulation Matlab program (DelaunayTri) from the points created by the Voronoi Diagram, and to have the circles appear as in the attached link (most left image), or more like the interactions on the top of page 3 from the linked paper Animating Bubble Interactions in a Liquid Foam ? Delaunay Triangulation Image
0 comentarios
Respuesta aceptada
Jason Nicholson
el 17 de Jun. de 2014
Editada: Jason Nicholson
el 17 de Jun. de 2014
Try this:
clc; clear all; close all;
n=5;
x = 10*rand(1, n);
y = 10*rand(1, n);
voronoi(x,y,'--k');
DT = DelaunayTri(x', y');
% use this in newer versions of matlab
% DT = delaunayTriangulation (x, y);
hold all;
triplot(DT,'k-');
[centers, radii] = DT.circumcenters();
theta = -pi:pi/20:pi;
for iCircle=1:size(centers,1)
xCircle = centers(iCircle,1) + radii(iCircle)*cos(theta);
yCircle = centers(iCircle,2) + radii(iCircle)*sin(theta);
plot(xCircle, yCircle, 'b-');
end
plot(x,y,'+k', 'MarkerSize', 12)
axis equal;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175114/image.png)
2 comentarios
Jason Nicholson
el 18 de Jun. de 2014
If this answers your question, please mark this as the correct answer. It helps my reputation points on MATLAB answers.
Más respuestas (0)
Ver también
Categorías
Más información sobre Voronoi Diagram en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!