[Math] B-spline: compute control points given equations and knots

bezier-curvespline

Assuming a cubic or higher-order 2-D B-spline: if all piecewise polynomial equations for the final spline (and thus the knot vector as well) are already known, is there a relatively "streamlined" method for calculating where the control points are?

Many thanks in advance.

Best Answer

I'll describe the case of cubic curves. The general case is not really any more difficult, but it's a bit harder to describe.

One approach:
If you know the equations of all the polynomial segments, then you can check the continuity of derivatives at each junction, and this will tell you how to construct the knot sequence for the b-spline. If you're constructing a cubic curve, then, where two segments join with $C_2$ continuity, you put a knot of multiplicity 1, where the junction is only $C_1$, you place a knot of multiplicity 2, and so on. You also place a knot of multiplicity 4 at each end. Suppose that this process gives you a knot sequence with $r$ entries. Then you know that the b-spline curve will have $r-4$ control points. So, compute $r-4$ points on the curve, and compute the b-spline curve that interpolates these points. This requires that you set up a linear system of equations, and solve for the control points. You have to be careful where you put the interpolation points, or you'll get a linear system that's not solvable. You have to satisfy the so-called Schoenberg-Whitney condition.

Another approach:
There are things called deBoor-Fix functionals, or "dual functionals" that provide explicit formulae for control points, in terms of derivatives of the polynomial pieces. In this approach, the concepts and the mathematics are far more complex, but, if you can work through all the complexity, you'll eventually get some very simple formulae (in the cubic case, anyway). Computationally, this approach is much more efficient than the interpolation technique described in approach #1.

There is an illustration of both techniques in this answer, for the case of a cubic spline that's $C_1$ at every knot.

Both methods (and the relationship between them) are described in Carl deBoor's book entitled "A Practical Guide to Splines". The book includes code, too.