Building of piecewise B-splines is motivated below. You can skip this and go directly to the explanation of B-splines calculations.
Any spline point P(t) subdivides Bezier curve in two smaller quadratic splines (with control points P_{0 }, P_{0}^{1}, P(t) and P(t), P_{1}^{1}, P_{2 } for quadratic splines to the left). The new curves match the original in position, although they differ in parameterization. E.g. for t = 1/2 you see to the left that triangles (1 P_{0}^{1} 2) and (3 P(t) 2) are equal and the point P(1/4) of the original spline coincides with the point P(t') of the first small spline for t' = 1/2. |
The first derivatives of these two small splines at P(t)
are determined by the P_{1}^{1} P(t) and
P(t) P_{0}^{1} control segments.
Therefore if we drag only P_{0} or P_{2}
points we get continuous at P(t) curve.
Note that both small splines depend only on its own control points.
In a similar way we get piecewise B-spline with continuous (n - 2)-order derivatives from n-order Bezier spline by subdivision and end control points movement. We can repeat subdivisions to get very complex curve. |
For the spline in Fig.2 we have
n = 3, k = 3, we take the uniform knot vector (-2, -1, 0, 1, 2, 3, 4).
For the first spline segment
D_{0} = P_{0} +
(P_{0} - P_{1 }), 0 ≤ t ≤ 1
and you can check that
τ_{1}^{1} = (t - t_{1 })/(t_{3} -
t_{1 }) = (t + 1)/2,
P_{1}^{1} =
(1 - τ_{1}^{1})D_{0} +
τ_{1}^{1}D_{1 } =
(1 - t)B_{0} + t B_{1 },
τ_{2}^{1} = (t - t_{2 })/(t_{4} -
t_{2 }) = t/2,
P_{2}^{1} =
(1 - τ_{2}^{1})D_{1} +
τ_{2}^{1}D_{2 } =
(1 - t)B_{1} + t B_{2 },
τ_{2}^{2} = (t - t_{2 })/(t_{3} -
t_{2 }) = t,
P_{2}^{2} =
(1 - τ_{2}^{2})P_{1}^{1} +
τ_{2}^{2}P_{2}^{1} =
(1 - t)P_{1}^{1} + tP_{2}^{1}.
These are exactly de Casteljau iterations for the first Bezier spline segment
(sorry its control points B_{i} are itroduced too).
We can "forget" about this lengthy math and use only de Boor control points and
B-spline basis functions in calculations further.