-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdemo.m
More file actions
31 lines (27 loc) · 759 Bytes
/
Copy pathdemo.m
File metadata and controls
31 lines (27 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
load sphere.mat
% radius === 0, voronoi diagram
pd0 = spherical_power_diagram(vertex);
% generate some random radius
% radius should be too large, or some cell may vanish
radius = rand(size(vertex,1),1)*0.15;
pd = spherical_power_diagram(vertex,radius);
% plot
figure('Position',[580 400 880 400]);
subplot(1,2,1)
trimesh(face,vertex(:,1),vertex(:,2),vertex(:,3),'EdgeColor',[36 169 225]/255)
hold on
plot_power_diagram(pd0);
title('voronoi diagram')
view(0,0)
axis([-1.1 1.1 -1.1 1.1 -1 1.1])
axis equal
axis off
subplot(1,2,2)
trimesh(face,vertex(:,1),vertex(:,2),vertex(:,3),'EdgeColor',[36 169 225]/255)
hold on
plot_power_diagram(pd);
title('power diagram')
view(0,0)
axis([-1.1 1.1 -1.1 1.1 -1 1.1])
axis equal
axis off