You are on page 1of 10

Journal of Computational and Applied Mathematics 296 (2016) 352–361

Contents lists available at ScienceDirect

Journal of Computational and Applied


Mathematics
journal homepage: www.elsevier.com/locate/cam

An iterative algorithm for G2 multiwise merging of


Bézier curves
Lizheng Lu ∗ , Chengkai Jiang
School of Statistics and Mathematics, Zhejiang Gongshang University, Hangzhou 310018, China

article info abstract


Article history: This paper presents an iterative algorithm for G2 multiwise merging of Bézier curves. By
Received 4 May 2015 using the G2 constraint, the L2 distance is represented after simplification as a quartic
Received in revised form 4 October 2015 polynomial in two parameters relating to the magnitudes of end tangents of the merged
curve. These two parameters are restricted in a feasible region, in order for the merged
Keywords: curve to preserve the specified directions of end tangents. Then G2 multiwise merging
Bézier curve
is formulated as a constrained minimization problem, and the classic projected Newton
Merging
Geometric continuity
method is applied to find the minimizer. Some extensions of multiwise merging using G3
L2 distance constraints, other energy functionals and curve representations are also outlined. Several
Iterative method comparative examples are provided to demonstrate the effectiveness of the proposed
method.
© 2015 Elsevier B.V. All rights reserved.

1. Introduction

Assume that the given are K (≥ 2) segments of adjacent Bézier curves of degrees nk , k = 1, . . . , K , each of which is
defined in terms of the control points Pknk := (pk0 , . . . , pknk )T as

nk
 n
Pk (t ) = Bi k (t )pki = Bnk Pknk , t ∈ [0, 1]. (1)
i=0

Throughout, the notation Bn := Bn0 (t ), . . . , Bnn (t ) is used to denote the row vector of the Bernstein basis of degree n, with
 

Bni (t ) = i t i (1 − t )n−i . The problem of multiwise merging [1,2] aims to find a single degree-n Bézier curve (called merged
n

curve) with control points Rn := (r0 , . . . , rn )T ,


n

R(t ) = Bni (t )ri = Bn Rn , t ∈ [0, 1], (2)
i=0

such that the L2 distance


K  tk+1
  2 K  1
R(t ) − Pk t − tk  dt =
 

 
E= tk ∥Bn Sk Rn − Bnk Pknk ∥2 dt (3)
k=1 tk
 ∆t 
k k=1 0

∗ Corresponding author.
E-mail address: lulz99@163.com (L. Lu).

http://dx.doi.org/10.1016/j.cam.2015.10.007
0377-0427/© 2015 Elsevier B.V. All rights reserved.
L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361 353

is minimized. Here, 0 = t1 < t2 < · · · < tK +1 = 1 is a partition of the interval [0, 1], ∆tk = tk+1 − tk , and Sk Rn represents
the control points of the sub-curve R(t ), t ∈ [tk , tk+1 ] after it is reparametrized to the standard interval [0, 1]. See [1] for the
expression of the (n + 1) × (n + 1) matrix Sk .
In geometric modeling, a complex shape is generally constructed by using multiple segments, with the advantage of
producing more desirable shapes through local adjustment. It is often required to merge multiple adjacent segments into a
single one, while preserving as faithful as possible to the original shape. For this goal, the merging problem is studied as a
minimization problem using some suitable distances such as (3).
To meet certain smoothness requirement in various applications, it is important to impose continuity conditions on
the two endpoints of the merged curve R(t ), which correspond to the initial endpoint of the first segment P1 (t ) and the
terminal endpoint of the last segment PK (t ). As multiple segments are merged at a time, multiwise merging does not need
to consider continuity conditions at the interior endpoints. It is well known [3,4] that in contrast to the classical parametric
continuity (C k ), geometric continuity (Gk ) shares additional parameters that are available for further shape manipulation by
direct assignment or optimization techniques. Noting the fact that geometric continuity is a relaxation of parametrization
(but not a relaxation of smoothness), it is more suitable to use geometric continuity for the merging problem since the
parametrization of unknown merged curve should not be simply taken as that of the first (or last) segment. For instance, G2
continuity (mostly used in applications) is able to retain the positions, tangent directions and curvatures.

1.1. Related work

Most of the existing merging approaches can be categorized into matrix-based approaches. The merging problem was
firstly introduced in 1987 by Hoschek [5], where many segments of curves are approximately converted into a spline curve
through degree reduction and splitting. Although degree reduction was widely investigated by many researchers, merging
has not received adequate attention until Hu et al. [6] proposed a pioneering work of pairwise merging where a pair of
Bézier curves is merged into one segment instead of applying degree reduction twice. Then, merging has become a special
research topic. In terms of matrix representations and operations, many approaches have arisen, including pairwise merging
of B-spline curves [7] and Bézier curves [8,9], and multiwise merging of Bézier curves [10,1] and B-spline surfaces [11]. In
particular, C r ,s multiwise merging in [1] can preserve C r continuity and C s continuity at the two endpoints respectively.
A novel dual approach was proposed by Woźny et al. [2] for C r ,s multiwise merging, which makes use of the advantages of
constrained dual Bernstein basis [12,13]. Remarkably, this approach has lower complexity due to the fast evaluation schemes
of certain connections between Bernstein and dual Bernstein polynomials.

1.2. Contributions

In this paper, we revisit the multiwise merging problem with the constraint of G2 or G3 continuity, and propose an
iterative algorithm based on the projected Newton method. According to the G2 constraint, there are four parameters (i.e., α1 ,
α2 , β1 , β2 in (5)–(8)), and two more parameters by the G3 constraint. Similar to the degree reduction work of Lu [14], we also
find that for G2 multiwise merging, α2 and β2 are both expressed as quadratic polynomials of α1 and β1 when the minimum
of the L2 distance (3) is reached; therefore, the number of independent parameters is reduced to 2, and the L2 distance is a
quartic polynomial in two unknowns.
It is important to note that many geometric modeling applications often require the two parameters α1 and β1 to be
positive, so that the end tangents of the merged curve coincide with the specified directions, referring to (5) and (7). On the
other hand, the values of α1 and β1 indicate the magnitudes of the end tangents. For these reasons, we impose a feasible
region on (α1 , β1 ):
D = (α1 , β1 ) ∈ R2 : 0 < l0 ≤ α1 ≤ u0 , 0 < l1 ≤ β1 ≤ u1 .
 
(4)
By restricting (α1 , β1 ) in the feasible region, the merging problem is changed to a constrained minimization problem which
may be efficiently solved by the projected Newton method, as done in [14] for degree reduction.
Our contributions are summarized as follows:
• An iterative algorithm is proposed for G2 multiwise merging with the feasible region.
• An intuitive interaction tool is provided for shape-preserving merging, in terms of the feasible region.
Compared to the previous C r ,s multiwise merging [1,2], our method produces better results due to the used G2 and G3
constraints. Our method can be regarded as a generalization of the previous pairwise merging [8] which uses C 1 G2 and C 1 G3
constraints. Very recently, Gospodarczyk and Woźny [15] proposed a new method for C r ,s multiwise merging by restricting
all the interior control points of the merged curve in a specified region; whereas our method restricts (α1 , β1 ) in a specified
region.

2. Iterative algorithm for G 2 multiwise merging

Given K segments of adjacent Bézier curves Pk (t ) with control points Pknk , k = 1, . . . , K , G2 multiwise merging amounts
to identifying the control points Rn of the merged curve R(t ), such that the L2 distance is minimized and the G2 constraint
at the endpoints is satisfied.
354 L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361

By the G2 constraint, the first three and last three control points in Rn are determined by [3,4]:
n1
r0 = p10 , r1 = p10 + α1 ∆p10 , (5)
n
2n1 n1 (n1 − 1) n1
r2 = p10 + α1 ∆p10 + α12 ∆2 p10 + α2 ∆p10 , (6)
n n(n − 1) n(n − 1)
nK
rn = pKnK , rn−1 = pKnK − β1 ∆pKnK −1 , (7)
n
2nK nK (nK − 1) nK
rn−2 = pKnK − β1 ∆pKnK −1 + β12 ∆2 pKnK −2 + β2 ∆pKnK −1 , (8)
n n( n − 1 ) n(n − 1)

where α1 , α2 , β1 , β2 ∈ R, and the forward difference operator ∆ is defined by ∆pki = pki+1 − pki and by ∆r pki =
∆r −1 pki+1 − ∆r −1 pki for r > 1.
The merged curve is rewritten as
n −3

R(t ) = Bn0 (t )r0 + Bn1 (t )r1 + Bn2 (t )r2 + Bnn−2 (t )rn−2 + Bnn−1 (t )rn−1 + Bnn (t )rn + Bni (t )ri .
i =3

f
Let Rcn := (r0 , r1 , r2 , rn−2 , rn−1 , rn )T and Rn := (r3 , . . . , rn−3 )T be the constrained and free control points respectively. Then
the L2 distance in (3) is expanded by
K
  1
E= ∆tk ∥Bn Skc Rcn + Bn Skf Rfn − Bnk Pknk ∥2 dt
k=1 0

K

=(Rcn )T Hcc Rcn + 2(Rfn )T Hfc Rcn + (Rfn )T Hff Rfn − 2(Rcn )T ∆tk (Skc )T Gn,nk Pknk
k=1
K
 K

f
− 2(Rfn )T ∆tk (Sk )T Gn,nk Pknk + ∆tk (Pknk )T Gnk ,nk Pknk (9)
k=1 k=1

n ,m
where Gn,m = (gij )i=0,j=0 ∈ R(n+1)×(m+1) with entries

1
    
1 n m n+m
gij = Bni (t )Bm
j (t )dt =
0 n+m+1 i j i+j

and
K
 K
 K

f f f
Hcc = ∆tk (Skc )T Gn,n Skc , Hfc = ∆tk (Sk )T Gn,n Skc , Hff = ∆tk (Sk )T Gn,n Sk ,
k=1 k=1 k=1

f
with Skc := Sk (· · · ; 0, 1, 2, n − 2, n − 1, n) and Sk := Sk (· · · ; 3, . . . , n − 3) denoting the submatrices of Sk formed by
selecting the specified columns.
f
At first glance, it is natural to determine α1 , β1 , α2 , β2 and Rn using (9) via

min {E := E (α1 , β1 , α2 , β2 , Rfn )}. (10)


f
α1 ,β1 ,α2 ,β2 ,Rn

However, as will be shown in the following subsection, a further analysis reveals that we are able to decrease the complexity
of the problem.

2.1. Simplification

The expression (9) can be simplified through three steps:

1. Express ri = ri (α1 , β1 , α2 , β2 ), i = 3, . . . , m − 3 as quadratic polynomials, which are quadratic in α1 , β1 and linear in


α2 , β2 .
2. Express α2 = α2 (α1 , β1 ) and β2 = β2 (α1 , β1 ) as quadratic polynomials of α1 , β1 .
3. Express E = E (α1 , β1 ) as a quartic polynomial of α1 , β1 .
L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361 355

f
Firstly, assuming that Rcn and Rn are variables, it follows from (9) that

∂E ∂E ∂E ∂E ∂E ∂E ∂E T K
  
:= , , , , , = 2H cc Rc
+ 2H T f
R − 2 ∆tk (Skc )T Gn,nk Pknk , (11)
∂ Rcn ∂ r0 ∂ r1 ∂ r2 ∂ rn−2 ∂ rn−1 ∂ rn n fc n
k =1

∂E ∂E ∂E T K
   f
:= , . . . , = 2H ff Rf
+ 2H fc R c
− 2 ∆tk (Sk )T Gn,nk Pknk . (12)
∂ Rfn ∂ r3 ∂ rn−3 n n
k=1

By (12),

K
 f
Rfn = −Hff−1 Hfc Rcn + Hff−1 ∆tk (Sk )T Gn,nk Pknk (13)
k=1

which implies that ri , i = 3, . . . , m − 3 are quadratic polynomials of α1 , β1 , α2 , β2 .


Secondly, note the following facts: r1 is linear in α1 ; r2 is quadratic in α1 and linear in α2 ; rn−1 is linear in β1 ; rn−2 is
quadratic in β1 and linear in β2 . After substituting (13) into (9), E is a quartic polynomial of α1 , β1 , α2 , β2 and takes the form

α2
  
1  a00 a01
E (α1 , β1 , α2 , β2 ) = α2 β2 + α2 b0 (α1 , β1 ) + β2 b1 (α1 , β1 ) + c (α1 , β1 ) (14)
2 a10 a11 β2
where the constants aij and quadratic polynomials bi (α1 , β1 ) will be derived below, and c (α1 , β1 ) = E (α1 , β1 , 0, 0) by (9)
and (13). From (5)–(8) and (13), it is easy to show that

∂ Rcn T ∂ Rfn T
, = −Hff−1 Hfc 0 ,
 
= 0 0 v0 0 0 0 0 v0 0 0 0
∂α2 ∂α2
∂ Rcn T ∂ Rfn T
, = −Hff−1 Hfc 0 ,
 
= 0 0 0 v1 0 0 0 0 v1 0 0
∂β2 ∂β2
n n
1
where v0 = n(n− 1)
∆p10 and v1 = n(n−
K
1)
∆pKnK −1 . Differentiating by the chain rule gives
∂E T ∂E T
, ,
 
= 2A · 0 0 v0 0 0 0 = 2A · 0 0 0 v1 0 0 (15)
∂α2 ∂β2
where
K
 K
 f
A = (Hcc − HfcT Hff−1 Hfc )Rcn − ∆tk (Skc )T Gn,nk Pknk + HfcT Hff−1 ∆tk (Sk )T Gn,nk Pknk .
k=1 k=1

Using (14) and (15), we obtain

∂ E (α1 , β1 , 0, 0) ∂ E (α1 , β1 , 0, 0)
b0 (α1 , β1 ) = , b1 (α1 , β1 ) = (16)
∂α2 ∂β2
and

∂ 2E ∂ 2E
 
 ∂α 2 ∂α2 ∂β2  2w22 v0 · v0 2w23 v0 · v1
   
a00 a01 2
= = (17)
 ∂ 2E ∂ 2E  2w32 v1 · v0 2w33 v1 · v1

a10 a11
∂β2 ∂α2 ∂β22
 5,5 ∂E ∂E
where wij are the entries of the 6 × 6 matrix W = wij i=0,j=0 := Hcc − HfcT Hff−1 Hfc . By applying ∂α = ∂β = 0 to (14), α2
2 2
and β2 are solved as

−a11 b0 (α1 , β1 ) + a01 b1 (α1 , β1 ) a10 b0 (α1 , β1 ) − a00 b1 (α1 , β1 )


α2 = , β2 = , (18)
a00 a11 − a201 a00 a11 − a201

both of which are linear combinations of quadratic polynomials b0 , b1 and are thus quadratic polynomials of α1 , β1 .
Thirdly, after substituting (18) into (14), E is a quartic polynomial of α1 , β1 .
Based on the above three steps, we finally arrive at the constrained minimization problem:

min {Ê (α1 , β1 ) := E (α1 , β1 , α2 (α1 , β1 ), β2 (α1 , β1 ))}. (19)


(α1 ,β1 )∈D
356 L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361

2.2. Numerical solution

To solve the constrained minimization problem (19), we resort to some numerical methods. Since the objective function
is quartic in two unknowns, it is trivial to compute its gradient and Hessian matrix. The projected Newton method [16] is
employed, which is an iterative method and achieves a quadratic convergence rate.
For numerical optimization, it is advisable to start from an initial point that is not far away from a local minimum. If
(1, 1) ∈ D , (α1 , β1 ) = (1, 1) is initially assigned, which corresponds to the C 1 continuity conditions; otherwise, the initial
value of (α1 , β1 ) can be taken as the central point of D .

3. Extensions

G2 multiwise merging described detailedly in Section 2 can be extended in several ways, with similar derivations. Three
directions are outlined in the following.

3.1. G3 constraint

Other constraints of geometry continuity can be used, e.g., G1,2 constraint, G2,3 constraint, G3 constraint, etc. We do
not suggest to use higher-order geometric continuity of order greater than 3, because G2 continuity and G3 continuity have
sufficient smoothness properties for practical applications and more degrees of freedom should be left to the interior control
points of merged curves for generating more satisfactory results.
For example, G3,2 multiwise merging is briefly described below. In this case, R(t ) and P1 (t ) are G3 continuous at t = 0,
while R(t ) and PK (t ) are G2 continuous at t = 1; hence, besides (5)–(8), the control point r3 is expressed using a new
parameter α3 ∈ R as
3n1 3n1 (n1 − 1) n1 (n1 − 1)(n1 − 2)
r3 = p10 + α1 ∆p10 + α12 ∆2 p10 + α13 ∆3 p10
n n(n − 1) n(n − 1)(n − 2)
3n1 3n1 (n1 − 1) n1
+ α2 ∆p10 + α1 α2 ∆2 p10 + α3 ∆p10 . (20)
n( n − 1 ) n(n − 1)(n − 2) n(n − 1)(n − 2)
In a similar way, the L2 distance is simplified through three steps:

1. Express ri = ri (α1 , α2 , β1 , α3 , β2 ), i = 4, . . . , m − 3 as cubic polynomials, which are cubic in α1 , quadratic in β1 and


linear in α2 , α3 , β2 .
2. Express α3 = α3 (α1 , α2 , β1 ) and β2 = β2 (α1 , α2 , β1 ) as cubic polynomials of α1 , α2 , β1 .
3. Express E = E (α1 , α2 , β1 ) as a sextic polynomial of α1 , α2 , β1 .

Then, a similar constrained minimization problem like (19) is built, but now the objective function is sextic in three
unknowns.

3.2. Energy functional

Obviously, the l2 distance in [10,6,8,1] can be used as the energy functional.


If geometric information of higher-order derivatives of the given curves is considered, then the L2 distance in (3) is further
modified as
 ℓ
dℓ k t − tk 
2 K  tk+1
 2
  d
Ẽ =E + ωℓ 
 dt ℓ R(t ) − P  dt
ℓ=1 k=1 tk dt ℓ ∆t 
k

K  1 K  1 2
  1 d d
∆tk + ω1

= ∥Bn Sk Rn − ∥ Bnk Pknk 2 dt  Bn Sk Rn − k 
Bnk Pnk  dt
k=1 0 k=1
∆tk 0 dt dt
K 1 2 2 2
  
1
 d Bn Sk Rn − d Bn Pk  dt

+ ω2 (21)
k=1
(∆tk )3 0 dt 2
 dt 2 k n k

where the weights ω1 , ω2 ≥ 0 control relative weighting of the three involved terms. Note that Ẽ is identical to E when
ω1 = ω2 = 0 and that the second derivatives are not included in Ẽ when ω1 > 0 and ω2 = 0. We do not suggest to include
third (or higher-order) derivatives in Ẽ, since more weights would be introduced that unavoidably increase the difficulty of
their adjustments.
L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361 357

The whole process of Section 2 can be kept to minimize the new energy functional (21), but with the modification that
n ,m n ,m
for every matrix Gn,m = (gij )i=0,j=0 ∈ R(n+1)×(m+1) , two corresponding matrices Gℓn,m = (gijℓ )i=0,j=0 ∈ R(n+1)×(m+1) , ℓ = 1, 2
are additionally required, where
ℓ m
1
dℓ Bni (t ) d Bj (t )

gijℓ = dt .
0 dt ℓ dt ℓ
Although Gn,n (called the Gram matrix of the Bernstein basis) is symmetric positive definite [1], G1n,n and G2n,n are both
dℓ n dℓ n
n d ℓ n
symmetric positive semidefinite since dt ℓ B0 (t ), . . . , dt ℓ Bn (t ) are linearly dependent by i=0 dt ℓ Bi (t ) ≡ 0, ∀t ∈ [0, 1].

3.3. Curve representation

Let (
u0 (t ), . . . , un (t )) defined on the interval [a, b] be a basis of a function space, and represent the curve in this space as
C(t ) = i=0 ui (t )pi , t ∈ [a, b]. Many kinds of bases and curve representations have been proposed for various applications
n

in CAGD. As is well known, the Bernstein–Bézier representation has gained widespread use in CAGD and related fields,
mainly because it exhibits elegant geometric properties [3,17].
Although we formulate multiwise merging in terms of Bézier curves, multiwise merging of curves in other representa-
tions can also be solved in the same manner. For the extended Chebyshev space
Tα2n = span{cos(kt ), sin(kt ) : t ∈ [0, α]}nk=0 , α ∈ (0, π )
of trigonometric polynomials of degree 2n (order n), a trigonometric curve of degree 2n is defined as the convex combination
(see [18])
2n
Cαn (t ) = α

T2n,i (t )pi , t ∈ [0, α], (22)
i=0

where
i
⌊2⌋ 
α−t  α i−2r
     
α α t α 1  n i−r 
T2n,i (t ) = τ2n,i sin 2n−i
sin i
, τ2n,i := 2 cos
sin2n α2 r =0 i − r
 
2 2 r 2

are the trigonometric normalized B-basis functions. When it comes to implementing multiwise merging of trigonomet-
ric curves,
 α α the subdivision matrices Sk are specified by a de Casteljau-type algorithm [19,20], whereas all the entries
α 2n,2m
gij = 0 T2n ,i (t )T2m,j (t )dt of G2n,2m = (gij )i=0,j=0 in this case must be evaluated via numerical integration and can be stored
in lookup tables in advance.
Finally, we would like to mention that multiwise merging can be performed on hyperbolic curves [20,21], algebraic-
trigonometric curves [22,23], algebraic-hyperbolic curves [23], etc. Note that when the shape parameter α in (22) approaches
0, the trigonometric curve becomes a Bézier curve of degree 2n, see [24, Proposition 2.1]; a similar asymptotic behavior
occurs also in the hyperbolic curve case, see [21, Proposition 5].

4. Examples and applications

In this section, we present some examples for the proposed Gk multiwise merging and compare with the previous C k
multiwise merging [1,2]. All examples are computed on a PC with Intel Core2 Quad CPU Q9400 2.66 GHz processor and 4
GB RAM.
The merging results depend on the choice of the parameters {tk }Kk=+11 . Let t1 = 0, and assign
λ,µ,ω
Vk
tk+1 = tk + , k = 1, . . . , K , (23)
V λ,µ,ω
where
1  d k λ 1 K
   
λ,µ,ω λ,µ,ω
|κk (t )|µ dt and V λ,µ,ω :=

Vk :=  P (t ) dt + ω Vk
 dt 
0 0 k=1

with
d2 k   d k 3
  
d k
κk (t ) =  P (t ) × 2 P (t )  P (t )
  
dt dt dt 
denoting the curvature of the kth segment. If ω = 0, it is the commonly used arc length parametrization when λ = 1, the
uniform parametrization when λ = 0, and the centripetal parametrization when λ = 1/2. However, if ω > 0, curvature
358 L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361

. . . . . .

Fig. 1. Merging results for the treble clef curve using C k and Gk constraints.

Table 1
Comparative data between C k and Gk multiwise merging for the treble clef curve. (Note: the computation time is measured in milliseconds.)
n C2 C3 G2 G3
E Time E Time E Iters Time E Iters Time

12 1.225e−2 18 4.966e−2 16 2.077e−3 5 30 2.379e−3 20 73


14 3.903e−3 21 2.100e−2 18 6.545e−4 6 32 6.708e−4 18 76
16 2.145e−3 24 8.801e−3 21 2.434e−4 5 35 2.573e−4 21 82
18 1.063e−3 28 5.199e−3 25 1.667e−4 5 40 2.039e−4 19 83
20 5.480e−4 32 2.788e−3 29 8.289e−5 6 43 8.940e−5 21 85

variations of the given Bézier segments are considered as well; this choice may provide aesthetically more pleasing results
in case of high curvature segments.
The first example is the treble clef curve composed of four Bézier curves of degree 5; see [1] for detailed control points.
Fig. 1 illustrates the merged curves of degrees n, in which {t1 , t2 , . . . , t5 } = {0, 0.2387, 0.4872, 0.7626, 1} is taken by arc
length parametrization. When applying G2 and G3 multiwise merging, the feasible region is set to D = [0.2, 5]2 . Clearly,
owing to the used Gk constraint, better results are generated by Gk multiwise merging. As shown in Table 1, Gk multiwise
merging requires more computation time than C k multiwise merging, caused by the three simplification steps and iterative
process for solving the constrained minimization problem; and, compared to G2 multiwise merging, G3 multiwise merging
increases the number of iterations and thus the computation time, due to the iterative process for solving a more complex
problem.
The second example is the penguin curve, whose left and right parts are composed of four and three cubic Bézier
curves respectively; see [2] for detailed control points. Fig. 2 illustrates the merged curves of degrees n, and D =
[0.2, 5]2 is used for the feasible region. Apparently, Gk multiwise merging greatly improves the results. In Fig. 2(a)–(d),
{t1 , t2 , . . . , t5 } = {0, 0.08, 0.55, 0.78, 1} for the left part and {t1 , t2 , t3 , t4 } = {0, 0.42, 0.78, 1} for the right part are taken
by arc length parametrization. In Fig. 2(e)–(h), {t1 , t2 , . . . , t5 } = {0, 0.18, 0.53, 0.78, 1} for the left part and {t1 , t2 , t3 , t4 } =
{0, 0.40, 0.75, 1} for the right part are taken by setting (λ, µ, ω) = (1, 0.5, 0.05) in (23): the results by C k multiwise
merging are noticeably improved, referring to the segment at the left bottom; whereas the improvement of Gk multiwise
merging is not obvious, possibly owing to the used Gk constraint.
We show an application to improve the parametrization of merged curves by using the feasible region. A curve is thought
of as having optimal parametrization if it is parametrized by arc length [25], but which is impossible for polynomial curves.
While for a merged curve R(t ), the magnitudes of all its tangent vectors, i.e. ∥R′ (t )∥, should be as close to equal as possible
in order to achieve an optimal parametrization. Here, we do not intend to find a merged curve with the closest optimal
parametrization; instead, we improve the parametrization by interactively adjusting the four bounds in the feasible region.
Recalling that these four bounds indirectly specify the ranges of ∥R′ (0)∥ and ∥R′ (1)∥, such interaction is meaningful and
flexible. An example is shown in Fig. 3.
By making use of the two weights in (21), it increases the flexibility of shape design. As the first term of (21) measures the
deviation in positions, small weights may be used for generating satisfactory results from the viewpoint of curve profiles; on
the other hand, large weights should be taken if higher-order differential geometric quantities are regarded as important.
However, a qualitative criterion for determining suitable values of weights still seems to be unattainable; alternatively, we
need to manually assign and adjust their values. As shown in Fig. 4, by setting ω1 = ω2 = 1, the curvature distributions of
L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361 359

(a) n = 14. (b) n = 14. (c) n = 16. (d) n = 16.

(e) n = 14. (f) n = 14. (g) n = 16. (h) n = 16.

Fig. 2. Merging results for the penguin curve using C k and Gk constraints.

merged curves are improved. We noticed that the improvement is not obvious when the given curves are not C 2 connected,
such as the treble clef curve and penguin curve.
Finally, Fig. 5 demonstrates an example where multiwise merging is performed on three Bézier curves and three
trigonometric curves with α = π /2. Since different curve representations are used, there exist slight differences between
the merging results.

5. Conclusion

We have developed an iterative algorithm for Gk multiwise merging of Bézier curves. The key idea of the proposed method
is to make use of the additional parameters afforded by the Gk constraint, with the ability to produce better merging results.
Moreover, the added flexibility can be exploited in many ways, and constitutes an important advance in geometric modeling
applications, e.g., improving the parametrization of curves. We also propose to use the feasible region for the purpose of
shape preservation and interaction.

Acknowledgments

This work is supported by the National Natural Science Foundation of China (Nos. 61272307, 61502128). The authors
thank the anonymous referees for their constructive comments and for pointing out two extension directions (Sections 3.2
and 3.3).
360 L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361

(a) n = 9, D = [4, 5] × [2, 2.5].

(b) n = 10, D = [3.5, 4.5] × [3.5, 4.5].

2
Fig. 3. Applying G multiwise merging to improve the parametrization of merged curves by using the feasible region D . The middle column displays the
profiles of ∥R′ (t )∥ with respect to t, while the means and standard deviations of {∥R′ (t̄i )∥}Ni=1 evenly sampled in t are listed in the right column.

(a) n = 10, D = [0.2, 5]2 . (b) n = 12, D = [0.2, 5]2 .

Fig. 4. Influence of the weights ω1 and ω2 : Red, ω1 = ω2 = 0; Blue, ω1 = ω2 = 1. In (a) and (b), the merged curves with G2 continuity are displayed
on the left, while the profiles of curvatures with respect to arc length on the right. (For interpretation of the references to colour in this figure legend, the
reader is referred to the web version of this article.)

(a) Bézier curves. (b) Trigonometric curves.

Fig. 5. Merging results for three Bézier curves and three trigonometric curves with α = π/2, using D = [0.2, 5]2 . Note that the control points of the
given curves in (a) and (b) are the same.
L. Lu, C. Jiang / Journal of Computational and Applied Mathematics 296 (2016) 352–361 361

References

[1] L. Lu, Explicit algorithms for multiwise merging of Bézier curves, J. Comput. Appl. Math. 278 (2015) 138–148.
[2] P. Woźny, P. Gospodarczyk, S. Lewanowicz, Efficient merging of multiple segments of Bézier curves, Appl. Math. Comput. 268 (2015) 354–363.
[3] G. Farin, Curves and Surfaces for CAGD: A Practical Guide, fifth ed., Morgan Kaufmann, San Francisco, 2002.
[4] J. Peters, Geometric continuity, in: G. Farin, J. Hoschek, M.-S. Kim (Eds.), Handbook of Computer Aided Geometric Design, Elsevier, Amsterdam, 2002,
pp. 193–227.
[5] J. Hoschek, Approximate conversion of spline curves, Comput. Aided Geom. Design 4 (1987) 59–66.
[6] S. Hu, R. Tong, T. Ju, J. Sun, Approximate merging of a pair of Bézier curves, Comput. Aided Des. 33 (2001) 125–136.
[7] C. Tai, S. Hu, Q. Huang, Approximate merging of B-spline curves via knot adjustment and constrained optimization, Comput. Aided Des. 35 (2003)
893–899.
[8] L. Lu, An explicit method for G3 merging of two Bézier curves, J. Comput. Appl. Math. 260 (2014) 421–433.
[9] P. Zhu, G. Wang, Optimal approximate merging of a pair of Bézier curves with G2 -continuity, J. Zhejiang Univ. Sci. A 10 (2009) 554–561.
[10] M. Cheng, G. Wang, Approximate merging of multiple Bézier segments, Progr. Nat. Sci. 18 (2008) 757–762.
[11] H. Pungotra, G.K. Knopf, R. Canas, Merging multiple B-spline surface patches in a virtual reality environment, Comput. Aided Des. 42 (2010) 847–859.
[12] S. Lewanowicz, P. Woźny, Bézier representation of the constrained dual Bernstein polynomials, Appl. Math. Comput. 218 (2011) 4580–4586.
[13] P. Woźny, S. Lewanowicz, Multi-degree reduction of Bézier curves with constraints, using dual Bernstein basis polynomials, Comput. Aided Geom.
Design 26 (2009) 566–579.
[14] L. Lu, Some improvements on optimal multi-degree reduction of Bézier curves with geometric constraints, Comput. Aided Des. 59 (2015) 39–42.
[15] P. Gospodarczyk, P. Woźny, Merging of Bézier curves with box constraints, J. Comput. Appl. Math. (2016) http://dx.doi.org/10.1016/j.cam.2015.10.005.
to appear.
[16] M. Schmidt, D. Kim, S. Sra, Projected Newton-type methods in machine learning, in: S. Sra, S. Nowozin, S.J. Wright (Eds.), Optimization for Machine
Learning, MIT Press, Cambridge, MA, 2011, pp. 305–330.
[17] J.M. Peña, Shape Preserving Representations in Computer-Aided Geometric Design, Nova Science Publishers, Commack, New York, 1999.
[18] J. Sánchez-Reyes, Harmonic rational Bézier curves, p-Bézier curves and trigonometric polynomials, Comput. Aided Geom. Design 15 (1998) 909–923.
[19] E. Mainar, J.M. Peña, Corner cutting algorithms associated with optimal shape preserving representations, Comput. Aided Geom. Design 16 (1999)
883–906.
[20] Á Róth, Control point based exact description of trigonometric/hyperbolic curves, surfaces and volumes, J. Comput. Appl. Math. 290 (2015) 74–91.
[21] W. Shen, G. Wang, A class of quasi Bézier curves based on hyperbolic polynomials, J. Zhejiang Univ. Sci. 6A (Suppl. I) (2005) 116–123.
[22] J.M. Carnicer, E. Mainar, J.M. Peña, Critical length for design purposes and extended Chebyshev spaces, Constr. Approx. 20 (2004) 55–71.
[23] E. Mainar, J.M. Peña, Optimal bases for a class of mixed spaces and their associated spline spaces, Comput. Math. Appl. 59 (2010) 1509–1523.
[24] I. Juhász, Á Róth, A scheme for interpolation with trigonometric spline curves, J. Comput. Appl. Math. 263 (2014) 246–261.
[25] P. Costantini, R.T. Farouki, C. Manni, A. Sestini, Computation of optimal composite re-parameterizations, Comput. Aided Geom. Design 18 (2001)
875–897.

You might also like