Voronoi diagram on sphere
#=======================
# Inspired by Daniel Mentrard
#=======================
#=======================
# Initial values
#=======================
N = 200
M = Slider(0, N, 1, 1, 160, false, true, false, false)
SetValue(M, N)
Lm = Sequence(0, M)
speed = 0.001
a = Slider(0, 6.2812, 0.001, speed, 130, false, true, false, false)
SetValue(a, 1 / 2 + sqrt(5) / 2)
#=======================
# Functions
#=======================
Px(x) = cos(pi * 2 * a * x) * sin(acos(1 - 2 * x / M))
Py(x) = sin(pi * 2 * a * x ) * sin(acos(1 - 2 * x / M))
Pz(x) = cos(acos(1 - 2 * x / M))
#=======================
# Points and spheres
#=======================
Ps = Zip((Px(k), Py(k), Pz(k)), k, Lm)
Ss = Zip(Sphere(1 / 2 * P, 1 / 2), P, Ps)
#=======================
# Settings :-)
#=======================
SetVisibleInView(Ps, 1, false)
SetPointSize(Ps, 2)
SetColor(Ps, "Black")
SetColor(Ss, "GAINSBORO")
SetFilling(Ss, 1)
ShowAxes(false)
ShowGrid(false)
SetBackgroundColor("GAINSBORO")