File Exchange

## Voronoi Sphere

version 1.5.0.4 (34 KB) by Bruno Luong

### Bruno Luong (view profile)

Compute voronoi's diagram of points on the 2-sphere

Updated 19 Jul 2018

Return diagram as list of vertices, index of spherical polygons, and discretized polygons

### Cite As

Bruno Luong (2020). Voronoi Sphere (https://www.mathworks.com/matlabcentral/fileexchange/40989-voronoi-sphere), MATLAB Central File Exchange. Retrieved .

Bruno Luong

### Bruno Luong (view profile)

Wenhui, can you send me your input data that trigger this error?

Wenhui Tang

### Wenhui Tang (view profile)

Hi, sometimes I get the error like this but sometimes not. My input is a series of carries with the unit length.

Brace indexing is not supported for variables of this type.

Error in voronoisphere>cycling_edge (line 164)
K = [K{:}];

Error in voronoisphere (line 102)
v = cycling_edge(edgeofcell{j}, vid);

jiajia li

jiajia li

Jeff

### Jeff (view profile)

I would like a better understanding of how the Center function works. Is there any documentation of how A, B and C are defined, and perhaps a sketch of the trigonometry used to calculate the centers.

Martin Herrerias Azcue

### Martin Herrerias Azcue (view profile)

Working great on 2017b, thanks!

One small issue: when three or more points happen to fall on the same great-arc (e.g. I am using the function on a hemispherical dome with several points around the base), the center of those Delaunay-triangles is actually the center of the sphere, and should be 'pushed' to the surface. To fix it, at the end of the 'Center' function I added:

This includes also the possibility that several triangles can share the same center, so I had to filter the calculated set of centers, and eliminate the degenerate edges:
...
k = [k{:}];
vid = allids(k.');

% Center of the circumscribed Delaunay triangles
V = Center(xyz, T);

% Check that triangle centers do not match (e.g. two triangles on same great-arc)
[~,ia,ic] = unique(V','rows');
if numel(ia) ~= numel(ic)
V = V(:,ia);
vid = ic(vid);
degenerate = vid(:,1) == vid(:,2);
vid = vid(~degenerate,:);
k = k(:,~degenerate);
end

% each row is 2 cell ids of the edge
cellofedge = E(k(1,:),:); % ne x 2
....

With these changes I get beautiful beach-ball-like divisions on the half of the dome with no points.

Wenjia Zhang

Bruno Luong

### Bruno Luong (view profile)

Make quick test, still working on R2017a contrary to Garrett's claim

Garrett Good

### Garrett Good (view profile)

No longer works:

Cell contents reference from a non-cell array object.

Error in voronoisphere>cycling_edge (line 164)
K = [K{:}];

Error in voronoisphere (line 102)
v = cycling_edge(edgeofcell{k}, vid);

Ederson Costa

### Ederson Costa (view profile)

I would like to get figure 10.gif from

http://www-wales.ch.cam.ac.uk/~wales/CCD/Thomson/table.html

but I'm getting two square faces and not one as on the site. I use 10.xyz for xyz data.
Why?

Eric

### Eric (view profile)

This is great! Thank you

Bruno Luong

### Bruno Luong (view profile)

To Eric: the output (K) _is_ sorted as the input seeds.

Eric

### Eric (view profile)

This is great. Is it possible to re-sort the output so that it preserves the order of the input? I am trying to apply specific individual patch colors.

Alphan Sahin

Zejia

Felipe Pedreros