# Bounding sphere

In mathematics, given a non-empty set of objects of finite extension in n-dimensional space, for example a set of points, a bounding sphere, enclosing sphere or enclosing ball for that set is an n-dimensional solid sphere containing all of these objects.

In the plane the terms bounding or enclosing circle are used.

Used in computer graphics and computational geometry, a bounding sphere is a special type of bounding volume. There are several fast and simple bounding sphere construction algorithms with a high practical value in real-time computer graphics applications.[1]

In statistics and operations research, the objects are typically points, and generally the sphere of interest is the minimal bounding sphere, that is, the sphere with minimal radius among all bounding spheres. It may be proven that such a sphere is unique: If there are two of them, then the objects in question lie within their intersection. But an intersection of two non-coinciding spheres of equal radius is contained in a sphere of smaller radius.

The problem of computing the center of a minimal bounding sphere is also known as the "unweighted Euclidean 1-center problem".

## Applications

### Clustering

Such spheres are useful in clustering, where groups of similar data points are classified together.

In statistical analysis the scattering of data points within a sphere may be attributed to measurement error or natural (usually thermal) processes, in which case the cluster represents a perturbation of an ideal point. In some circumstances this ideal point may be used as a substitute for the points in the cluster, advantageous in reducing calculation time.

In operations research the clustering of values to an ideal point may also be used to reduce the number of inputs in order to obtain approximate values for NP-hard problems in a reasonable time. The point chosen is not usually the center of the sphere, as this can be biased by outliers, but instead some form of average location such as a least squares point is computed to represent the cluster.

## Algorithms

There are exact and approximate algorithms for solving bounding sphere problem.

### Ritter's bounding sphere

In 1990, Jack Ritter proposed a simple algorithm to find a bounding sphere.[2] It's widely used in various applications for its simplicity. The algorithm works in this way:

1. Pick a point x from P, search a point y in P, which has the largest distance from x;

2. Search a point z in P, which has the largest distance from y. set up an initial ball B, with its centre as the midpoint of y and z, the radius as half of the distance between y and z;

3. If all points in P are within ball B, then we get a bounding sphere. Otherwise, let p be the point outside the ball, construct a new ball covering both point p and previous ball. Repeat this step until all points are covered.

Ritter's algorithm obviously runs in time O(nd), which makes it very efficient. However it gives only a coarse result which is usually 5%~20% larger than the optimum.[3]

### Linear programming

In 1983, Nimrod Megiddo proposed a "prune and search" algorithm which runs in linear time if the dimension is fixed as a constant. When dimension is taken into account, the execution time complexity is O((d+1)(d+1)!n), thus is impractical for high-dimensional applications. Megiddo used this approach to solve linear programming in linear time when dimension is fixed.

In 1991, Emo Welzl proposed a much simpler randomized algorithm based in the extension of R. Seidel randomized linear programming algorithm. It runs in expected linear time and provided experimental results demonstrating its practicality in higher dimensions.[4]

The open-source Computational Geometry Algorithms Library (CGAL) contains an implementation of this algorithm.[5]

### Core-set based 1+ε approximation

Bădoiu et al. presented a 1+ε approximation on bounding sphere problem.[6] Where 1+ε approximation means that although a sphere with radius r can not cover the whole point set, the sphere with radius (1+ε)r can cover all points.

"Core set" is a small subset, that a 1+ε expansion of the solution on the subset is a bounding sphere of the whole set. The core set is constructed incrementally by adding the farthest point into the set in iteration.

Kumar et al. improved this approximation algorithm [7] so that it runs in time $O(\frac{nd}{\epsilon}+ \frac{1}{\epsilon^{4.5}}\log{\frac{1}{\epsilon}})$.

### Fischer's Exact Solver

Fischer et al. proposed an exact solver to this minimal enclosing ball problem.[8] The algorithm starts with a big ball that covers all points and gradually shrink it until it can not be shrunk further. In practice, the algorithm is very efficient in low and moderately low (up to 10,000, say) dimensions and is not known to exhibit numerical stability problems. A C++ implementation of the algorithm is available as an open-source project.

### Bouncing Bubble

Bouncing Bubble is an approximation algorithm to the minimal enclosing ball problem.[3] It has a few variants for different purpose. The simplest variant runs in time O(nd) with error around 1%~2% is recommended as a substitution of Ritter's algorithm. A simple 1+ε approximation that runs in $O(\frac {nd}{\epsilon^2} )$ is recommended for lower precision applications (say ε>10−3). And another 1+ε approximation that runs in $O(nd)+O(\frac{d}{\epsilon^2})$ is recommended for higher precision applications.

The basic idea of this algorithm is simple: each time a point outside the ball is found, the ball will be moved towards it and increase the radius at the same time. The growth in each step is designed so that it will not exceed the optimum radius, thus the radius is getting closer and closer to the optimum.

The following animation demonstrates the process of the first variant: