[cairo] Obtaining two parallel paths from a single curve

Nicola Fontana ntd at entidi.it
Tue Jul 29 07:24:21 PDT 2008

On Tue, 29 Jul 2008 14:49:46 +0800
"archee at 126" <archee at 126.com> wrote:

> Hi,
> How to obtain two parallel paths from a single curve?
> Say, these two parallel paths are N pixels away from each other.
> Thanks!


computing the offset bezier curve is not a trivial task. You
could use lib2geom (the base library of inkscape).

As already stated, there's no perfect solution. You can flatten the curve
and offset the segments or you could get an approximated Bezièr.

In the last case, I found this article very helpful:


I'm confident also the ccmath project has a solution buried in
its code, but my mathematical skill is tangent to 0.

If you succeed to get a function that given the 4 control points
and the offset distance returns the new control points, please
let me know: I'm looking for this function as well.


More information about the cairo mailing list