Reject most shadow candidates in double before the exact test - #6596
Merged
meshinspector-agent[bot] merged 2 commits intoAug 16, 2026
Merged
Conversation
The port to FastInt dropped the floating-point pre-filter because the family has no conversion to double, so every candidate was evaluated exactly. The filter's operands are dot products of point differences below 2^31, which Vector3d represents exactly, so they can be recomputed in double directly instead of converting the exact bignums - 0.7 bits worse, and no dependency on a bignum-to-double conversion.
…q prefilter Brings master's FastInt rework under the double sign rejection so this PR builds against current master.
meshinspector-agent
Bot
deleted the
agent/mlib-shadow-prefilter-doubles
branch
August 16, 2026 21:03
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.
Supersedes #6593, which sits on closed #6592's branch and needs
toDouble. This one is based onalpha-shape-triangle-shadowand needs nothing new — it recomputes the pre-filter's operands indoubleinstead of converting the exact bignums.FastIntdropped the pre-filter, so every candidate reached the exact path. Restoring it skips 79–91% of them.up/uqare hoisted out of the candidate loop;bp = dot( d, up ),bq = dot( d, uq ), and a negative sign of either rejects the candidate before any bignum work.toDouble. The operands must approximate the value on the integer grid, where the predicates and the SoS ties live. Point differences are below 2^31, soVector3dof one is exact andpp/qq/pqare ordinarydoubledot products — 0.7 bits worse than converting the exact bignum (max error 2^10.7 vs 2^10.0 over 200k pairs), against 2^33.3 if taken from the cloud'sVector3f.up/uqbelow 2^96, their dot withdbelow 2^129; each rounding costs 2^-53 of the running magnitude, so the total stays below 2^79 and adoublebelow -2^79 is negative exactly as well. The 2^84 tolerance keeps 32x that margin; candidates in between fall through to the exact path unchanged.The exact path itself is untouched — this only decides which candidates reach it.
Verification
Built in the ubuntu22 image mirroring
build-test-ubuntu-x64.yml:clone_submodules_linux.sh --skip-prebuilt-thirdparty, prebuilt thirdparty linked aslib/include/share, Ninja Release,g++-12,-DMR_CXX_STANDARD=20.MRTestand its dependency graph — 640/640, no new warnings.MRTest --gtest_filter=*AlphaShape*:*PrecisePredicates*:*InSphere*:*FastInt*→ 16/16 pass.DISABLED_AlphaShapeBench, pre-filter on:shadowTestsexactShadowTests1740329182648159616763580519169085795411472133144093973002Every hash equals the filter-off baseline, and
consideredTris,touchableTris,inBallTests(1461420 / 3055058 / 23736199) andshadowedNeisare unchanged — the pre-filter is output-preserving, as its bound claims. All of those, and all three hashes, are also identical to #6593'stoDoubleversion: on these clouds the cheaper operands decide every candidate exactly the same way.No timings on purpose — this box is not a GitHub-hosted runner, so its milliseconds are not comparable to the reported set. The counters above are exact and platform-independent; the wall-clock payoff comes from the branch run.
Not exercised: the other
MRTestconfigs (MSVC, arm64, wasm, macOS) — a PR based onalpha-shape-triangle-shadowgets no checks of its own. No UI surface (library-internal predicate, no MCP-exposed tool and no viewer widget), so nothing to drive over MCP and no screenshots; the three structurally different clouds are the state coverage instead.CI labels: none.