# Voronoi grid on a sphere

If I have a set of points which lie on the unit sphere:

data = Normalize /@ RandomReal[1, {100, 3}]


How do I go about computing Voronoi cells on a sphere? I know that there are algorithms in other languages, but are they difficult to implement in Mathematica?

• See a Wolfram Demonstrations Project here; and this thread might be also useful. Mar 7 '17 at 13:45
• @corey979 I found the Wolfram Demonstration for this, but for the life of me I can't extract the algorithm from it. Mar 7 '17 at 17:16
• @Morgan I believe it uses a Voronoi tesselation in 3D and takes its intersection with the sphere. It is not clear to me if that is the same what one would get when measuring distances along geodesics on the sphere. Mar 9 '17 at 13:07
• This link could be interesting. Mar 29 '17 at 12:53

Here is a modernization of Maxim Rytin's code for generating a spherical Voronoi diagram, as featured in his Wolfram Demonstration:

(* http://mathematica.stackexchange.com/a/10994 *)
arc[center_?VectorQ, {start_?VectorQ, end_?VectorQ}] := Module[{ang, co, r},
ang = VectorAngle[start - center, end - center];
co = Cos[ang/2]; r = EuclideanDistance[center, start];
BSplineCurve[{start, center + r/co Normalize[(start + end)/2 - center], end},
SplineDegree -> 2, SplineKnots -> {0, 0, 0, 1, 1, 1},
SplineWeights -> {1, co, 1}]]

BlockRandom[SeedRandom[0, Method -> "MersenneTwister"]; (* for reproducibility *)
points = {2 π #1, ArcCos[2 #2 - 1]} & @@@ RandomReal[1, {50, 2}];]

sp = Append[Sin[#2] Through[{Cos, Sin}[#1]], Cos[#2]] & @@@ points;
ch = ConvexHullMesh[sp];
verts = MeshCoordinates[ch]; polys = First /@ MeshCells[ch, 2];

voro = Normalize[Cross[verts[[#2]] - verts[[#1]], verts[[#3]] - verts[[#1]]]] & @@@ polys;
edges = arc[{0, 0, 0}, voro[[##]]] & /@
Select[Subsets[Range[Length[polys]], {2}],
Length[Intersection @@ polys[[#]]] >= 2 &];

Graphics3D[{{Opacity[.75], Sphere[]}, {AbsoluteThickness, edges},
{Red, Sphere[sp, 0.02]}}, Boxed -> False] • Very cool. I guess I should use this to do Lebesgue integration on a sphere. Apr 7 '17 at 14:57
• It still has some way to go: I've only determined the edges, but not the spherical polygons that comprise the cells. I don't think I've heard of Voronoi being used for Lebesgue integration. Can you point me to some references I can read? (My interest in this, OTOH, is to eventually write a spherical version of Lloyd's algorithm.) Apr 7 '17 at 17:03
• Please see the section "Algorithm walk through" in this blog post of mine ("Adaptive numerical Lebesgue integration by set measure estimates"). Apr 7 '17 at 19:22