Fix missing p_start update in hinge midpoint loop#397
Open
asinghvi17 wants to merge 3 commits intomainfrom
Open
Fix missing p_start update in hinge midpoint loop#397asinghvi17 wants to merge 3 commits intomainfrom
asinghvi17 wants to merge 3 commits intomainfrom
Conversation
…ge handler The midpoint-checking loop in the `line_hinge` branch never advanced `p_start`, so every midpoint was computed from the original line start instead of between consecutive intersection points. This caused sub-segments outside a curve to go undetected, making predicates like `within` return incorrect results for polygons sharing collinear edges with a notch. Fixes #396 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
afe7c2a to
92a8d43
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
_line_filled_curve_interactionsfailed to advancep_startin theline_hingemidpoint-checking loop, causing all midpoints to be computed from the original line start instead of between consecutive intersection pointswithin(and potentially other DE-9IM predicates) to return incorrect results when polygon edges were collinear with the boundary of another polygon containing a notch/indentationDetails
The hinge handler splits a line segment at all intersection points with a curve, then checks the midpoint of each sub-segment to determine if it's inside, on, or outside the filled curve. Without advancing
p_start, the midpoints were wrong — for example, a midpoint that should have been(0, 2.5)(outside the polygon) was instead computed as(0, 3.0)(on the boundary), so the "outside" flag was never set.The fix is a single line:
p_start = p_endat the end of the loop body.Fixes #396
Test plan
🤖 Generated with Claude Code