Repository navigation
perf(modeling): skip distant hole containment tests - #1500
Open
snowyukitty wants to merge 1 commit into
Open
snowyukitty wants to merge 1 commit into
snowyukitty wants to merge 1 commit into
Conversation
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.
Related to #1428.
assignHolescurrently runs the polygon crossings test for every solid/hole pair, including distant outlines. Cache each solid's minimum X and Y range, then reject representative hole points outside those bounds before calling the existing predicate. The hierarchy, point order and nested-parent selection stay unchanged, and the single-solid case avoids computing bounds.The right X bound is deliberately omitted: the existing crossings calculation can round an intersection past that bound. Keeping the original test there preserves its current floating-point behavior. This remains a quadratic pair traversal; it reduces expensive polygon tests rather than introducing a spatial index.
Add hierarchy coverage for separated outlines, concave overlapping bounds, single-solid holes and empty/no-hole inputs, plus a standalone benchmark with hierarchy and analytic-volume checks.
Linux x86-64 / Node 22.23.1, median milliseconds across seven alternating pairs of fresh Node processes (each process reports a warmed median):
Reproduce on either revision using the same benchmark file:
These are synthetic, non-overlapping 32-segment rings; timing depends on geometry and runtime. Independent compatibility probes compared complete hierarchies on 158 cases, including boundaries at several scales, and complete extrusion polygon arrays on eight fixtures. All matched the unmodified base. On the 512-ring grid, polygon-containment calls fell from 262144 to 6093.
Validation:
Root native test command
npm test -- --concurrency 1 -- --concurrency 2passes all 23 package scripts on Node 20 and 22: 817 AVA tests pass, with the same two existing skipped web tests. The concurrency options cap Lerna and AVA workers.npm run test:tsd, modeling build, and StandardX on the three changed files pass.Rebuilt UMD modeling bundle produces exactly the same polygons and serialized ASCII STL as source for a multi-outline extrusion; its analytic volume also passes.
Root
npm run lintstill fails: the candidate and untouched base have the same 367 existing diagnostics, with no new diagnostics.Followed the contributing guide.
Checked open PRs and issue-linked work for overlap.
Tests pass; generated build files are excluded.