# NURBS: Advice for specifying the first derivative at the endpoints of a C2 cubic spline interpolation.

I am working through The NURBS Book by Piegl and Tiller. In the book they give an efficient algorithm for computing the traditional $C^2$ cubic spline for global interpolation of arbitrary data points. However, this algorithm requires that the user specify the first derivative (unit direction and magnitude) at each endpoint.

Obviously this choice can significantly affect the way the curve turns out looking. Is there any "recommended" choice for these first derivatives if we have no prior knowledge of what the data looks like that we are trying to interpolate? I.e. is there a best choice for a very general interpolating algorithm?

To find a "best" choice, you first have to define "best". It could mean the approach that's easiest to implement, or the one that gives the "best" results, where, again, you have to define the meaning of "best".

Two approaches that work well are the Bessel end condition and the not-a-knot end condition.

The idea of the Bessel end condition is to interpolate the first three data points using a quadratic polynomial (i.e. a parabola). We then use the first derivative at the start of this parabola as the derivative for the start of our cubic spline. The end of the spline is treated similarly.

With the not-a-knot approach, we assume that the first and second cubic segments of the spline join with $C_3$ continuity. This means that these two segments are really just portions of the same cubic, and there is no knot separating them. We do the same with the last two segments. The number of knots is reduced by $2$, so the number of unknown control points in the spline is then equal to the number of data points, so the associated system of linear equations is solvable.

You can find out more by searching for "Bessel end condition" and "not-a-knot end condition".

I think both techniques are covered in the books of Gerald Farin and Carl de Boor. I'm surprised it's not in the Piegl/Tiller book.

You will find many places where they recommend using "natural" end conditions, which means that the second derivatives at the ends of the spline are set to zero. This works, I'm sure, but I have a lot more experience with the other two methods.