File Exchange

image thumbnail

Voronoi Sphere

version 1.5.0.4 (34 KB) by Bruno Luong
Compute voronoi's diagram of points on the 2-sphere

4 Downloads

Updated 19 Jul 2018

View License

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 .

Comments and Ratings (16)

Bruno Luong

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

Wenhui Tang

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

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.

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:

P(:,s==0) = AxB(:,s==0)./rssq(AxB(:,s==0));

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.

Bruno Luong

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

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);

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

This is great! Thank you

Bruno Luong

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

Eric

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.

Zejia

Updates

1.5.0.4

France 2018

1.5.0.3

"cAllez les bleus " screenshot

1.5.0.2

Upload right files

1.5.0.1

Upload right source files

1.5.0.0

Can now deal with small (<=3) number of nodes
Robust the solid_angle calculation by making sure the right topology patch

1.4.0.0

Add function to compute solid angles of the voronoi cells

1.3.0.0

New simplified code

1.2.0.0

Change typo in the title

1.1.0.0

Add test file and optimize the code

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux