[cairo] Path following

Carl Worth cworth at cworth.org
Wed Dec 12 05:56:52 PST 2007


On Wed, 12 Dec 2007 15:47:27 +0200, Donn wrote:
>  So, is there a way to divide a path up into n nodes such that each is an x,y
> on the path - or something like that - so that I can tween an object from one
> to another?

You can call cairo_copy_path_flat in order to get a piecewise-linear
approximation of the current path. That means you won't have to deal
with computing any spline points, for example.

If you want regularly-spaced positions along the path, then you'll
need to sum up the length of each segment and interpolate to the
desired position.

But again, with the flattened version of the path this should be
extremely straightforward.

Have fun with cairo!

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071212/915c650e/attachment.pgp 


More information about the cairo mailing list