Full simulation-of-simplicity semantics for degenerate inSphere configurations - #6600
Open
Fedr wants to merge 2 commits into
Open
Full simulation-of-simplicity semantics for degenerate inSphere configurations#6600Fedr wants to merge 2 commits into
Fedr wants to merge 2 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ramong 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 ingetPointDegrees). The ladder between the ranks isL = 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 atreset()from three points is provably the same as in the queries ranking all four points.Consequences, each counter-intuitive enough to note:
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.4*rSq*(Vx^2 + Vy^2) > |V|^4at 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 (Valong z) never has a sphere. When the sphere exists, Inside/Outside is resolved by the ids.rSqexactly equal to the squared circumradius: the perturbation decides the existence (so a query strictly inside can return NoSphere). For a triangle in az = constplane 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, tover sparse polynomials ineps(std::map<int64 degree, VarBigInt coefficient>), built from the perturbed coordinates (each coordinate isvalue + eps^k). The answer repeats the plain case analysis on the signs of the leading terms. The final comparisonA^2*W <> E*t^2is 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) andE == 0(existence atreset(), plus the exactly-on-sphere queries). Non-degenerate fast paths, including theE > 0on-sphere tie cascade, are untouched.InSphereTesterSoS::reset()now resolves the perturbed existence: it can return false where the exact sphere exists (rSqequal to the squared circumradius with unfavorable ids) and true for a coincident pair whose perturbed sphere exists;flip()handles the degenerate mode.Validation
E > 0on-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.MRMesh.sosInSphereDegenerate(replacingsosInSphereDeviations) 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.sosInSphereusedrSqexactly equal to the squared circumradius of a planar triangle by accident; they now assert the corrected NoSphere answers, withE > 0replacements keeping the pass-through coverage.