Port of C++ algorithm to Python for finding smallest enclosing sphere of spheres. Library documentation avaliable here For further information about the problem I recommend reading thesis by Kaspar Fisher.
import random
import minball
spheres = []
for _ in range(10):
center = [random.random() * 10, random.random() * 10]
radius = random.random() * 5
spheres.append(minball.Sphere2D(center, radius))
min_sphere = minball.get_min_sphere2D(spheres)
print(min_sphere.radius, min_sphere.center)
Dimensions 1D-4D are provided out of the box. If other dimensions are needed, simply head to include/minball_py.hpp, change the range and recompile.
CGAL (For Ubuntu should be sufficient to do sudo apt-get install libcgal-dev
)
gcc
or clang
(gcc is default)
make setup && make