Google Classroom
GeoGebraGeoGebra Classroom

Rainbow Voronoi on sphere

#======================= # Inspired by Daniel Mentrard #======================= #======================= # Initial values #======================= N = 140 M = Slider(20, N, 1, 1, 160, false, true, false, false) SetValue(M, N) Lm = Sequence(1, 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)) #============================= # List of names for centers and spheres #============================= Sname = Zip("sphere"+Text(m), m, Lm) Pname = Zip("C"+Text(m), m, Lm) #======================= # Points and spheres #======================= Ps = Zip((Px(k), Py(k), Pz(k)), k, Lm) Execute(Zip(name" = Midpoint(Element(Ps, "+k+"), (0,0,0))", name, Pname, k, Lm)) Execute(Zip(name" = Sphere( C"+k+", 1 / 2 )", name, Sname, k, Lm)) Execute(Zip("ShowLabel("+name+", false)", name, Sname)) Execute(Zip("SetDynamicColor("+name+", "+k+"/N, 0.85, 1, 1)", name, Sname, k, Lm)) Execute(Zip("SetConditionToShowObject("+name+", "+k+"<=M)", name, Sname, k, Lm)) #======================= # Settings :-) #======================= SetVisibleInView(M, 1, true) SetVisibleInView(Pname, 1, false) SetVisibleInView(Sname, 1, false) SetVisibleInView(Pname, -1, false) SetVisibleInView(Sname, -1, false) SetVisibleInView(Ps, 1, false) SetPointSize(Ps, 2) SetColor(Ps, "Black") ShowAxes(false) ShowGrid(false) SetBackgroundColor("GAINSBORO")