Function Repository Resource:

SphericalVoronoiDiagram

Source Notebook

Show the spherical Voronoi diagram of a set of points on a sphere

Contributed by: Jan Mangaldan

ResourceFunction["SphericalVoronoiDiagram"][{p1,,pn}]

generates a three-dimensional plot representing the spherical Voronoi diagram of the points pi.

Details and Options

The points pi are assumed to lie in a unit sphere centered at the origin.
ResourceFunction["SphericalVoronoiDiagram"] takes the same options as Graphics3D, with the following additions and changes:
BoxedFalsewhether to draw the bounding box
EdgeStyleAutomaticgraphics directives to specify the style for the edges
"PointStyle"Automaticgraphics directives to specify the style for the generating points
"ShowOriginalPoints"Falsewhether to show the generating points
"SphereStyle"Automaticgraphics directives to specify the style for the sphere

Examples

Basic Examples (1) 

Spherical Voronoi diagram of the result of SpherePoints:

In[1]:=
ResourceFunction["SphericalVoronoiDiagram"][SpherePoints[6]]
Out[1]=

Scope (2) 

Spherical Voronoi diagram of two and three points:

In[2]:=
ResourceFunction["SphericalVoronoiDiagram"][#, "ShowOriginalPoints" -> True] & /@ {{{1, 0, 0}, Insert[AngleVector[\[Pi]/6], 0, 2]}, PadRight[CirclePoints[Sin[\[Pi]/4], 3], {3, 3}, Cos[\[Pi]/4]]}
Out[2]=

Spherical Voronoi diagram of randomly generated points:

In[3]:=
ResourceFunction["SphericalVoronoiDiagram"][RandomPoint[Sphere[], 88],
  "ShowOriginalPoints" -> True]
Out[3]=

Options (4) 

EdgeStyle (1) 

Change the style of the edges:

In[4]:=
ResourceFunction["SphericalVoronoiDiagram"][SpherePoints[10], EdgeStyle -> Directive[Thick, Green]]
Out[4]=

PointStyle (1) 

Change the style of the generating points:

In[5]:=
ResourceFunction["SphericalVoronoiDiagram"][SpherePoints[10], "PointStyle" -> Directive[AbsolutePointSize[8], Blue], "ShowOriginalPoints" -> True]
Out[5]=

ShowOriginalPoints (1) 

Show the spherical Voronoi diagram with and without the generating points:

In[6]:=
ResourceFunction["SphericalVoronoiDiagram"][SpherePoints[10], PlotLabel -> #, "ShowOriginalPoints" -> #] & /@ {True, False}
Out[6]=

SphereStyle (1) 

Change the style of the sphere:

In[7]:=
ResourceFunction["SphericalVoronoiDiagram"][SpherePoints[10], "SphereStyle" -> Directive[Specularity[1, 10], Orange]]
Out[7]=

Applications (2) 

Use tubes and spheres to render the spherical Voronoi diagram and its generating points:

In[8]:=
ResourceFunction["SphericalVoronoiDiagram"][RandomPoint[Sphere[], 88],
   EdgeStyle -> Green, "PointStyle" -> Brown, "ShowOriginalPoints" -> True] /. {b_BSplineCurve :> Tube[b], Point[p_] :> Sphere[p, 0.02]}
Out[8]=

Locations of the state capitals of the contiguous United States:

In[9]:=
stateCapitals = {Cos[#1] Cos[#2 - \[Pi]], Cos[#1] Sin[#2 - \[Pi]], Sin[#1]} & @@@ QuantityMagnitude[
   UnitConvert[
    LatitudeLongitude[
     GeoPosition[
      EntityClass["AdministrativeDivision", "ContinentalUSStates"][
       EntityProperty["AdministrativeDivision", "CapitalCity"]]]], "Radians"]]
Out[9]=

Display them in a spherical Voronoi diagram:

In[10]:=
Show[ResourceFunction["GeoGraphics3D"][{}, GeoBackground -> "ReliefMap"], DeleteCases[
  ResourceFunction["SphericalVoronoiDiagram"][stateCapitals, EdgeStyle -> Directive[Blue, AbsoluteThickness[3]], "PointStyle" -> Directive[Red, AbsolutePointSize[6]], "ShowOriginalPoints" -> True], _Sphere, \[Infinity]], Lighting -> "Neutral"]
Out[10]=

Neat Examples (1) 

Spherical Voronoi diagram of the vertices of a pentakis dodecahedron:

In[11]:=
ResourceFunction["SphericalVoronoiDiagram"][
 Normalize /@ N[PolyhedronData["PentakisDodecahedron", "VertexCoordinates"]]]
Out[11]=

Version History

  • 1.0.0 – 14 June 2021

Source Metadata

Related Resources

Author Notes

Support for spheres with different radii and centers will be added in a future version.

License Information