Fix boundary point classification in computeLineEnds optimization (#1175)#1200
Open
grootstebozewolf wants to merge 1 commit into
Open
Conversation
… disjoint line components (locationtech#1175) The optimization in computeLineEnds() that skips processing of line components whose envelopes are disjoint from the target after finding one exterior intersection was incorrectly skipping boundary point classification. Track hasInteriorExteriorIntersection and hasBoundaryExteriorIntersection separately so that we only skip when both kinds of exterior line-end intersections have been recorded. This ensures boundary endpoints on later disjoint components (e.g. odd-valence ends in a MultiLineString) are still processed and reported in the DE-9IM matrix (position 7, EB). - Refactor computeLineEnds() + computeLineEnd() to use two booleans and return the line-end location (INTERIOR/BOUNDARY/NONE) instead of a simple boolean. - Add the exact reproduction case from the issue as testLineDisjointMultiLineWithBoundaryInExterior_JTS1175() exercising relate() + the various predicate helpers. - Update history. Reported by peterstace; reproduction: g1 = LINESTRING(10 10,20 20) g2 = MULTILINESTRING((0 0,1 0),(1 0,2 0),(-1 0,0 0)) Expected: FF1FF0102 (EB='0'), was FF1FF01F2 (EB='F') (cherry picked from commit 2991049, isolated to just the RelateNG boundary skip changes)
This was referenced Jun 4, 2026
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.
… disjoint line components
The optimization in computeLineEnds() that skips processing of line components whose envelopes are disjoint from the target after finding one exterior intersection was incorrectly skipping boundary point classification.
Track hasInteriorExteriorIntersection and hasBoundaryExteriorIntersection separately so that we only skip when both kinds of exterior line-end intersections have been recorded. This ensures boundary endpoints on later disjoint components (e.g. odd-valence ends in a MultiLineString) are still processed and reported in the DE-9IM matrix (position 7, EB).
Reported by peterstace; reproduction:
g1 = LINESTRING(10 10,20 20) g2 = MULTILINESTRING((0 0,1 0),(1 0,2 0),(-1 0,0 0)) Expected: FF1FF0102 (EB='0'), was FF1FF01F2 (EB='F')
(cherry picked from commit 2991049,
isolated to just the RelateNG boundary skip changes)