[cairo] Ellipse stroke

Richard Copley rcopley at gmail.com
Wed Nov 29 20:13:43 UTC 2017


[Eric, sorry I sent my earlier reply to you off-list by mistake, and
sorry to send this message to you more than once; the first attempt
was rejected because the attachment took it over the list's size
limit.]

Hello.

I'm reporting a bug. I'm not sure if I made that clear.

The documentation says it's OK to report bugs on this list. Is that
wrong?

The API suggests that Cairo is supposed to be able to render
elliptical arcs. Is that wrong?

To see how poor Cairo's rendering is, please see here:
<https://imgur.com/a/i2EZS>

On the top left and bottom left: the bug (arcs stroked from 0 to pi).
Notice that everything goes horribly wrong for a small part of the
animation.

On the top right and bottom right: avoiding the bug by stroking the
arc from t to pi-t, where cos²(t) = (r₀² - ∛(r₀r₀L)²) / (r₀² - r₁²),
where r₀ and r₁ are the ellipse semiaxes and L is the line width.

(That equation gives the locations of the cusps (if any) in the inner
curve of the ellipse stroke (proof omitted).)

The right hand side of the gif is meant to show that there's no
intrinsic mathematical reason that Cairo can't stroke ellipses
properly (except if the CTM while calling cairo_arc() is so near
to singular that it effectively has no inverse).


More information about the cairo mailing list