# [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

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