Skip to content

[SEDONA-755] fix: remove redundant bounds check from rasterization scanline logic#2960

Open
prantogg wants to merge 1 commit into
apache:masterfrom
prantogg:pranav/bugfix/rasterization-redundant-check
Open

[SEDONA-755] fix: remove redundant bounds check from rasterization scanline logic#2960
prantogg wants to merge 1 commit into
apache:masterfrom
prantogg:pranav/bugfix/rasterization-redundant-check

Conversation

@prantogg
Copy link
Copy Markdown
Contributor

@prantogg prantogg commented May 16, 2026

Did you read the Contributor Guide?

Is this PR related to a ticket?

  • Yes, and the PR name follows the format [SEDONA-XXX] my subject.

What changes were proposed in this PR?

Removed a redundant xIntercept < 0 || xIntercept > rasterWidth check in the vertical line case of Rasterization.computeScanlineIntersections(). This check was incorrectly skipping valid scanlines for polygons whose edges align with the raster boundary. After clipping to raster extent, floating-point arithmetic can produce xIntercept values like 256.0000000000005 (exceeding raster width by ~5e-13), causing the check to skip valid scanline intersections and produce incorrect rasterization results.

The non-vertical (else) branch already uses geometry-extent-based bounds (xMin/xMax) which correctly handles this case. The vertical line branch doesn't need bounds checking at all since the polygon has already been clipped to the raster extent.

How was this patch tested?

  • Passes all existing rasterization tests
  • Added a regression test (testZonalStatsEdgeCase) that reproduces the issue with a polygon threading along the raster edge

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

@prantogg prantogg changed the title fix: remove redundant bounds check from rasterization scanline logic [SEDONA-755] fix: remove redundant bounds check from rasterization scanline logic May 16, 2026
@prantogg prantogg marked this pull request as ready for review May 16, 2026 02:13
@prantogg prantogg requested a review from jiayuasu as a code owner May 16, 2026 02:13
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