Techniqueadvanced
Simulation of simplicity
Also called symbolic perturbation.
Edelsbrunner and Mucke's rule that moves each input coordinate by a power of an infinitesimal, so every predicate sign is nonzero and consistent and algorithms may assume general position.
Simulation of simplicity (SoS) is a technique of Edelsbrunner and Mücke that removes the degenerate cases of a geometric algorithm without writing code for them. It moves the -th coordinate of the -th input point by , where is an infinitesimal, and it evaluates each predicate on the moved input. The sign of a moved predicate is never zero, and it is the sign of the first nonzero number in a fixed list of minors of the original input, so it costs only a few extra exact evaluations. All the answers come from one real input in general position, so an algorithm proved for general position is correct on them, but its output is the output for the moved input, and the caller must remove the zero-size parts.
In plain words
Many geometric programs are correct only when nothing lines up: no three points on one line, no two points with the same x. Real models line up all the time, and writing a special case for each way of lining up is long and easy to get wrong.
This technique pretends that each point was pushed by a tiny amount, with a different and much smaller push for each later point. Then nothing lines up any more. The trick is that the program never computes the pushed points. When a test comes out exactly zero, a short fixed list of extra tests on the original numbers says which way the push breaks the tie.
All tie breaks come from one pushed input, so they never contradict each other. The cost is that the answer describes the pushed input, so a flat triangle can appear and must be removed afterward.
When it applies
- The predicates are signs of polynomials in the input coordinates. Orientation, in-circle and in-sphere tests are determinants of the input. A predicate on a constructed point, such as the side of the crossing point of two lines, is a rational function of the input. SoS can handle it only if it is written in terms of the original coordinates, and the list of extra terms grows.
- The algorithm is correct for general position. SoS does not change the algorithm. It changes the predicates so that the general position proof applies.
- The predicates are evaluated exactly. The tie break is chosen when the exact value is . A rounded value that is for a nonzero input, or nonzero for a zero input, gives a wrong tie break. So SoS sits on top of exact or filtered arithmetic, as in exact geometric computation, and it does not replace it.
- The output for a nearby input is acceptable. The result is the exact result for the moved input. It is combinatorially close to a correct result for the real input, but it can contain parts of zero length, area or volume.
How it differs from the two pages it is close to: the geometric robustness problem is the failure that rounding causes, and SoS does not address rounding at all. Exact geometric computation makes every sign exact, including the zero signs. SoS takes those exact zero signs and turns them into consistent nonzero signs.
The template
Index the input points and their coordinates . Replace coordinate by
A predicate is the sign of a polynomial in the coordinates. Expand as a polynomial in and order its terms by increasing exponent. The perturbed sign is the sign of the lowest nonzero term, which is the sign of for every small enough .
SOS-SIGN(f, input) ▷ general form- 1
v ← f(input), evaluated exactly - 2
if v ≠ 0 then return sign(v) - 3
for each set S of perturbed coordinates, in increasing order of Σ_{(i,j) ∈ S} 2^{id−j} do - 4
c ← coefficient of Π_{(i,j) ∈ S} ε^{2^{id−j}} in f(p(ε)), a polynomial in the input - 5
if c ≠ 0 then return sign(c) - 6
▷ not reached for a nonzero f of degree at least 1 in each point ORIENT2D-SOS(P, i, j, k) ▷ the plane, d = 2- 7
sort (i, j, k) increasingly to (a, b, c); s ← sign of the sorting permutation - 8
for v in D(p_a, p_b, p_c), x_c − x_b, y_b − y_c, x_a − x_c do - 9
if v ≠ 0 then return s · sign(v) - 10
return s
Here is the orientation test, positive for a left turn.
Why the sign is never zero and is well defined. A monomial of that takes the perturbation from a set of coordinates has the exponent . The numbers are distinct for distinct pairs , so by the uniqueness of binary expansions, distinct sets give distinct exponents. Hence the coefficient of each power of belongs to one set , and it is the partial derivative of with respect to the coordinates in , a minor of the input when is a determinant. For the orientation determinant with a column of ones, taking the perturbation of from one row and of from another gives a coefficient , so some coefficient is a nonzero constant and the loop of L3 always returns.
Why the answers are consistent. An algorithm evaluates finitely many predicates. Each has a fixed sign on an interval , and the minimum of the is positive. For any below that minimum, every answer of SOS-SIGN is the exact sign of the predicate on one real input , and that input is in general position for all the predicates. So the answers obey every law that exact signs on a real input obey, and the general position proof of the algorithm applies to them.
The plane. For the point moves by . For , the exponents of the first terms of the moved , with , are , , , , : the input , then the moves of , and alone, then the product of the moves of and , whose coefficient is . Their coefficients are the four values of L8 and the constant of L10. For other indices the exponents differ, but the order of the five terms is the same. A permutation of the three rows multiplies the determinant by its sign, which is L7. This list was checked against the moved determinant computed with in exact rational arithmetic, for all ordered triples of 400 random sets of 5 points in .
Cost. L1 is the predicate itself. In the plane the other four values are differences of coordinates, so a degenerate case costs a few subtractions more. In higher dimensions the list of minors is longer, but the loop stops at the first nonzero term, which on most degenerate inputs is one of the first few.
Example. The values below are from ORIENT2D-SOS.
| index : point | call | first nonzero value | result |
|---|---|---|---|
| 1 : , 2 : , 3 : | , | , left turn | |
| same | the same value, odd permutation | ||
| same | the same value, odd permutation | ||
| 1 : , 2 : , 3 : | , | ||
| 1 : , 2 : , 3 : | , | ||
| 1, 2, 3 all at | all four are |
The three collinear points of the first row become a very thin left-turning triangle. The calls , and all give , and the odd orders all give , which is what three real points in a triangle give. The duplicate points of the fifth row become two distinct points, and even three equal points get an orientation.
Classic examples
- Comparisons in one dimension. With , point moves by , so a lower index gets a larger move. Two equal keys compare by index: with gives . This is the common tie break by position, and it is the simplest case of the scheme. Sweeps use it to give distinct event times (degeneracy in sweeps).
- Convex hulls and Delaunay triangulations. Edelsbrunner and Mücke apply SoS to the orientation and in-sphere determinants, so that hull and Delaunay programs never see coplanar or cospherical points. A Delaunay program then returns a triangulation of four cocircular points, and the choice between the two diagonals depends on the indices only (general position for Delaunay).
- Boolean operations and ray casting. In CSG ray casting and boundary evaluation, a ray in a face plane and a face in the plane of another face are degenerate cases. A perturbation of the solids makes the tests nonzero, but see the first pitfall below.
Variations
- Other orders of the infinitesimals. Any assignment of exponents that keeps the sets in distinct orders works, with the same proof. The powers of 2 are the simplest. Seidel describes what any scheme of this kind guarantees and what it costs, and compares several schemes from the literature.
- Perturbation of the parameters only. For a predicate that depends on a few parameters, such as the heights of a lifting map, it is enough to move those parameters. The extra terms are then fewer.
- Lazy evaluation. Compute the extra terms of L3 only when the exact value is zero, and in the same exact arithmetic. With a floating-point filter in front, the extra terms cost nothing on inputs without degeneracies.
Pitfalls
- Degenerate output and regularized sets. SoS answers for the moved input, not the real one. A collinear triple becomes a triangle of area . Two cubes that share a face are moved either into a thin overlap or apart by a thin gap, and the result of a union is then one solid with a face pair of zero distance or two solids. The regularized set operations give a different answer: the closed union is one cube, and the shared face is not on its boundary. The caller must remove these zero-size parts after the algorithm, and Seidel points out that this step is not always simple.
- Rounded input to the tie break. SoS needs the exact sign of and of each minor. A float that is for an input that is not degenerate makes SoS break a tie that does not exist, so the answer can disagree with an exact answer on another call. Use exact or filtered predicates.
- The order of the indices matters. The result depends on how the points are numbered. Two runs on the same set in a different order can give combinatorially different outputs, both correct for their own moved input. Tests must compare structures that do not depend on the order, such as the area or the volume.
- Constructed points. A predicate on an intersection point is a rational function of the input. Moving the intersection point by its own infinitesimal breaks the consistency with the lines it came from. The move must be derived from the moves of the original coordinates.
- Different predicates in one program. All predicates must use the same moved input. A program that breaks ties of the orientation test with SoS and ties of a distance comparison by another rule loses the consistency.
Exercises
- Show that for and , the coefficient of the move of in the moved determinant is , and the coefficient of the move of is .
- Prove that the five exponents of the plane case are in the same order for every , and that no other term comes before the constant term.
- Give a set of four points with integer coordinates and indices for which the planar convex hull under SoS has a vertex of angle , and say which post-processing removes it.
- Derive the extra terms of a one-dimensional test "is " under SoS with .
- Two unit squares share an edge. Describe the union that a planar Boolean operation with SoS returns, and the post-processing step that turns it into the regularized union.
References
- Herbert Edelsbrunner and Ernst Peter Mücke, Simulation of Simplicity, a technique to cope with degenerate cases in geometric algorithms, ACM Transactions on Graphics 9(1), 66 to 104, 1990, the whole paper (the perturbation of the coordinates by powers of one infinitesimal, the sign of a perturbed determinant as the first nonzero minor in a fixed order, and the orientation and in-sphere tests; section numbers not checked)
- Raimund Seidel, The nature and meaning of perturbations in geometric computing, Discrete and Computational Geometry 19(1), 1 to 17, 1998, the whole paper (what a perturbation scheme guarantees, the cost of output degeneracies, and a comparison of schemes)
- Chee K. Yap, Towards exact geometric computation, Computational Geometry 7(1-2), 3 to 23, 1997, the discussion of degeneracies and of perturbation as a part of exact geometric computation
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag VE7685 Edit this page History Report an error Markdown