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
reverse interior for Cairo hole drawing #2918
Conversation
Should we make this change in GeometryBasics? We could also change the fill rule. I think, which might achieve the same result. Geometries from other packages are reversed in order, so this might cause complications there. I'll PR some tests from ArchGDAL geometries to check this. |
the holes don't need to be counter-clockwise I think, they need to be opposite to the direction of the exterior. unless you change the fill rule, I don't remember the edge cases right now |
I really don't like having this restriction in GeometryBasics. Anyways, would be nice if someone with more CairoMakie knowledge could make the correct fix :) |
yeah no it shouldn't be in geometrybasics, just cairomakie should make sure to draw it correctly. is it reasonably fast to check that property so that drawing doesn't slow down so much? |
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(display(fig))
|
according to this it would need to be |
Yeah, it's basically just a sum of neighboring cross products, so reasonably cheap ;) |
yeah it's
This would just need to be called before drawing a polygon, then the order doesn't matter anymore. |
…Plots/Makie.jl into sd/fix-cairo-poly-interior
Just to add, it wouldn't matter anymore for "normal" polygons. Where edges don't weirdly intersect, like in the svg example with the star. But I assume the polygons we care about are not weird, I think geo packages try not to generate these strange shapes but instead split into multiple polys if needed. |
GeometryBasics.Polygon
doesn't care about winding order for holes and so doesn't GLMakie.But Cairo needs winding directions for holes to be counter-clockwise, so this PR makes sure interiors are always drawn counter-clockwise.
Funnily enough, we have a test for this, which has been "failing" for cairomakie without going above test failure threshold -.-
Test before PR:
With PR: