Skip to content

Reduce NURBS SSX candidates before Bezier tracing - #50

Merged
sth-v merged 2 commits into
tinyfrom
codex/ssx-broad-phase
Sep 26, 2026
Merged

sth-v merged 2 commits into
tinyfrom
codex/ssx-broad-phase

Conversation

@sth-v

@sth-v sth-v commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

NURBS SSX was sending thousands of overlapping AABB pairs into full Bézier intersection, including pairs that cheap control-hull bounds can exclude. On nurbs_nurbs_intersection_2.py, calls fall from 2,485 to 446 and the measured runtime from 140.4 s to 53.8 s. On case19, calls fall from 7,426 to 290 and runtime from 714.8 s to 127.9 s. These paired runs use the same compiled narrow phase, with only the candidate filters toggled. Returned geometry is byte-identical to the corresponding baseline, with unchanged completion/reason status.

The existing BVH already uses top-down median splitting. This keeps that tree and adds cached control-point support intervals on OBB directions, independently verified native GJK direction proposals, and up to two levels of lazy rational child-hull refinement. A parent is excluded only when its complete hull coverage is separated by more than the padded model-space tolerance plus arithmetic allowance. Uncertain arithmetic and exhausted filter limits retain the original pair. The backend receives original patches, domains, pair order, and atol; aggregate allowances remain based on the original AABB candidates.

The legacy Boolean GJK API is unchanged. The new optional axis API supplies proposals rather than final rejection decisions; seven case19 near pairs that a raw Boolean would discard are retained. Projection temporaries, native control products, split work, and child comparisons have bounds. An older native extension can still use the projection/refinement stages.

Independent tests cover analytic separation/contact, rational weights, changed parameterizations and coordinate units, degenerate patches, invalid axes, interrupted refinement, and exclusion before the full solver. Existing geometry tests were not loosened. A reproducible benchmark reports stage counts, wall/CPU times, geometry digests, and baseline/filtered comparisons.

The branch includes the existing local tiny fixture commit 3d1b04a (case18/19), preserving it unchanged.

Focused validation: 151 geometry/native tests passed on macOS and freshly built Linux Python 3.12; adapter/case16/spherical integration checks passed. Import and layering checks pass. Full macOS Python 3.14 and Linux Python 3.12 suites each passed 1,517 tests (one existing slow test deselected), in 17m51s and 18m31s respectively. All 14 GitHub build/test jobs passed; Ubuntu Python 3.12 reported 1,517 passed, one slow test deselected (52m51s): https://github.com/contextmachine/mmcore/actions/runs/36209139491.

Details and commands: broad-phase measurements.

@sth-v
sth-v marked this pull request as ready for review September 26, 2026 02:37
@sth-v
sth-v merged commit 092f8cd into tiny Sep 26, 2026
16 checks passed
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