Bspline matrix form?

2.6k Views Asked by At

I understand how bezier curves can be expressed in matrix form: you have a matrix multiplied by a vector containing the power series of t, and also multiply be a vector containing the control points. After multiplication you sum the elements of the vector to get the final value.

I get that these basic ideas could also apply to B-splines, since they have basis functions per control point, so could do similar operations with matrix math as you can do with Bezier curves.

What confuses me though is that bspline basis functions are conditional. The lowest order basis function that the higher ones are based on has a value of 1 if the time value is between the specified knot values, else it's 0.

I see plenty of mentions of a matrix form of B-splines, but how could a matrix take the conditional test into account? Or is the key that you test the conditional before doing the matrix math? Or maybe something else?

A bit confused, thanks for any help you can provide!

1

There are 1 best solutions below

2
On BEST ANSWER

If the nodes are spaced apart by unit intervals in $t$ and the B-spline is formed in the unit interval between two nodes, then there is no need for a check as all the basis functions are polynomial (not piece-wise) in that interval. For example if the polynomial is of degree 3 and there are 4 basis functions scaled by values at 4 nodes, for $0 \le t < 1$:

$$y(t) = \left(\begin{array}{cccc}1&t&t^2&t^3\end{array}\right)\left(\begin{array}{rrr}0&1&0&0\\-\frac{1}{2}&0&\frac{1}{2}&0\\1&-\frac{5}{2}&2&-\frac{1}{2}\\-\frac{1}{2}&\frac{3}{2}&-\frac{3}{2}&\frac{1}{2}\end{array}\right)\left(\begin{array}{l}x[-1]\\x[0]\\x[1]\\x[2]\end{array}\right),$$

where $x[n]$ are the values at the nodes and $y(t)$ is the value of the spline. The particular coefficients are for cubic Hermite splines though.