Skip to content

Fix YSTRIPES indexing bug for segments at polygon top edge#17

Merged
tidwall merged 1 commit intotidwall:mainfrom
Kontinuation:fix-ystripes-top-edge-bug
Jul 22, 2025
Merged

Fix YSTRIPES indexing bug for segments at polygon top edge#17
tidwall merged 1 commit intotidwall:mainfrom
Kontinuation:fix-ystripes-top-edge-bug

Conversation

@Kontinuation
Copy link
Copy Markdown
Contributor

Please ensure you adhere to every item in this list

  • [*] This PR was pre-approved by the project maintainer
  • [*] I have self-reviewed the code
  • [*] I have added all necessary tests

Describe your changes

Points touching the top edge of polygons incorrectly return false for intersection tests when using TG_YSTRIPES indexing, while correctly returning true with TG_DEFAULT indexing (see #16 for details). This is caused by a problem in process_ystripes() when processing horizontal segments at the exact top boundary. The segment will be missed and never intersects with other geometries. This patch fixes this problem by ensuring that the top edge get properly assigned to the highest stripe.

Issue number and link

Closes #16.

@tidwall tidwall merged commit e136401 into tidwall:main Jul 22, 2025
1 check passed
@tidwall
Copy link
Copy Markdown
Owner

tidwall commented Jul 22, 2025

Excellent PR. Thanks!

jiayuasu pushed a commit to apache/sedona-db that referenced this pull request Aug 29, 2025
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.

YSTRIPES indexing returns incorrect results for points on polygon top edges

2 participants