[cairo] Mathematics question

Petr Kobalíček kobalicek.petr at gmail.com
Wed Nov 3 20:06:27 PDT 2010

Hi list,

I'm working on a graphics library (Fog, I already pushed links here)
and currently I'm mainly focused to geometry. My questions are related
to quadric/cubic bezier curves and their approximation. I'd like to
know how cairo is tuned up for speed/quality and algorithms used by

1. When making dashes/path-on-path, which formula is used by cairo to
get the length of a cubic bezier curve?
I found this material
(http://steve.hollasch.net/cgindex/curves/cbezarclen.html), but I'm
not sure if it's the best. The second way (subdivision) is used by Qt
and probably by many other libs. Another interesting paper is
http://math.kennesaw.edu/~jdoto/13.pdf .

2. When stroking path-to-path, which algorithm is used by cairo?
Making offset of a cubic curve is complicated and it must be
approximated by more curves. Is somewhere material that describes the
algorithm used by cairo? Or is somewhere source-code used as a base
for the work in cairo?

3. When approximating curves to lines (flattening before
rasterization), how algorithm is used by cairo and how it competes to
the others? I found very interesting article (
) that describes parabolic approximation. Is here anybody familiar
with this method?


If anybody is interested about my work or materials I found, here is
small summary:


Don't hesisate to contribute to the list of resources. Thanks and
sorry for off-topic..

Best regards
- Petr

More information about the cairo mailing list