Closed hyrodium closed 10 months ago
Good idea! These circles are pretty small - I wonder whether the Cairo routines (https://github.com/ImageMagick/cairo/blob/main/src/cairo-arc.c might be the one) aren't so accurate for very small radii...
Anyway, your suggested code/fix looks good!
@hyrodium I'm going to get another release out this week - do you want to make a PR for these circles?
Sorry for the late reply. I opened #269!
Cool! Thanks!
I'll add a closepath()
as well so that the path ends are correctly mitred...
MWE
Generated image:
Magnified image:
There are 10 circles in the image, and the small five circles does not have enough precision.
Detail
There are four bezier segments for circles with a radius larger than 5, but if the radius is less or equal to 5, the number of segments will be two.
The following image is a screenshot with Inkscape.
I think this behavior is due to Cairo because the
circle
function just callsCairo.arc(_get_current_cr(), x, y, r, 0, 2pi)
. https://github.com/JuliaGraphics/Luxor.jl/blob/375bb999e04f0ec5fcf14af82d5bd4188378bdc2/src/curves.jl#L3-L11How to fix
Update the definition of
circle
will solve the problem.If this fix is the right way, I'm happy to make a PR!