Skip to content

Full simulation-of-simplicity semantics for degenerate inSphere configurations - #6600

Open
Fedr wants to merge 2 commits into
masterfrom
inSphereFullSos
Open

Full simulation-of-simplicity semantics for degenerate inSphere configurations#6600
Fedr wants to merge 2 commits into
masterfrom
inSphereFullSos

Conversation

@Fedr

@Fedr Fedr commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves all the documented deviations from full simulation-of-simplicity semantics in inSphere / InSphereTesterSoS: the answer now always equals the answer of the plain predicate on the symbolically perturbed points, including the degenerate configurations that were previously answered by fixed conventions.

Semantics

The point with rank r among the participating points (by ascending ids) receives the perturbation +eps^(9*L^r) to x, +eps^(3*L^r) to y, +eps^(L^r) to z, eps -> +0 (z gets the largest perturbation, as in getPointDegrees). The ladder between the ranks is L = 128: it exceeds the maximal degree-weight of a single point in the predicate polynomials (8 coordinates-degree * 9 = 72), so the ordering of the polynomial terms is lexicographic in the rank-weights, and the existence sign computed at reset() from three points is provably the same as in the queries ranking all four points.

Consequences, each counter-intuitive enough to note:

  • Three coincident or distinct collinear triangle points: always NoSphere. The perturbed points form a needle-like triangle (the perturbation magnitudes differ vastly between the ranks), whose circumradius diverges as eps -> +0 — there is never a sphere of a fixed radius via them. This corrects the earlier conjecture in the docs that the perturbed cluster would have a small circumcircle.
  • Two coincident triangle points: the sphere exists iff 4*rSq*(Vx^2 + Vy^2) > |V|^4 at the leading order, V = the third point minus the pair: the pair separates along z, so the circumradius limit is |V| / (2 sin(angle to z)). In particular a pair with the third point straight above (V along z) never has a sphere. When the sphere exists, Inside/Outside is resolved by the ids.
  • rSq exactly equal to the squared circumradius: the perturbation decides the existence (so a query strictly inside can return NoSphere). For a triangle in a z = const plane the answer is always NoSphere: the in-plane radial directions have no z-component, so the leading z-perturbations only lift the vertices out of the plane, which enlarges the circumradius quadratically. On tilted planes the existence genuinely depends on the ids — the tests include one configuration answering NoSphere, Outside, and Inside for three different id assignments.

Implementation

A small exact engine in MRInSphere.cpp evaluates the same predicate polynomials W, E, A, t over sparse polynomials in eps (std::map<int64 degree, VarBigInt coefficient>), built from the perturbed coordinates (each coordinate is value + eps^k). The answer repeats the plain case analysis on the signs of the leading terms. The final comparison A^2*W <> E*t^2 is decided by the leading terms alone — the leading term of a product is the product of the leading terms — and the full products are expanded only on an exact tie of both degrees and coefficients.

The engine runs only where the previous code answered by convention: W == 0 (all queries) and E == 0 (existence at reset(), plus the exactly-on-sphere queries). Non-degenerate fast paths, including the E > 0 on-sphere tie cascade, are untouched.

InSphereTesterSoS::reset() now resolves the perturbed existence: it can return false where the exact sphere exists (rSq equal to the squared circumradius with unfavorable ids) and true for a coincident pair whose perturbed sphere exists; flip() handles the degenerate mode.

Validation

  • The engine prototype was validated in exact arithmetic: agreement with the plain predicate on non-degenerate configurations, agreement with the shipped tie cascade on E > 0 on-sphere ties, ladder invariance (L = 128 vs 256), rank-subset consistency (existence sign among 3 ranks vs among 4), the derived existence rules for the coincident classes, and the always-NoSphere theorems for needles.
  • Gtest MRMesh.sosInSphereDegenerate (replacing sosInSphereDeviations) pins the new answers across every class, with all outcome values extracted from the validated prototype; the fixtures cover all engine code paths, doubling as a cross-check of the C++ port.
  • Two legacy fixtures in sosInSphere used rSq exactly equal to the squared circumradius of a planar triangle by accident; they now assert the corrected NoSphere answers, with E > 0 replacements keeping the pass-through coverage.

Fedr and others added 2 commits August 17, 2026 23:17
…gurations

The answer is now always the answer of the plain predicate on symbolically
perturbed points. Degenerate configurations (coincident or collinear triangle
points, rSq exactly equal to the squared circumradius) are resolved by an
exact evaluation of the same predicate polynomials W, E, A, t over sparse
polynomials in the perturbation parameter, with the final comparison decided
by the leading terms (fully expanded only on an exact tie). The per-rank
ladder is 128, above the maximal one-point degree-weight 72, so the term
order is rank-lexicographic and the existence resolution at reset() with
three points is consistent with the queries ranking all four points.

Notable consequences, all validated against an exact prototype:
- three coincident or distinct collinear triangle points never have a sphere:
  the perturbed triangle is needle-like and its circumradius diverges;
- two coincident points: the sphere exists iff 4 rSq (Vx^2+Vy^2) > |V|^4;
- rSq exactly equal to the squared circumradius resolves the existence by
  ids: always NoSphere for triangles in a z = const plane.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant