A B-Spline Curve Extension Algorithm
A B-Spline Curve Extension Algorithm
Information Sciences
. RESEARCH PAPER . March 2016, Vol. 59 032103:1–032103:9
doi: 10.1007/s11432-015-5322-x
Received October 17, 2014; accepted January 12, 2015; published online November 23, 2015
Abstract B-spline curve extension is an important operation in computer aided design systems. In this paper,
we present a new extension algorithm for B-spline curves. The algorithm uses curve unclamping to generate
a uniform B-spline curve segment from the original curve and gradually extends the segment to pass through
every target point. Algorithms of uniform B-spline curves are used such that our algorithm has a low time cost
and can easily handle arbitrary-order derivative constraints at the target points. Generalization for non-uniform
rational B-spline curve extension is also discussed, and examples show the efficiency of our method.
Citation Lu Y, Shi K L, Yong J H, et al. A B-spline curve extension algorithm. Sci China Inf Sci, 2016, 59(3):
032103, doi: 10.1007/s11432-015-5322-x
1 Introduction
B-spline curve extension is a basic operation in computer aided design systems [1]. Given an original
curve P (t) and several target points {Ri }, curve extension methods aim to find a resulting curve Q(t),
which contains all the curve points of P (t) and also passes through every target point Ri .
Curve extension is useful in many practical applications, such as curve blending, curve interpolation,
and curve approximation. For instance, an original curve can be extended to the end point of another
curve so as to implement the operation of curve blending [2]. Since the resulting curve passes through
every target point, curve extension can also be treated as a solution for curve interpolation [3]. In curve
approximation, curve extension can be used to extend the initial curve to the selected key points step by
step so as to gradually improve the fitting accuracy [4].
The widely used algorithm for B-spline curve extension was proposed by Hu et al. [1]. They used
curve unclamping to extend the original curve. One new control point was added for each target point
and evaluated through the inverse process of the de Boor algorithm. Assuming that the degree of the
original B-spline curve is p, the extension curve would have C p−1 continuity with the original curve at the
joint point. Based on the work of Hu et al. [1], the following two papers mainly focused on handling the
* Corresponding author (email: guhejin@vip.163.com)
c Science China Press and Springer-Verlag Berlin Heidelberg 2015 info.scichina.com link.springer.com
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:2
continuity constraints at the target points. Chen et al. [4] used the method of undetermined coefficients
to control the tangent direction of each target point. Liu et al. [2] added three new control points to the
extension curve for each target point so as to fit G2 constraints at the target points. Other extension
methods were also studied. Shetty and White [5] and Zhou et al. [6] directly generated a G2 curve
segment between the original curve and the target point for curve extension. Fan et al. [7], Mo et al. [8],
and Xu et al. [9] used cubic B-spline curves for extension and focused on optimal shape control. Xu [10]
extended the original curve to only part of the target points and used the remaining points for curve
approximation. Zhang et al. [11, 12] focused on the extension problem for disk/ball B-spline curves.
There is still room to improve the method of Hu et al. [1]. Their method has a relatively high time cost,
and derivative constraints cannot be directly specified for each target point. In this paper, we propose
a new extension method, which has a low time complexity and can handle arbitrary-order derivative
constraints for each target point. In our method, operations of curve clamping and unclamping are used,
and algorithms of uniform B-spline curves are applied. We first present our method for B-spline curves,
and then generalize it to handle non-uniform rational B-spline (NURBS) curves.
The rest of the paper is organized as follows. Section 2 introduces the concept of clamped/unclamped
and uniform B-spline curves. Section 3 presents our extension algorithm for B-spline curves, and Section 4
generalizes the method for NURBS curve extension. Section 5 analyzes the time cost and presents several
examples. Section 6 concludes the paper.
2 Preliminaries
2.1 Clamped and unclamped B-spline curves
where {Pi | i = 0, 1, . . . , n} are the control points and {Ni,p (t)} are the pth-degree B-spline basis functions
defined on knot vector T = {t0 , t1 , . . . , tn+p+1 } [13].
A B-spline curve is called clamped if its knot vector T satisfies t0 = t1 = · · · = tp and tn+1 = tn+2 =
· · · = tn+p+1 . Otherwise, it is called unclamped. In most cases, we use only clamped B-spline curves,
but unclamped B-spline curves are still useful.
Clamped and unclamped B-spline curves can be converted to each other through the operations of
knot insertion and removal [13].
We call an unclamped B-spline curve P (t) (as defined in (1))uniform if its knot vector is evenly distributed,
which means t1 − t0 = · · · = tn+p+1 − tn+p = ∆.
Evaluation of a uniform B-spline curve is simple, since its basis functions are all translates of one
another. If P (t) is uniform, we can compute its curve point through the formula:
The following method can be used to compute the matrix Mp for arbitrary values of p.
Consider a uniform B-spline curve Q(t) defined on t ∈ [0, 1] with degree p, control points {Qi | 0 6 i 6
p}, and knot vector {−p, −p+1, . . . , p+1}. First, we clamp the curve to knot vector {0, 0, . . . , 0, 1, . . . , 1, 1}
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:3
to make it a Bézier curve [13]. Assume {Pi } are the control points after clamping. Then, we can compute
the curve points through the formula:
Q(t) = [B0,p (t), B1,p (t), . . . , Bp,p (t)][P0 , P1 , . . . , Pp ]T ,
where {Bi,p (t) = Cni ti (1 − t)n−i | 0 6 i 6 p} are the Bernstein basis functions. Denote W1 as a transform
matrix from the power basis to the Bernstein basis, and W2 as a transform matrix from control points
{Qi } to control points {Pi }.
[B0,p (t), B1,p (t), . . . , Bp,p (t)] = [tp , tp−1 , . . . , 1] W1 ,
[P0 , P1 , . . . , Pp ]T = W2 [Q0 , Q1 , . . . , Qp ]T .
Then, we have
Q(t) = [tp , tp−1 , . . . , 1] W1 W2 [Q0 , Q1 , . . . , Qp ]T .
It follows that Mp = W1 W2 .
W1 can be computed through the following formula:
(
p−i−j
i,j Cpj × Cp−j × (−1)p−i−j , if i + j 6 p,
W1 =
0, otherwise,
where W1i,j (0 6 i, j 6 p) is the element of W1 at the ith row and jth column.
W2 can be computed through curve clamping. Assign control points of the uniform curve {Qi | 0 6
i 6 p} as the ordinary basis vectors of the (p + 1)-dimension space
(Qi = 0, . . . , 0, 1, 0, . . . , 0)T ,
| {z } | {z }
i−1 p−i+1
and call the curve clamping algorithm to get the control points of the clamped curve {P i | 0 6 i 6 p}.
Then, we have
W2 = [P 0 , P 1 , . . . , P p ]T .
After W1 and W2 are determined, Mp can be computed through Mp = W1 W2 .
where t0 = · · · = tp and tn+1 = · · · = tn+p+1 . We need to extend it to the target points {Ri | 1 6 i 6 s},
(0) (1) (m )
and fit high-order derivative constraints {Ri , Ri , . . . , Ri i } at each target point (0 6 mi < p).
The original domain of P (t) is defined over the interval [tp , tn+1 ]. If a new control point Pn+1 and
a new knot tn+p+2 are added to the curve, its domain will expand to [tp , tn+2 ]. Notice that the point
Pn+1 only affects P (t) in the interval [tn+1 , tn+2 ], and the shape of P (t) within its origin domain remains
unchanged. So, P (t) can be extended to a target point R by just setting P (tn+2 ) = R and solving the
value of Pn+1 . The method of Hu et al. [1] used the inverse process of the de Boor algorithm to evaluate
new control points, which has a relatively high time cost and is hard to handle derivative constraints at the
target points. To overcome this problem, our algorithm uses another way to evaluate new control points.
Our basic idea is using uniform B-spline curves to generate the extension curve. The algorithm consists
of three steps. First in preprocessing, we construct a uniform B-spline curve that shares the same
boundary with the input curve P (t) and regard it as a new input curve. Second in the main process, we
extend the uniform B-spline curve step by step, with one more target point added in each step. Third in
postprocessing, we clamp the resulting curve and join it together with P (t) to get the final result.
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:4
3.1 Preprocessing
Assume that knot tn has multiplicity xn in knot vector T1 . For the input curve P (t), we insert knot
tn for p − xn times so as to split it into two B-spline sub-curves Pl (t) and Pr (t). Pl (t) is defined over
{tp , . . . , tp , tp+1 . . . , tn−1 , tn , . . . , tn } and Pr (t) is defined over {tn , . . . , tn , tn+1 , . . . , tn+1 }.
| {z } | {z } | {z } | {z }
p+1 p+1 p+1 p+1
Set δ = tn+1 − tn . Since Pr (t) is a Bézier curve, we use curve unclamping to convert it to a uniform
B-spline curve C0 (t), with control points {Qi | 0 6 i 6 p} and knot vector {r0 , r1 , . . . , r2p , r2p+1 }, where
ri = tn + (i − p)δ.
C0 (t) is uniform and completely coincides with P (t) at the right-side end point, so from now on we
regard C0 (t) as the new input curve.
We implement the extension algorithm step by step. In each step, one more target point is added
to the current curve. Without loss of generality, we consider step k (1 6 k 6 s). Before this step,
the original curve has become Ck−1 (t), with control points {Qi | 0 6 i 6 nk−1 } and knot vector
Pk−1
{r0 , r1 , . . . , rnk−1 +p+1 }, where nk−1 = p + i=1 (mi + 1). At step k, we need to extend Ck−1 (t) to target
(1) (2) (m )
point Rk , with the specified derivatives {Rk , Rk , . . . , Rk k }. The extension result will be Ck (t), with
control points {Qi | 0 6 i 6 nk } and knot vector {r0 , r1 , . . . , rnk +p+1 }, where nk = nk−1 + mk + 1.
Now mk + 1 new control points {Qnk−1 +1 , Qnk−1 +2 , . . . , Qnk } remain unknown. We compute their
values from the following derivative constraints:
(m) (m)
Ck (rnk +1 ) = Rk , 0 6 m 6 mk , (4)
(m)
where Ck (t) is the mth-order derivative of Ck (t).
A recurrence formula is required to compute high-order derivatives for ordinary B-spline curves, but
it is much easier for uniform B-spline curves. The derivative of a B-spline curve P (t) can be computed
through the following formula [13]:
n−1
X p(Pi+1 − Pi )
P ′ (t) = Ni+1,p−1 ,
i=0
ui+p+1 − ui+1
where {Pi } are the control points and {ui } are the knots. P ′ (t) is also a B-spline curve. Since (ui+p+1 −
ui+1 )/p = ∆ is a constant value for uniform B-spline curves, we can further compute the high-order
derivatives using the formula:
n−m
X (m)
P (m) (t) = Ni+m,p−m (t)Pi ,
i=0
where 0 6 m < p and
m
(m) 1 X j
Pi = C (−1)m−j Pi+j .
∆m j=0 m
That is to say, the mth-order derivative of a pth-degree uniform B-spline curve P (t) is also a uniform
(m)
B-spline curve, with degree (p − m) and control points {Pi | 0 6 i 6 n − m}.
(m)
From above, we know that Ck (t) is also a uniform B-spline curve, with degree (p − m) and control
points
m
(m) 1 X
j
{Qi = m Cm (−1)m−j Qi+j | 0 6 i 6 nk − m . (5)
δ j=0
Since Ck (t) is uniform, we can use (2) to compute its curve points. Consider a knot rl that lies in the
interval [rl , rl+1 ]. Set u = 0 in (2), and we have
p
X
Ck (rl ) = Mpp,i Ql−p+i ,
i=0
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:5
where Mpp,i is the element of Mp at the pth row and ith column. Notice that rl also lies in the inter-
val [rl−1 , rl ], so the curve point at knot rl does not depend on Ql , which means the element Mpp,p is
always zero.
(m)
Similarly, since Ck (t) is uniform, we can compute its value at the end point rnm +1 using
p−m−1
X
(m) p−m,i (m)
Ck (rnk +1 ) = Mp−m Qnk −p+i+1 . (6)
i=0
where
min(l,p−m−1)
X p−m,i l−i
wm,l = Mp−m Cm (−1)m−l+i . (8)
i=max(0,l−m)
p−m
X k −2
(m)
Bm = δ m Rk − wm,l Qnk −p+l+1 . (10)
l=0
Solve this linear system to get the values of control points {Qi }. Then, the resulting curve Ck (t) is
determined.
3.3 Postprocessing
After s steps, all the target points are added to the curve, and the right segment Pr (t) of P (t) becomes
the extension result Cs (t). Now we join it together with the left segment Pl (t) to get the final result.
Clamp curve Cs (t) to knot vector {rn , . . . , rn , rn+1 . . . , rns , rns +1 , . . . , rns +1 } , join the curve Pl (t) and
| {z } | {z }
p+1 p+1
Cs (t) together, and remove the joint knot tn for (p − xn ) times. Then, the final curve is determined, and
its knot vector is
P
where ns = si=1 (mi + 1). The curve has n + ns + 1 control points.
The overall algorithm is shown in Algorithm 1.
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:6
and postprocessing steps consist of a curve splitting, a curve unclamping, a curve clamping, and a curve
joining, respectively, among which each operation costs Θ(p2 ). So, the whole time cost of our algorithm
Ps
is Θ(p2 + p i=0 (mi + 1)2 ).
Compared with the method of Hu et al. [1], our method has a lower time complexity. Hu et al. [1] used
the inverse process of the de Boor algorithm to evaluate the new control points, which costs Θ(p2 ) in
every step. Assuming that the count of target points is s, their method has a time complexity of Θ(sp2 ).
Meanwhile, if derivative constraints are not demanded at every target point, the time complexity of our
method will be only Θ(p2 + sp), which is better than theirs.
Table 1 shows the time comparison between our method and Hu et al. [1]. The degree of original
B-spline curves ranges from 4 to 5, and the count of target points ranges from 8 to 64. The points are
randomly located in 3D space. We run the process 10000 times for each case and record the average
execution time. As shown in Table 1, as the degree of curves and the count of target points increase, the
time efficiency of our method also rises.
We illustrate several results of our method as the following. A simple example is shown in Figure 1.
We extend the initial curve to multiple target points so as to construct the outer contour of a sport utility
vehicle (Figure 1(a)).
In Figure 2, we use our method to draw the shape of character ‘@’. In Figure 3, we use our method to
reconstruct the shape of a human face profile. In these examples, we first manually specify some simple
initial curves, and then sample the target points from original pictures. Tangent vectors are also specified
to improve the shapes of resulting curves.
Figure 4 shows an example of constructing a closed curve. We extend the original curve from one end
to the other, such that the resulting curve is closed.
6 Conclusion
This paper presents an algorithm for B-spline curve extension. We construct a uniform B-spline curve
from the original curve and use it to generate extension curves. Operations of uniform B-spline curves are
more efficient than normal B-spline curves, so our method is simple and fast. Assuming that the curve
degree is p and the count of target points is s, our method only costs a time complexity of Θ(p2 + sp),
while the method of Hu et al. [1] costs a time complexity of Θ(sp2 ). Arbitrary-order derivative constraints
at the target points can be specified in our method. Generalization for NURBS curve extension is also
discussed.
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:8
(a) (b)
(c)
Figure 1 (Color online) Constructing outer contour of a sport utility vehicle. (a) The original picture, (b) the initial
B-spline curve and sampling points, and (c) the resulting curve.
@
(a) (b) (c)
Figure 2 (Color online) Drawing the shape of character ‘@’. (a) The standard shape of the symbol “@”, (b) the initial
curve, target points, and tangent vectors, and (c) the resulting curve.
Figure 3 (Color online) Reconstructing human face profile. (a) The discrete points from original input data; (b) the
target points sampled from (a) and the estimated tangent vectors; (c) the resulting curve.
(a) (b)
(c)
Figure 4 (Color online) Example of a closed curve. (a) illustrates an ideal dumb-bell shape. (b) shows the sampled target
points and the estimated tangent vectors. (c) shows the resulting curve of our method, whose shape is close to (a).
Lu Y, et al. Sci China Inf Sci March 2016 Vol. 59 032103:9
7 Future work
In some cases where input points are irregularly distributed, our extension method may produce unex-
pected shapes as we use global uniform knot values. The method of Hu et al. [1] used the chord-length
parameterization to generate new knots and also suffers from this problem. In this case, it is still a
challenging problem to generate a reasonable shape with a low time cost.
An important application of curve extension is B-spline curve approximation of other known curves.
The basic idea is taking input points sampled from the input curve and extending the initial B-spline
curve to these points. Chen et al. [3, 4] have done some research on this topic and used the tangent
directions of sampled points for curve extension. Since our extension method can specify high-order
derivatives at each point, these approximation methods may be further improved.
Acknowledgements The research was supported by International Science & Technology Cooperation Program
of China (Grant No. 2013DFE13120). Kanle SHI was supported by National Natural Science Foundation of China
(Grant No. 61272235) and Open Funding Project of State Key Laboratory of Virtual Reality Technology and
Systems, Beihang University (Grant No. BUAA-VR-14KF-05). Junhai YONG was supported by National Natural
Science Foundation of China (Grant No. 91315302). Haichuan SONG was supported by National Natural Science
Foundation of China (Grant No. 61173077).
Conflict of interest The authors declare that they have no conflict of interest.
References
1 Hu S M, Tai C L, Zhang S H. An extension algorithm for B-splines by curve unclamping. Comput Aid Des, 2002, 34:
415–419
2 Liu Y J, Qiu R Q, Liang X H. NURBS curve blending using extension. J Zhejiang Univ Sci A, 2009, 10: 570–576
3 Chen X D, Ma W. Geometric point interpolation method in R3 space with tangent directional constraint. Comput
Aid Des, 2012, 44: 1217–1228
4 Chen X D, Ma W, Paul J C. Cubic B-spline curve approximation by curve unclamping. Comput Aid Des, 2010, 42:
523–534
5 Shetty S, White P. Curvature-continuous extensions for rational B-spline curves and surfaces. Comput Aid Des, 1991,
23: 484–491
6 Zhou Y F, Zhang C M, Gao S S. Extension of B-spline curves with G2 continuity. In: Proceedings of Advances in
Visual Computing. Berlin: Springer, 2008. 1096–1105
7 Fan H, Zhang C M, Li J J. Extension algorithm for B-splines with GC 2 -continuous (in Chinese). Chin J Comput,
2005, 28: 933–938
8 Mo G L, Zhao Y N. A new extension algorithm for cubic B-splines based on minimal strain energy. J Zhejiang Univ
Sci A, 2006, 7: 2043–2049
9 Xu G, Wang G Z. Extensions of uniform cubic B-spline curve with local shape parameters (in Chinese). J Comput
Res Develop, 2007, 44: 1032–1037
10 Xu J. Smooth B-spline curves extension with ordered points constraint. Adv Mater Res, 2011, 311: 1439–1445
11 Zhang T, Wang X, Jiang Q, et al. G2 -continuity extension algorithm for disk B-spline curve. In: Proceedings of
Computer-Aided Design and Computer Graphics (CAD/Graphics), Guangzhou, 2013. 413–414
12 Jiang Q, Wu Z, Zhang T, et al. An extension algorithm for ball B-spline curves with G2 continuity. In: Proceedings
of International Conference on Cyberworlds, Yokohama, 2013. 252–258
13 Piegl L A, Tiller W. The NURBS Book. Berlin: Springer-Verlag, 1995
14 Mortenson M E. Geometric Modeling. New York: Wiley, 1985