Outline
- Properties of Non-uniform B-splines
- Quiz
- The de Boor Algorithm
Introduction
- Last Thursday, we were introducing B-spline curves in more detail.
- We discussed what properties we would like blending functions of B-splines to possess.
- We gave the de Boor formula, which was a recursive equation for defining order m blending functions
- We looked at some examples of B-spline defined with this equation.
- In particular, we gave an example with evenly spaced knot points, and an example of how to repeat knots
so as to define a degree three Bezier curve.
- Today, we are going to look at some more properties of B-spline curves and numerically stable techniques for
computing points on such curves.
Blending Function Properties
Theorem. Let `u_0 \leq u_1 \leq \ldots \leq u_l` be a knot vector. Then the blending functions
`N_(i,m)(u)`, for `0\leq i \leq l - m` satisfy the following properties:
- `N_(i,m)(u)` has support in `[u_i, u_(i+m)]` for all `m\geq 1`.
- `N_(i,m)(u) \geq 0` for all `u`.
- `\sum_(i=0)^(l-m)N_(i,m)(u) = 1` for all u such that `u_(m-1) \leq u \leq u_(l-m+1)`.
Proof of Theorem
(1) and (2) are straightforward proofs by induction on `m`. We will show (3) in more detail to illustrate how arguments about B-spline blending functions are carried out. In the base case, the functions `N_(i,1)(u)` are step functions with nonzero values on disjoint intervals. i.e., only one of them is 1 at a time and so the sum of these blending functions is 1. Now let's assume (3) holds for `m` and try to show the `m+1` case. Assume `u_m \leq u \leq u_(l-m)`. By the Cox de Boor formula:
`\sum_(i=0)^(l-m-1) N_(i, m+1)(u)`
`= \sum_(i=0)^(l-m-1)(\frac{u-u_i}{u_(i+m)-u_i}N_(i, m)(u) + \frac{u_(i+m+1) - u}{u_(i+m+1)-u_(i+1)}N_(i+1, m)(u))`
`= \frac{u-u_0}{u_(m)-u_0}N_(0, m)(u) + \sum_(i=1)^(l-m-1)(\frac{(u - u_i) + (u_(i+m)-u)}{u_(i+m)-u_i}N_(i, m)(u)) + \frac{u_l-u}{u_(l)-u_(l-m)}N_(l-m, m)(u)`
`= N_(0, m)(u) +\sum_(i=1)^(l-m-1) 1\cdot N_(i,m)(u) + N_(l-m, m)(u)` since `u_(m-1) \leq u \leq u_(l-m+1)`
`=\sum_(i=0)^(l-m) 1\cdot N_(i,m)(u) = 1.`
Smoothness of B-spline Curves
Now that we've seen the style of argument used to show properties of B-splines. Let's look at some more properties. First, let's consider smoothness...
As a B-spline curve is piecewise a polynomial function of the control points, except possibly at control points it will be `C^\infty`. So what happens at control points? Here is a result we state without proof.
Theorem. Let `\vec q(u)` be a B-spline curve of order `m`, and let the knot `u_i` have multiplicity `\mu`. Then the curve `\vec q(u)` has continuous `(m-\mu-1)`th derivative at `u=u_i`.
B-splines near Knots and Endpoints
The next result can also be proven by induction on `k`, it shows the behavior of a degree `k` blending functions when a knot is repeated at least `k` times. This will be useful when we talk about the de Boor algorithm.
Theorem. Let `k\geq 1`.
- Suppose that `u_i=u_(i+k-1) < u_(i+k)`, and so `u_i` has multiplicity at least `k`. Then
`\lim_(u \rightarrow u_i^+)N_(i-1, k+1)(u) = 1`
and, for `j \ne i - 1`,
`\lim_(u \rightarrow u_i^+)N_(j, k+1)(u) = 0`.
- Dually, suppose that `u_(i-1) < u_i = u_(i+k -1)`, and so `u_i` has multiplicity at least `k`. Then
`\lim_(u \rightarrow u_i^-)N_(i-1, k+1)(u) = 1`
and, for `j \ne i - 1`,
`\lim_(u \rightarrow u_i^-)N_(j, k+1)(u) = 0`.
Quiz
Which of the following statements is true?
- In TCB splines the tension parameter is used to model overshoot.
- If a control point changes in a B-spline curve it will always have a global effect on the shape of the curve.
- By repeating knots, a B-spline can be used to represent a Bézier curve.
Preliminaries to the de Boor Algorithm
- The de Boor Algorithm is the B-spline analog of de Casteljau's method for Bézier curves.
- To actually calculate points on a B-spline, it is more numerically stable than calculating values of the
blending functions `N_(i,m)(u)`.
- Suppose `\vec q(u) = \sum_(i=0)^n N_(i,k+1)(u)\vec p_i` is a B-spline of degree `k \geq 1` defined by control points `\vec p_0, \vec p_1, \vec p_2, \ldots, \vec p_n` and by knot vector `[u_0, \ldots, u_(n+k)]`.
- The basis of the de Boor Algorithm is the following theorem which basically follows from using the de Boor formula and regrouping of the sums...
Theorem. For all `u\in [u_k, u_(n+1)]` (or, for all `u\in [u_k, u_(n+1))` if `k=1`),
`\vec q(u) = \sum_(i=1)^n N_(i,k)(u)\vec p_i^((1))(u)` where
`\vec p_i^((1))(u) = \frac{u_(i+k) - u}{u_(i+k) - u_i}\vec p_(i-1) + \frac{u - u_(i)}{u_(i+k) - u_i}\vec p_i`
- `p_i^((1))(u)` is the analog of the points `\vec r_i` of the degree three case of de Casteljau we discussed earlier in the semester.
Iterating the Theorem
- As with de Casteljau, we can iterate the operation of the last slide and define:
`vec p_i^((0))(u) = \vec p_i`,
and for `1\leq j \leq k`,
`\vec p_i^((j))(u) = \frac{u_(i+k-j+1) - u}{u_(i+k-j+1) - u_i}\vec p_(i-1)^((j-1)) + \frac{u - u_(i)}{u_(i + k- j + 1) - u_i}\vec p_i^((j-1))`.
- By induction on `j` using the Theorem of the previous slide we have:
Theorem. Let `0\leq j \leq k`. Let `u\in [u_k, u_n + 1]` (or `u\in [u_k, u_(n+1))` if `j=k`). Then
`\vec q(u) = \sum_(i=j)^n N_(i,k+1-j)(u)\vec p_i^((j))(u).`
The de Boor Algorithm Intuition
- Suppose we are given a value `u_s \leq u < u_(s+1)`, and we want to compute `\vec q(u)`.
- By the last slide, we know if `j=k`, `\vec q(u) = p_s^((k))(u)`. This because the degree zero blending function is equal to 1 on the interval containing `u`.
- We can calculate `p_s^((k))(u)` in terms of `p_(s-1)^((k-1))(u)` and `p_(s)^((k-1))(u)` using the definition of the last slide.
- Each of these two points is defined linearly in terms of two others of order `k-2`, and so on..
- So we can keep expanding `k` times till we get the original control points. This is essentially what the de Boor algorithm does in reverse.
The de Boor Algorithm
Input: (1)A degree k B-spline curve `\vec q` (order `m=k+1`), given by:
Control points `\vec p_0, \vec p_1, \ldots, p_n`,
Knot positions `u_0, u_1, \ldots, u_(n+m)`.
(2) A value `u` such that `u_k \leq u \leq u_(n+1)`.
Result: Return value is `\vec q(u)`.
Algorithm:
If (`u == u_(n+1)`) {
Return `\vec p_n`;
}
Set `s` to be the value such that `u_s \leq u < u_(s+1)`;
If(`u==u_s`) {
Set `\mu = \text{ the multiplicity of } u_s`;
} Else {
Set `\mu = 0`;
}
//Initialize
For l = 0, 1, ..., `k - \mu` {
Set r[l] = `\vec p_(s-k+l)`
}
//Main loop:
For j = 1, 2, ..., `k - \mu` {
For l = 0, 1, ..., k-j {
Set `\alpha = \frac{u - u_(s-k+j+l)}{u_(s+l+1) - u_(s-k+j+l)}`;
Set r[l] = lerp(r[l],r[l+1], `\alpha`); // lerp = linear interpolate function
}
}
Return r[0];