Re-express the point-in-area interval index on the shared RTree#441
Closed
asinghvi17 wants to merge 1 commit into
Closed
Re-express the point-in-area interval index on the shared RTree#441asinghvi17 wants to merge 1 commit into
RTree#441asinghvi17 wants to merge 1 commit into
Conversation
`SortedPackedIntervalRTree` was a from-scratch packed tree duplicating the shared bulk-loading substrate: sort-tile-recursive in one dimension IS its midpoint sort (JTS `NodeComparator`), and the packed levels are the same bottom-up extent reduction. The locator's segment index is now `RTree(STR(), segs; extents = y_intervals)` over 1-D `(Y,)` extents, queried through `depth_first_search` with a closed-interval extent — the sound 1-D stabbing contract is unchanged, and the measured sorted-layout query win is preserved by construction. `IntervalIndexedGeometry.isEmpty` becomes `index === nothing` (an empty polygonal geometry contributes no segments), replacing the separate `is_empty` flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Draft
5 tasks
Member
Author
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.
Stacked on #440 (base branch
relateng-payload-tree) — the last of the three substrate-audit follow-ups.SortedPackedIntervalRTreewas a from-scratch packed tree that duplicated the shared bulk-loading substrate piece by piece: its midpoint sort (JTSNodeComparator) is exactly sort-tile-recursive in one dimension, and its flat per-level min/max arrays are the same bottom-up consecutive-run extent packing. With #440's payload-carryingRTree, the whole thing is expressible as a constructor call: the prepared point-in-area locator's segment index is nowqueried through
SpatialTreeInterface.depth_first_searchwith a closed[y, y]interval extent (the do-block callback form, so the RayCrossingCounter loop stays allocation-free). What's preserved and what changed:p.yregardless of x, so a 2-D index could not prune more without changing the ray-counting contract; closed-interval touch semantics match (Extents.intersectsis closed).RTreedefault 16-ary fanout; query results are extent-checked and set-identical (the test suite compares against brute force).IntervalIndexedGeometry.isEmptybecomesindex === nothing(an empty polygonal geometry contributes no segments), replacing the separateis_emptyflag.Net: −104 lines (the source file shrinks by ~145), and RelateNG's last private index structure now sits on the shared substrate.
Tests
The
SortedPackedIntervalRTreetestset is re-expressed as a 1-D stabbing testset over the new index shape (same cases: duplicates, point intervals, closed-interval touches, brute-force sweeps). Green on this branch: indexed point-in-area (incl. the 10k-vertex prepared-vs-unprepared differential), point locator, allocations + type stability, LibGEOS differential fuzz (500).relate_ng.jlengine,xml_suite.jlJTS conformance) were repeatedly terminated externally while running in the background (the second engine attempt died ~19 min in, likely moments from passing); they passed on the base branch #440 and this branch touches only the prepared locator's index internals, which the fuzz + differential testsets exercise end-to-end. They still need one clean confirmation run before undrafting.🤖 Generated with Claude Code