[cairo] Spline with more than 4points
Carl Worth
cworth at cworth.org
Thu May 1 15:23:48 PDT 2008
On Thu, 01 May 2008 17:06:14 -0400, James Cloos wrote:
> degree splines. I took a quick look at their src. They have functions
> for both cubic and quadratic Beziérs. You should note that cairo only
> does cubic.
And note that representing a quadratic curve with a cubic is quite
trivial. Namely:
Any quadratic spline can be expressed as a cubic (where the cubic
term is zero). The end points of the cubic will be the same as the
quadratic's.
CP0 = QP0
CP3 = QP2
The two control points for the cubic are:
CP1 = QP0 + 2/3 *(QP1-QP0)
CP2 = CP1 + 1/3 *(QP2-QP0)
[http://fontforge.sourceforge.net/bezier.html]
Meanwhile, the general interpolation problem of "I have many points
and I'd like to render some 'smooth' curve through (or near) these
points" can have many different approaches. Which is best depends
quite a bit on your particular application.
And with cairo, after you figure out what curve you want to draw, you
next need to figure out how to express that as a sequence of cubic
Bézier splines.
Now, since James' investigation suggests you were perhaps drawing
cubic or quadratic Bézier splines already, then there's no additional
work needed on your part.
-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/20080501/a15eeb7e/attachment.pgp
More information about the cairo
mailing list