Open
Conversation
Merging this PR will degrade performance by 23.46%
Performance Changes
Comparing |
Member
Author
Member
Author
|
The other failing test shows similar inconsistency. My take is this is the branch has the correct behavior and overlapping is expected when working with finite precision and lines which has angle which is not horizontal or vertical. import holoviews as hv
import spatialpandas as spd
import pandas as pd
import datashader as ds
from holoviews.operation.datashader import rasterize
hv.extension("bokeh")
df = spd.GeoDataFrame({
'polygons': pd.Series([
[[1, 1, 2, 2, 1, 3, 0, 2, 1, 1], [0.5, 1.5, 0.5, 2.5, 1.5, 2.5, 1.5, 1.5, 0.5, 1.5]],
[[0.5, 1.5, 1.5, 1.5, 1.5, 2.5, 0.5, 2.5, 0.5, 1.5]],
[[0, 1, 2, 1, 2, 3, 0, 3, 0, 1, 1, 1, 0, 2, 1, 3, 2, 2, 1, 1]]
], dtype='Polygon[float64]'),
'v': range(3)
})
poly = hv.Polygons(df, vdims="v").opts(alpha=0.4)
rpoly = rasterize(poly, dynamic=False, width=16, height=16, aggregator=ds.sum("v")).opts(alpha=0.4)
(poly * rpoly).opts(width=800, height=800) |
hoxbro
commented
Apr 22, 2026
| @@ -86,26 +85,26 @@ | |||
|
|
|||
|
|
|||
| nybb_polygons_sol = np.array([ | |||
|
|
||
|
|
||
| _ = np.nan # done for visual clarity in test data | ||
| nybb_lines_sol = np.array([ |
Contributor
|
Certainly looks better to me! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1495 +/- ##
=======================================
Coverage 88.46% 88.46%
=======================================
Files 96 96
Lines 19452 19461 +9
=======================================
+ Hits 17208 17217 +9
Misses 2244 2244 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.




Description
Fixes #1494
The following test has been changed because of this change, see my comments below for my reasoning to why this is okay. I don't think we can expect non horizontal and vertical lines to not have overlap when we are working in finite space (somewhat like the staircase paradox). The changes also make the output of the test 90 deg rotational symmetric.
How Has This Been Tested?
CI + Reasoning about failing test locally
AI Disclosure
Tools and Models: Claude Code + Opus 4.6. Redirected it to the function, asked for it to find an off by one error in
draw_polygonAI Summary
Change:
yincreasing[ei]→yincreasing[ei] > 0at line 224.Why: Original tiebreak count on-edge case for any non-zero yincreasing (both +1 and -1 truthy). Cause asymmetry — left edge (yinc=-1) and right edge (yinc=+1) of CCW polygon both "count" when point on edge. At shared-vertex between two touching polygons, two edges meet at same pixel column, contributions cancel → winding=0 → NaN column.
How to apply: Convention now "include right boundary, exclude left" (CCW: yinc=+1 = right edge). On-edge pixel claimed exactly once by polygon to its left. Touching polygons at shared vertex → left polygon claim the column.
Quadmesh.py use stricter
bxa * yincreasing < 0(no on-edge at all) — polygon.py need on-edge inclusion for pixel-grid-aligned vertex (e.g. unit-diamond lower tip), so need tiebreak, but now direction-consistent.Checklist