Skip to content

Miniball method calculates incorrect bounding spheres #179

@janbridley

Description

@janbridley

Description

The minimal algorithm included with python's miniball package often calculates incorrect minimal bounding spheres for polyhedra with augmentations and/or large numbers of vertices. The current standard method of finding the minimal bounding sphere in three dimensions is Gärtner's miniball, which is an extension of Welzl’s algorithm and is written in c++. The package cyminiball (available with python -m pip install cyminiball) directly binds to the original c++ code, which is faster and more stable that the package miniball, which is a pure python implementation of the same algorithm with less stringent checks. This is the underlying issue behind the method as it currently stands, and will be fixed in an upcoming PR.

What about Fischer's exact solver?

There is a better method for calculating minimal bounding spheres, and it is available here. Although referred to as an "exact" solver, the method is not more accurate than Gärtner's implementation in all cases, although Fischer does include a number of internal checks as well as additional code to speed up runtimes. However, it is not currently available as a python package and would require a fair bit of complexity to incorporate into coxeter. For this reason, the fix PR for this will use Gärtner's miniball, and Fischer's algorithm can be revisited at a later date.

Further reading.

To reproduce

  • Local pytest and CircleCI fail when running the test_get_set_minimal_bounding_sphere_radius method on some Johnson solids (see Added new shape families for Archimedean, Catalan, Johnson, and other solids. #177).
  • Running pytest tests/test_polyhedron.py::test_get_set_minimal_bounding_sphere_radius on a branch that includes Johnson solids will easily reproduce these errors.
  • Repeatedly running minimal_bounding_sphere on a highly aspherical mesh and comparing the results between runs will also reproduce this error

Error output

See #177 and #178.

System configuration

  • macOS 13.1 on arm64
  • Python 3.9.15
  • coxeter 0.6.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions