Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove artifact from Polygon rendering #1329

Merged
merged 7 commits into from
May 10, 2024
Merged

Remove artifact from Polygon rendering #1329

merged 7 commits into from
May 10, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented May 8, 2024

Fixes #1327

image

image

Lets see how the CI handles this change.

Edit: Can still see some artifacts, if I use the holoviews example in the original issue. Can make them disappear, if I completely remove this if statement.

@jbednar
Copy link
Member

jbednar commented May 8, 2024

Thanks for taking a stab at this! It does seem to address the zoomed-out issue:

image

But zooming in, seems like it's not actually drawing the polygons any more?

image

@jbednar
Copy link
Member

jbednar commented May 8, 2024

For reference, here's what it did before the change, where the zoomed-out version has artifacts, but the zoomed-in version is fine:

image

@hoxbro
Copy link
Member Author

hoxbro commented May 8, 2024

image

@jbednar
Copy link
Member

jbednar commented May 8, 2024

Looks great! Panning and zooming with HoloViews, I can no longer detect any issues now for that dataset. Thanks for following up on that @hoxbro ! Can you motivate what the meaning of each of the changes is, and any risks?

To me it seems like one risk would be if the polygon coordinates are near the atol value for np.isclose, which is 1e-08 by default. E.g. if we were plotting nanometer-scale shapes on an integrated circuit wafer, would we have problems from the shape coordinates being considered "close"? Or are all such comparisons being done in pixel space, where 1e-08 is indeed a very small tolerance?

@hoxbro
Copy link
Member Author

hoxbro commented May 9, 2024

I have removed np.isclose, which I played around with when trying to find the problem. The coordinates is in pixel space, but I saw no difference with it. In theory, it could catch some of the cross-products, which are close to zero, but I don't feel it is worth the extra calculations for a case that right now is only theoretical.

For risk related to the removal of +1 I can't say as this is pretty deep in the machinery combined with some theory I haven't dove deep into.

@hoxbro hoxbro force-pushed the polygon_artifact branch 3 times, most recently from 892e142 to 5b546ce Compare May 9, 2024 07:45
Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. In the end, it's a very simple change, and seems to address the underlying issue (starting to draw one pixel too late). I've studied the test cases that changed and I think they make sense. The extent that's being drawn has changed slightly, but that seems to be what's required to fix the bug. So as far as I can see, this deals with the reported bug. Thanks again!

.github/workflows/test.yaml Outdated Show resolved Hide resolved
.github/workflows/test.yaml Outdated Show resolved Hide resolved
@hoxbro hoxbro merged commit 7c1111c into main May 10, 2024
15 checks passed
@hoxbro hoxbro deleted the polygon_artifact branch May 10, 2024 04:35
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.

Visual artifacts when shading Polygons
2 participants