|
Welzl's Minimum Sphere Algorithm Demystified
The update processUp until now we've been discussing the algorithm but assumed the update process gives the smallest enclosing sphere from the points in the set plus the new point P that was added to the set. The update process attempts to find the smallest sphere by computing all combinations of spheres possible from the set plus the new point P, now a new set. Depending on the number of points in the set, the possible permutations for a 2D circle are (assuming the points in the set are p0, p1…):
Once a new optimal sphere is found from the new set of points it also uniquely determines which points should be removed from the set because they are no longer on the perimeter of the sphere – thus not support points. For example, assume the set has three points when P is added to it. There are effectively four points to use for a total of 6 possible circles. Let's also assume that the optimal sphere out of the 6 spheres is the first permutation defined by (p0, P), where P is p3 (the set contains p0, p1, p2 and the new p3). The new set should then become (p0, p3 = P) since the sphere was found to be defined by two points and the permutation is (p0, p3). The set is resized to a size of 2 and since p0 was already there, p3 replaces the other point that is in the set. In the same manner it is easy to understand the rest of the permutations, which points should be in the updated support set and which are removed. The only problem left to solve is how to generate a sphere/circle from a given amount of input points. Our initial condition requires us to use one point (the set will initially contain one point). The permutations given above suggest we need a way to define spheres from two points and even three points. Generating a sphere from a set of pointsIn this section I'll briefly describe the possible ways to create a sphere based on a number of points. As shown earlier we need functions to create a sphere from one, two and three input points (as well as four in 3D). These can be implemented by constructors of a sphere class or update functions to an existing sphere (to save object construction destruction). Depending on the number of points these are the steps used to create the sphere:
|