A Tutorial On Uniform B-Spline: 1 Cox-De Boor Formula
A Tutorial On Uniform B-Spline: 1 Cox-De Boor Formula
Yi Zhou
arXiv:2309.15477v1 [cs.GR] 27 Sep 2023
1
How to read the Cox-de Boor formula (Eq. 3)?
To read the formula, we need to understand the meaning of the subscripts of the
basis function. The first subscript i is associated to the corresponding control point Pi
(which shares the same index i). It is also associated to the index of the very left knot
(i.e., τi ) in the corresponding non-zero domain (see the triangular computation scheme
in [1]). The second subscript k denotes the degree of the basis function. The higher
the degree, the wider the non-zero domain. In other words, the non-zero domain can
be determined by the two subscripts, namely [τi , τi+k+1 ] for Bi,k as an example.
The Cox-de Boor formula can be read as: The basis function of degree k at position
i is derived from two subordinate basis functions of degree k − 1 at position i and
i + 1, respectively. The polynomial weights can be regarded as “linear interpolation
coefficients”1 normalized by the width of the corresponding non-zero domain, which
can be calculated as the 2nd subscript +1+ the 1st subscript − the 1st subscript,
namely the 2nd subscript +1. In other words, the width of the non-zero domain for
Bi,k is (k + 1)∆τ .
2
a0 0 0 0 0 0
a1 a0 0 0 0 0
..
.. ..
. . . 0 0 0
T= , (5)
.. ..
an
... . . 0 0
.. ..
0 an ... . . 0
0 0 an ... a1 a0
whose elements are the coefficients of the following polynomial,
f (x) = a0 + a1 x + . . . + an xn (n ̸= 0). (6)
(⋆) Toeplitz matrix can also be used to represent the product of two polynomials.
Here is a specific example. Let
g(x) = c0 + c1 x + . . . + c2 x2 ,
q(x) = d0 + d1 x + . . . + d3 x3 .
One can obtain the product f (x) = g(x)q(x) in the matrix representation as,
c0 0 0 0 0 0 d0
c1 c0 0 0 0 0 d1
c2 c1 c0 0 0 0 d2
f (x) = X 0 c2 c1 c0 0 0 d3
(7)
0 0 c2 c1 c0 0 0
0 0 0 c2 c1 c0 0
c0 0 0 0
c1 c0 0 0 d0
c2 c1 c0 0 d1
= X 0 c2 c1 c0 d2 ,
0 0 c2 c1 d3
0 0 0 c2
where X = [1, x, x2 , · · · , x5 ]. Note that the dimension (row) of the coefficient matrix
is defined by the degree of the variable (i.e., 5 + 1 = 6).
3
{·}
where N{·,·} denotes the coefficients of the polynomial. The colors of the super-/sub-
{·}
scripts specify the association. Note that the superscript of N{·,·} is only a symbol that
specifies the association to the power of variable u rather than a power.
The following is the derivation of the basis translation originating from Eq. 3.
τ − τi τi+k+1 − τ
Bi,k (τ ) = Bi,k−1 (τ ) + Bi+1,k−1 (τ )
τi+k − τi τi+k+1 − τi+1
(τj+1 − τj )(τ − τj + τj − τi )
= Bi,k−1 (τ )
(τj+1 − τj )(τi+k − τi )
(τj+1 − τj )(τi+k+1 − τj + τj − τ )
+ Bi+1,k−1 (τ )
(τj+1 − τj )(τi+k+1 − τi+1 )
τj − τi τ − τj τj+1 − τj
= + Bi,k−1 (τ )
τi+k − τi τj+1 − τj τi+k − τi
τi+k+1 − τj τ − τj τj+1 − τj
+ − Bi+1,k−1 (τ ), (9)
τi+k+1 − τi+1 τj+1 − τj τi+k+1 − τi+1
where τ ∈ [τj , τj+1 ]. In a specific case (k = 3), the non-zero domain is [τ3 , τ4 ]
(namely j = 3), and i = 0, 1, · · · , 3. Let
τ − τj
u= , (10)
τj+1 − τj
τj − τi τj+1 − τj
d0i = , d1i = , (11)
τi+k − τi τi+k − τi
τi+k+1 − τj τj+1 − τj
h0i = , h1 = − , (12)
τi+k+1 − τi+1 i τi+k+1 − τi+1
0
with the convention 0 = 0. Then Eq. 9 turns to
Bi,k (u) = (d0i + u d1i )Bi,k−1 (u) + (h0i + u h1i )Bi+1,k−1 (u). (13)
Using property (⋆), Eq. 13 can be represented by a matrix. Here, for simplicity, we use
a specific case (k = 3) as an example,
d0i
0
( Ni,2 0 | 0 0 1
2 3
Ni,21
N 0
i,2 | 0 0 di
Bi,3 = [1 u u u ] 2 1 0
−
Ni,2 Ni,2 | Ni,2 0 0
2 1 0
0 Ni,2 | Ni,2 Ni,2
0
0
0 hi
Ni+1,2 0 | 0 0 1 )
1
Ni+1,2 N 0
i+1,2 | 0 0 hi
+ 2 1 0
− , (14)
Ni+1,2 Ni+1,2 | Ni+1,2 0
2 1 0
0
0 Ni+1,2 | Ni+1,2 Ni+1,2
0
{·}
where N{·,·} refers to the coefficients of polynomial Bi,k , and their superscripts still
do not represent a power.
4
3 Representing B-Spline Curves with Basis Matrices
3.1 General Matrices for NURBS
Based on the basis translation introduced in Eq. 8, the B-spline formula (Eq. 1) can be
represented as X
P(u) = Bi,k (u)Pi . (15)
i=0
where u = ττ4−τ k
−τ3 ∈ [0, 1]. The matrix M (j) is referred to as basis matrix. The core
3
of this section is to derive the recursive formula for the basis matrices of B-splines of
degree k.
5
According to Eq. 14, the basis matrix M3 (3) can be represented as
0 0
N0,3 0 0 0 0 N1,3 0 0
1
N0,3 1
0 0 0 + 0 N1,3 0 0
M3 (3) =
2 2
N0,3 0 0 0 0 N1,3 0 0
3 3
N0,3 0 0 0 0 N1,3 0 0
0 0
0 0 N2,3 0 0 0 0 N3,3
0 0 N2,3 1 1
0
+ 0 0 0 N3,3
+ 2
0 0 N2,3 0 0 0 0 N3,3 2
3 3
0 0 N2,3 0 0 0 0 N3,3
0 0
N0,2 0 N1,2 0
1 0 1 0
d00 0 0 0
0
N0,2 N0,2 N1,2 N1,2 h0 0 0 0
= 2 1
+
N0,2 N0,2 d10 0 0 0 2
N1,2 1
N1,2 h10 0 0 0
2 2
0 N0,2 0 N1,2
0 0
N1,2 0 N2,2 0
1 0 1 0
0 d01 0 0 0 h01 0 0
N1,2 N1,2 N2,2 N2,2
+ 2 1
+
N1,2 N1,2 0 d11 0 0 2
N2,2 1
N2,2 0 h11 0 0
2 2
0 N1,2 0 N2,2
0 0
N2,2 0 N3,2 0
1 0 1 0
0 0 d02 0 0 0 h02 0
N2,2 N2,2 N3,2 N3,2
+ 2 1
+
N2,2 N2,2 0 0 d12 0 2
N3,2 1
N3,2 0 0 h12 0
2 2
0 N2,2 0 N3,2
0 0
N3,2 0 N4,2 0
1 0 1 0
0 0 0 d03 0 0 0 h03
N3,2 N3,2 N4,2 N4,2
+ 2
1
+ 2
N3,2 N3,2 0 0 0 d13 N4,2 N4,21
0 0 0 h13
2 2
0 N3,2 0 N4,2
0 0
N0,2 0 N1,2 0
1 0 1 0
d00 0 0 0
0
h0 d01 0 0
N0,2 N0,2 N1,2 N1,2
= 2
1
+ 2
N0,2 N0,2 d10 0 0 0 N1,2 N1,21
h10 d11 0 0
2 2
0 N0,2 0 N1,2
| {z }
=0
0 0
N2,2 0 N3,2 0
1 0 1 0
h01 d02 h02 d03
N2,2 N2,2 0 0 N3,2 N3,2 0 0
+ 2
1
+
N2,2 N2,2 0 h11 d12 0 2
N3,2 1
N3,2 0 0 h12 d13
2 2
0 N2,2 0 N3,2
0
N4,2 0
1 0
h03
N4,2 N4,2 0 0 0
+ 2
1
. (17)
N4,2 N4,2 0 0 0 h13
2
0 N4,2
| {z }
=0
The first and last terms in Eq. 17 equal to 0, because the corresponding basis functions
(i.e., B0,2 and B4,2 ) are not defined in [τ3 , τ4 ] (see the triangular computation scheme
6
in [1]).
0
N1,2 0
N1,21 N1,2 0
0 0 1 1
Eq. 17 = 2 h0 d1 0 0 + N 1 h0 d1 0 0
N1,2 1,2
2
0 N1,2
0
N2,2 0
N2,21 N2,2 0
0 0 1 1
+ 2 0 h1 d2 0 + N 1 0 h1 d2 0
N2,2 2,2
2
0 N2,2
0
N3,2 0
N3,21 N3,2 0
0 0 1 1
+ 2 0 0 h2 d3 + N 1 0 0 h2 d3
N3,2 3,2
2
0 N3,2
0 0 0
N1,2 N2,2 N3,2 0
d01 0 0
N1,21 1 1 h0
N2,2 N3,2
=N1,22 2 2 0 h01 d02 0
N2,2 N3,2
0 0 h02 d03
0 0 0
0 0 0 1
d11 0 0
N1,20 0 0 h0
N 2,2 N 3,2
+N1,21 1 1 0 h11 d12 0
N2,2 N3,2
2 2 2 0 0 h12 d13
N1,2 N2,2 N3,2
2 h00 d01 0 0 T h10 d11
0 0
(Eq. 16) M (3) 0
= 0 h01 d02 0 + 0 h11 d12 0
0T 0 0 M2 (3)
0 0 h2 d3 0 0 h12 d13
0 0
2 1 − d1 d1 0 0
M (3) 0 0
= 0 1 − d d 0
0T 2 2
0 0 1 − d03 d03
T −d11 d11
0 0
0
+ 0 −d12 d12 0 , (18)
M2 (3)
0 0 −d13 d13
and M0 (3) = B3,0 (u) = 1, where u = ττ4−τ −τ3 ∈ [0, 1]. To understand the second
3
last equation, please recall Eq. 16 that the basis matrix M is made up by coefficients
of the polynomials (basis functions). To further help memorizing the elements of the
basis matrix, please refer to Fig. 1. To construct basis matrix Mk (j), just look up the
column with the corresponding degree (the second subscript) in the blue triangle, and
then apply Eq. 16.
Eq. 18 can be regarded as the recursive definition of basis matrix. It can be used in
the symbolic computation of NURBS.
7
Figure 1: The triangular computation scheme of B-spline.
and M0 (j) = 1.
8
k + (k + 1) + 1
| {z }
# knots
Note that (⋆⋆) holds based on the fact that j = 2 − 1 = k. Unlike
the basis matrices of NURBSs, the basis matrices of uniform B-splines of degree k are
independent of tj . The basis matrices for uniform B-splines are given as follows:
M0 (j) = 1,
1 0
M1 (j) = ,
−1 1
1 1 0
1
M2 (j) = −2 2 0 ,
2!
1 −2 1
1 4 1 0
3 1 −3 0 3 0
M (j) = (20)
3! 3 −6 3 0
−1 3 −3 1
..
.
P3
where B̃i,k = s=i Bs,3 (u). Specifically,
Following the format in Eq. 16, the differential cumulative formula (Eq. 21) can be
9
represented, by dropping off u for simplicity, as
T
P0
T
dT1
P(u) = [B̃0,3 B̃1,3 B̃2,3 B̃3,3 ] T
d2
dT3
(
= [B0,3 B1,3 B2,3 B3,3 ] + [B1,3 B2,3 B3,3 0] + · · ·
) PT0
dT1
+ [B2,3 B3,3 0 0] + [B3,3 0 0 0]
dT2
dT3
(
= [1 u u2 u3 ] [m0 m1 m2 m3 ] + [m1 m2 m3 0]
) PT0
dT1
+ [m2 m3 0 0] + [m3 0 0 0]
dT2
dT3
T
P0
P3 P3 P3 dT1
= [1 u u2 u3 ] · s=0 ms | s=1 ms | s=2 ms | m3
dT2
dT3
0 PT0
6 5 1
1 0 3 3 0 T
(substitute Eq. 20)
[1 u u2 u3 ] · d1T
=
3! 0 −3 3 0 d2
0 1 −2 1 dT3
T
P
i T0
d1
h
= 1 5+3u−3u2 +u3 1+3u+3u2 −2u3 u3
6 6 6 dT
2
dT3
| {z }
λ
3
X
= PT0 + λi (u)dTi , (23)
i=1
τ −τ3
where λ0 = 1, u = τ4 −τ3 ∈ [0, 1].
4 FAQs
• Q1: Knots vs Control Points
A: Knots are a list of positions in the parametric domain (i.e., τi ∈ [0, 1].) For
uniform B-splines, knots are evenly distributed in the parametric domain. The
number of knots is determined if the degree of B-spline is known (see Sec.1).
10
Control points are design parameters from human’s input. Once the degree k is
set and the control points are provided, one can evaluate the value at any given
position τ in the non-zero domain, which is spanned by the two knots in the
middle (e.g., [τ3 , τ4 ] for a B-spline of degree 3).
Some papers, such as [5], somehow treat knots and control points identically.
This is not consistent with the majority of the literature. Thus, we regard that
in [5] as an improper (wrong) definition; better not use it.
• Q2: How to understand basis translation?
This is actually a trivial operation (see Eq. 10). However, I felt confused when I
read the descriptions in academic papers (e.g., the 2nd paragraph in Section 4.2
of [5], and in Sec. IV of [3].) The confusion is caused mainly by the inconsistent
symbolic definition and descriptions. In general, the basis translation just sim-
ply translates and re-scales the non-zero domain to [0, 1] such that the numerical
stability is preserved.
References
[1] B-spline basis functions: Definition. https://pages.mtu.edu/˜shene/
COURSES/cs3621/NOTES/spline/B-spline/bspline-basis.
html.
[2] Carl De Boor. On calculating with b-splines. Journal of Approximation theory,
6(1):50–62, 1972.
[3] Wenchao Ding, Wenliang Gao, Kaixuan Wang, and Shaojie Shen. An efficient
b-spline-based kinodynamic replanning framework for quadrotors. IEEE Transac-
tions on Robotics, 35(6):1287–1306, 2019.
[4] Kaihuai Qin. General matrix representations for b-splines. The Visual Computer,
16(3-4):177–186, 2000.
[5] Christiane Sommer, Vladyslav Usenko, David Schubert, Nikolaus Demmel, and
Daniel Cremers. Efficient derivative computation for cumulative b-splines on lie
groups. In Proceedings of the IEEE/CVF Conference on Computer Vision and
Pattern Recognition, pages 11148–11156, 2020.
11