[GH-3120] Fix rasterization at grid-aligned endpoints - #3251
Merged
jiayuasu merged 1 commit intoAug 13, 2026
Conversation
jiayuasu
marked this pull request as draft
August 13, 2026 20:21
jiayuasu
force-pushed
the
fix/rasterize-grid-aligned-vertices
branch
from
August 13, 2026 21:02
7e07210 to
72d9cc2
Compare
This was referenced Aug 13, 2026
Member
Author
|
Follow-up work intentionally kept out of this PR:
The clipping issue should land first. This PR remains limited to endpoint-cell selection when the computed pixel coordinate is already exactly integral. |
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.
Did you read the Contributor Guide?
Is this PR related to a ticket?
What changes were proposed in this PR?
Line rasterization derived both endpoint cells with
floor(). When an endpoint mapped exactly to a pixel grid line and the segment extended toward the negative side,floor()selected the adjacent positive-side cell even though the segment never entered it. At lattice-corner endpoints, that cell could also be unreachable by the traversal, causing it to continue until its safety bound and burn an unrelated diagonal streak.This patch selects an endpoint cell from the side containing the segment interior, but only when the computed pixel coordinate is exactly integral. Nearby nonintegral coordinates are unchanged, and axes with no extent retain the existing half-open
floor()convention.The scope is deliberately limited. This PR does not introduce coordinate snapping or tolerances, reinterpret decimal or affine-generated coordinates, or change segment clipping and extreme-coordinate behavior.
The existing rasterization test class is renamed from
RasterizationTeststoRasterizationTestso Maven Surefire discovers it under the repository's current default patterns.How was this patch tested?
Coverage includes:
Math.nextUpandMath.nextDowncoordinates to verify that nearby values are not snapped;Commands run locally:
mvn -pl common test— 1,285 tests passed;mvn -pl spark/common -Dspark=3.5 -Dscala=2.12 -Dtest=NoSuchTest -Dsurefire.failIfNoSpecifiedTests=false -Dsuites=org.apache.sedona.sql.rasteralgebraTest test— 166 tests passed;git diff --checkpassed;python3 -m py_compile tests/sql/test_rasterize_parity.pypassed. The full Python parity suite was not run in this checkout becausepytestis not installed.Did this PR include necessary documentation updates?
RS_AsRaster.mdnow documents endpoint-only line/polygon contacts and preserves the existingPOINTbehavior.