b-spline of degree 3 interpolation formula

204 Views Asked by At

I know that the recursive formula for a bspline is the following: $$ B_{i}^k (x)= (\frac{x-t_i}{t_{i+1}-t_i})B_{i}^{k-1}(x) + (\frac{t_{i+k+1} - x}{t_{i+k+1}-t_{i+1}})B_{i+1}^{k-1} (x)$$ Where: $$ B_{i}^0 (x)= \begin{cases} 1 & x \in [t_i,t_{i+1}] \\ 0 & x \in else \\ \end{cases} $$ I want to find $B_{0}^3 (x)$, then I would recursively find what $B_{i}^3 (x)$ is and then plug in 0 for i. Here is the overall answer I get for $B_{0}^3 (x)$ and when I graph it using some of my points, it does not look continuous which is wrong... What am I doing wrong here? I have also provided my intermediary steps of my findings $B_{i}^1 (x)$ and $B_{i}^2(x)$. $$ B_{i}^1 (x)= \begin{cases} \frac{x-t_i}{t_{i+1}-t_i} & x \in [t_i,t_{i+1}] \\ \frac{t_{i+2}-x}{t_{i+2}-t_{i+1}} & x \in [t_{i+1},t_{i+2}] \\ 0 & else \end{cases} $$ $$ B_{i}^2 (x)= \begin{cases} \frac{(x-t_i)^2}{(t_{i+2}-t_i)(t_{i+2}-t_i)} & x \in [t_i,t_{i+1}] \\ \frac{(x-t_i)(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})} + \frac{(x-t_{i+1})(t_{i+3}-x)}{(t_{i+3}-t_{i+1})(t_{i+2}-t_{i+1})} & x \in [t_{i+1},t_{i+2}] \\ \frac{(t_{i+3} - x)^2}{(t_{i+3}-t_{i+1})(t_{i+3}-t_{i+2})} & x \in [t_{i+2},t_{i+3}] \\ 0 & else \end{cases} $$ So, for $B_{i}^3 (x)$ I have the following: $$ B_{i}^2 (x)= \begin{cases} \frac{(x-t_i)^3}{(t_{i+3}-t_i)(t_{i+2}-t_{i})(t_{i+1}-t_{i})} & x \in [t_i,t_{i+1}] \\ \frac{(x-t_{i})^2(t_{i+2}-x)}{(t_{i+3}-t_{i})(t_{i+2}-t_i)(t_{i+2}-t_{i+1})}+\frac{(x-t_{i+1})^2(t_{i+3}-x)}{(t_{i+3}-t_{i})(t_{i+3}-t_{i+1})(t_{i+2}-t_{i+1})}+\frac{(x-t_{i+1})^2(t_{i+4}-x)}{(t_{i+3}-t_{i+1})(t_{i+2}-t_{i+1})(t_{i+4}-t_{i+1})} & x \in [t_{i+1},t_{i+2}] \\ \frac{(t_{i+3}-x)^2(x-t_i)}{(t_{i+3}-t_{i})(t_{i+3}-t_{i+1})(t_{i+3}-t_{i+2})} + \frac{(x-t_{i+1})(t_{i+3}-x)(t_{i+4}-x)}{(t_{i+3}-t_{i+1})(t_{i+3}-t_{i+2})(t_{i+3}-t_{i+1})} + \frac{(x-t_{i+2})(t_{i+4}-x)^2}{(t_{i+4}-t_{i+2})(t_{i+3}-t_{i+2})(t_{i+4}-t_{i+1})} & x \in [t_{i+2},t_{i+3}] \\ \frac{(t_{i+4}-x)^3}{(t_{i+4}-t_{i+1})(t_{i+4}-t_{i+2})(t_{i+4}-t_{i+3})} & x \in [t_{i+3},t_{i+4}] \\ 0 & else \end{cases} $$ Plugging in i = 0 to get $B_{i}^3 (x)$ I have the following: $$ B_{i}^3 (x)= \begin{cases} \frac{(x-t_0)^3}{(t_3-t_0)(t_2-t_0)(t_1-t_0)} & x \in [t_i,t_{i+1}] \\ \frac{(x-t_0)^2(t_2-x)}{(t_3-t_0)(t_2-t_0)(t_2-t_1)}+\frac{(x-t_1)^2(t_3-x)}{(t_3-t_0)(t_3-t_1)(t_2-t_1)}+\frac{(x-t_1)^2(t_4-x)}{(t_3-t_1)(t_2-t_1)(t_4-t_1)} & x \in [t_{i+1},t_{i+2}] \\ \frac{(t_3-x)^2(x-t_0)}{(t_3-t_0)(t_3-t_1)(t_3-t_2)}+\frac{(x-t_1)(t_3-x)(t_4-x)}{(t_3-t_1)(t_3-t_2)(t_4-t_1)}+\frac{(t_4-x)^2(x-t_2)}{(t_4-t_2)(t_3-t_2)(t_4-t_1)} & x \in [t_{i+2},t_{i+3}] \\ \frac{(t_4-x)^3}{(t_4-t_1)(t_4-t_2)(t_4-t_3)} & x \in [t_{i+3},t_{i+4}] \\ 0 & else \end{cases} $$ Taking the example knots: {-1, -0.75, 0, 0.5, 1} and drawing the graph, we see that there is a discontinuity at point 0. Did I miss an index in the spline or something? but if i change the knots a bit, the function becomes continuous. Isn't it a characteristic of bsplines to be continuous, or is it dependent on the knots I choose? If so, would this mean that my discontinuous spline is valid?

1

There are 1 best solutions below

0
On

A cubic b-spline curve should be $C_2$ continuous at a single knot (multiplicity = 1), and $C_1$ continuous at a double knot (multiplicity = 2).

In your example, all knots have multiplicity = 1, so the spline should be $C_2$ everywhere. So, if you see any slope discontinuities in the curve, you’ve done something wrong.