Smoothing Connected Ball B´ezier Curves by Energy Minimization

In this paper, we aim at smoothing two connected ball B´ezier curves from C r − 1 to C r ( r ≥ 1 ) by minimizing the energies of the curves. We propose the algorithms based on internal energy minimization and curve attractor minimization. Then, we combine the internal energy and the curve attractor and give the algorithm based on combined energy minimization. All algorithms are established by solving bi-objective minimizations. Some numerical examples show that the proposed algorithms are eﬀective, making them useful for smoothing 3D objects constructed by connected ball B´ezier curves.


Introduction
It is known that every object in nature has thickness. In the field of computer-aided design (CAD) and computer graphics (CG), a curve or a surface without thickness is just a mathematical abstraction or simplification to represent the shapes of objects (see [1]). Because a ball curve (see [2]) can be viewed as an ordinary curve with variable thickness in geometry, it can be used in modeling tubular shapes with variable thickness widely existing in nature. According to definition of the ball curve, specific models could be designed by concretizing the basis. For example, the ball B-spline curve (BBSC) derived from B-spline basis has attracted much attention in recent years. Owing to the fact that BBSC is defined by replacing control points in the B-spline curve with control balls, most algorithms can be easily obtained by applying the B-spline curve to the BBSC. Without providing an exhaustive survey, we list some studies where the proposed algorithms relate to BBSC (see, e.g., [2][3][4][5][6][7]). Since the Bézier curve and surface (see [8]) have long been a basic tool for geometric design and shape representation and have been widely used in practical engineering (see [9,10]), the ball Bézier curve derived from the Bernstein basis is also worthy of attention. In this paper, we focus on the ball Bézier curve (BBC).
Although the BBC can be used to represent tubular shapes with variable thickness, we may need to connect two or more BBCs for designing some complex objects in practical applications. To make the connected BBCs have overall smoothness, they should satisfy certain continuity conditions. Generally, there are two metrics for the continuity between connected parametric curves: parametric continuity (also called C n continuity) and geometric continuity (also called G n continuity) (see [11]). e smooth continuity between connected BBCs we are concerned with here is the parametric continuity. Let us consider the issues. If two BBCs satisfy C r− 1 connection, how can we smooth the connected BBCs from C r− 1 to C r ? eoretically, we can modify the control balls of the connected BBCs so as to make the corresponding continuity conditions hold, but the modification of control balls without specific objectives may not meet the needs of practical applications. Recently, some objective functionals have been proposed for modifying the shape of curves. ese objective functionals can be roughly divided into two categories: the internal energy of curves and the external energy of curves. e internal energy of a curve oftentimes includes three forms: the stretch energy, the strain energy, and the curvature variation energy (see [12][13][14][15][16][17]). e external energy of a curve usually includes two forms: the point attractor and the curve attractor (see [17]). e curve attractor minimization is applied to smooth two connected curves defined by control points (see [17]), and the same methodology was extended to smooth two connected ball curves defined by control balls (see [2]). In this paper, we, respectively, use the internal energy minimization and the curve attractor minimization to smooth two connected BBCs. We think that the energy of each segment of two connected BBCs should be as small as possible, rather than considering that the total energy of two connected BBCs should be as small as possible. erefore, we use biobjective minimization to achieve this goal. e main contributions of this paper are as follows: (a) We give a scheme for smoothing two connected BBCs from C 0 to C 1 by minimizing the internal energy. e scheme makes the internal energy of each segment of two connected BBCs as small as possible, rather than the total internal energy of two connected BBCs as small as possible. (b) We present a scheme for smoothing two connected BBCs from C 0 to C 1 by minimizing the curve attractor. e scheme synchronously minimizes the distance between each adjusted control point and its original position, instead of minimizing the total distance between all adjusted control points with their original positions. (c) We combine the internal energy minimization and the curve attractor minimization to smooth two connected BBCs from C 0 to C 1 in a new way, which extends the application of previous methods. e remainder of this paper is organized as follows. In Section 2, we give the preliminaries for the issues to be discussed. In Section 3, we present the algorithm for smoothing two connected BBCs from C 0 to C 1 by minimizing the internal energy. In Section 4, we propose the algorithm for smoothing two connected BBCs from C 0 to C 1 by minimizing the curve attractor. In Section 5, we combine the internal energy and the curve attractor to smooth two connected BBCs from C 0 to C 1 and conclude the corresponding algorithm. In Section 6, we bring some numerical examples to illustrate the effectiveness of the proposed algorithms. Finally, the conclusion is provided in Section 7.

Preliminaries
A ball Bézier curve (BBC) of degree n can be defined as (see [2]) where 0 ≤ t ≤ 1, B i,n (t) � n i (1 − t) n− i t i , and b i ; r i is the control ball which represents a ball centered at b i (x i , y i , z i ) with radius r i . Geometrically, a BBC can be viewed as a Bézier curve with variable thickness. Since n i�0 B i,n (t) b i ; r i � n i�0 B i,n (t)b i ; n i�0 B i,n (t) r i 〉, a BBC can be regarded as having two parts: the skeleton (or center curve) c(t) � n i�0 B i,n (t)b i which is a Bézier curve and the radius function r(t) � n i�0 B i,n (t)r i which is a Bézier scalar function. en, equation (1) can be simplified as (2) Figure 1 shows an illustration of a quadratic BBC. From equation (2), a BBC of degree (m) and a BBC of degree (n) can be expressed as where Since the expression of BBC is very similar to that of standard Bézier curve, we can easily obtain the C n continuity conditions of connecting two BBCs from that of the standard Bézier curve. Here, we only give the C 1 continuity conditions of connecting two BBCs which is shown in the following theorem without proof.

Theorem 1.
e C 1 continuity conditions of two connected BBCs B 1 (t) and B 2 (t) are given by where d and R, respectively, represent the center and radius of the connecting control ball. Remark 1. e conditions q 0 � p m and s 0 � r m in equation (5) imply that two BBCs should reach C 0 connection first, which means combining the end of B 1 (t) with the beginning of B 2 (t). Diagrams of two BBCs reaching C r (r = 0, 1) connection are shown in Figure 2.
In the following sections, we consider the internal energy minimization and the point attractor minimization to smooth two connected BBCs from C 0 to C 1 .

Remark 2.
Actually, we can consider smoothing two connected BBCs from C r− 1 to C r (r ≥ 1). Without loss of generality, we only discuss smoothing two connected BBCs from C 0 to C 1 in the following sections. e methods of smoothing two connected BBCs from C r− 1 to C r (r ≥ 2) could refer to the process of that from C 0 to C 1 .

Internal Energy Minimization
In this section, we adopt internal energy to smooth two connected BBCs from C 0 to C 1 . In most cases, the internal energy of a parametric curve b(t) can be approximately expressed as E k � 1 0 ‖b (k) (t)‖ 2 dt, k � 1, 2, 3, where k denotes the derivative of order and ‖ · ‖ represents the 2-norm.
Since a BBC B 〈 〉(t) is considered to contain two parts, the internal energy of B 〈 〉(t) can be expressed as two separate parts: From equation (5), we only need to adjust the control balls p m− 1 ; r m− 1 and q 1 ; s 1 for smoothing the two connected BBCs from C 0 to C 1 . Let p m− 1 ; r m− 1 denote the adjusted position of the control ball p m− 1 ; r m− 1 , and q 1 ; s 1 be that of the control ball q 1 ; s 1 . Let en, from equations (3), (6), and (7), the internal energy of each segment of the two connected BBCs after smoothing can be expressed as Since we believe that the internal energy of each segment of two connected BBCs after smoothing should be as small as possible, the bi-objective minimizations can be obtained as follows: Because equation (5) should be satisfied when smoothing the two connected BBCs from C 0 to C 1 , we have It is not difficult to find that q 1 can be regarded as a function of p m− 1 , and s 1 can be regarded as a function of r m− 1 . For convenience, we set the two functions as α(p m− 1 ) and β(r m− 1 ).
By substituting (12) into (10), we have where Note that the radii of the control balls should be nonnegative, that is, Here, the radius equal to 0 means that a control ball degenerates to be a point. By substituting (13) into (11) and adding the constraint with radius, we have where Generally, (14) and (15) can be transformed into the single-objective minimizations: where λ k , (0 ≤ λ k ≤ 1) and ω k , (0 ≤ ω k ≤ 1) are the weights. If the solution of equation (16) is unique, it must be the noninferior solution of equation (14), and so is the relationship between equations (15) and (17) (see, e.g., [18]). We discuss equations (16) and (17) separately.
Before solving equation (18), we need to determine the values of λ k . To this end, we consider the single-objective minimizations Lemma 1. e solution of equation (18), denoted by p 1 m− 1 , is e solution of equation (19), denoted by p 2 m− 1 , is Proof. e gradients of E 1k (p m− 1 ) expressed in equation (8) can be calculated by where e is the unit vector. Since 4 Complexity e gradients of E 2,k (p m− 1 ) expressed by equations (8) can be calculated by Because equation (19) has a unique solution which can be solved by (zE 2,k (p m− 1 )/zp m− 1 ) � 0, we then obtain equation (24) by computing from equation (23).
Next, we determine the value of λ k in equation (16) by using the sorting algorithm (see e.g., [18]) described in Algorithm 1.
We then obtain the following theorem.
□ Theorem 2. Given two BBCs B 1 (t) and B 2 (t) that satisfy C 0 connection. For smoothing the two connected BBCs from C 0 to C 1 , the centers of the adjusted control balls which minimized the internal energy E k (p m− 1 ) are given by Proof. e gradients of E k (p m− 1 ) expressed in equation (16) can be calculated by Since equation (16) has a unique solution which can be solved by zE k (p m− 1 )/zp m− 1 � 0, we then get equation (24) by computing from equation (26) and combining it with equation (12).
Analogously, we should determine the values of ω k before solving equation (17). Hence, the following singleobjective minimizations are considered:  (27), denoted by r 1 m− 1 , is given by the cases as follows: e solution of equation (28), denoted by r 2 m− 1 , is given by the cases as follows: Proof. From equation (8), we have By computing from equation (29), the unique stable point of R 1,k (r m− 1 ), denoted by r [1] m− 1 , can be obtained. ere are two cases.
We then obtain the following theorem.
(ii) If − b/a ∉ D and R k (0) ≤ R k (m + n/mR), the radii of the adjusted control balls are Proof. From equation (17), we have By computing from equation (34), the unique stable (13). We roughly describe the methods of smoothing two connected BBCs from C 0 to C 1 by minimizing the internal energy as shown in Algorithm 3. □ Remark 3. It is noted that the methods in [2] took the total internal energy of two connected BBCs as the minimization target. Different from [2], we make the internal energy of each segment of two connected BBCs as small as possible, rather than considering the total internal energy of two connected BBCs as small as possible.

Curve Attractor Minimization
In this section, we use external energy to smooth two connected BBCs from C 0 to C 1 . e point attractor and the curve attractor are two widely used external energies of a curve. e point attractor pulls a curve towards a given point, and the curve attractor pulls a curve towards a given curve. Since we expect to smooth the connected BBCs to the new reconnected BBCs, we adopt the curve attractor to optimize the control balls.
In fact, the curve attractor used for a curve defined by control points can be regarded as the distance between the adjusted control points and their original positions. us, the curve attractor of each segment of the two connected BBCs after smoothing can be expressed as two separate parts: Step 3. Compute λ i,k ≔ g i,k /(g 1,k + g 2,k ), i � 1, 2.
To solve equation (41), we consider the single-objective minimizations: From equations (35) and (37), we can easily get the lemma as follows.
We then can determine the value of η in equation (41) referring to Algorithm 1. Here we do not bring the detailed description of this. Furthermore, we get the solution of equation (41) reached by the theorem as follows.
Theorem 4. Given two BBCs B 1 (t) and B 2 (t) that satisfy C 0 connection. For smoothing the two connected BBCs from C 0 to C 1 , the centers of the adjusted control balls which minimized the curve attractor F(p m− 1 ) are given by Proof. e gradients of F(p m− 1 ) expressed in equation (41) can be calculated by Since equation (41) has a unique optimal solution which can be solved by zF(p m− 1 )/zp m− 1 � 0, we then get equation (45) by computing from equation (46) and combining it with equation (12).
Similarly, we consider the following single-objective minimizations for solving equation (44): From equations (36) and (38), it is not difficult to obtain the following lemma.
Step 1. Input two BBCs that satisfy C 0 connection.
Step 2. Select the value of k to determine which kind of internal energy is adopted.
Step 3. Use Algorithm 1 to determine the weight in equation (18) and compute the centers of the adjusted control balls by eorem 2.
Step 4. Use Algorithm 2 to determine the weight in equation (19) and compute the radii of the adjusted control balls by eorem 3.
Step 5. Output two BBCs that satisfy C 1 connection.
ALGORITHM 3: Smoothing two connected BBCs from C 0 to C 1 by minimizing the internal energy.
Complexity 7 (iii) If (m + n/mR − n/ms 1 ) ∉ D and S 2 (0) > S 2 (m + n/mR), we have r 2 m− 1 � m + n/mR. en, the value of ρ in equation (42) can be determined referring to Algorithm 2. Here we do not bring the detailed description of this. Furthermore, the solution of equation (42) can be reached by the following theorem.
Theorem 5. Given two BBCs B 1 (t) and B 2 (t) that satisfy C 0 connection. For smoothing the two connected BBCs from C 0 to C 1 , the radii of the adjusted control balls which minimized the curve attractor S(r m− 1 ) are given by the cases as follows: (i) If n 2 r m− 1 + m(m + n)R − mns 1 /m 2 + n 2 ∈ D, the radii of the adjusted control balls are By computing from equation (52), the unique stable point of S(r m− 1 ), denoted by r * m− 1 , is r * m− 1 � n 2 r m− 1 + m(m + n)R− mns 1 /m 2 + n 2 . ere are two cases.  (13); else, we can get equation (51) by combining it with equation (13). e methods of smoothing two connected BBCs from C 0 to C 1 by minimizing the curve attractor can be roughly described in Algorithm 4. □ Remark 4. It is noted that the methods in [17] took the total distance (i.e., curve attractor) between all adjusted control points with their original positions as the minimization target. Different from [17], we synchronously minimize the distance between each adjusted control point and its original position, instead of minimizing the total distance between all adjusted control points and their original positions.

Combined Energy Minimization
In this section, we consider combining the internal energy and the curve attractor to smooth two connected BBCs from C 0 to C 1 . We express the combined energy of each segment of the two connected BBCs after smoothing as follows: where E i,k (p m− 1 ) and R i,k (r m− 1 ), (i � 1, 2) are the internal energies used in Section 3 and F i (p m− 1 ) and S i (r m− 1 ), (i � 1, 2) represent the curve attractor used in Section 4. ereby, we obtain the bi-objective minimizations: Analogously, we transform equations (54) and (55) into the single-objective minimizations: where ξ k , (0 ≤ ξ k ≤ 1) and ζ k , (0 ≤ ζ k ≤ 1) are the weights.
To solve equation (56), we consider the single-objective minimizations:

Conclusion
In this paper, we focus on smoothing two connected BBCs from C 0 to C 1 by optimizing their control balls. We propose the algorithms based on internal energy minimization, curve attractor minimization, and combined energy minimization. All the algorithms are established on the basis of solving biobjective minimizations. e internal energy minimization can be applied in the applications which require the energy of each segment of the connected BBCs after smoothing to be as small as possible. e curve attractor minimization can be applied in the applications which require the adjusted control balls of each segment of the connected BBCs after smoothing not to be far away from their original positions. e combined energy minimization can be utilized in the applications which require each segment of the connected BBCs after smoothing to be as optimal as possible in both targets. Numerical examples show the e ectiveness of the proposed algorithms. e proposals would help to improve the smooth continuity of connected BBCs which is often encountered in 3D modeling.
We give the smoothing schemes of two connected BBCs from C 0 to C 1 , and the schemes of smoothing two connected BBCs from C r− 1 to C r (r ≥ 2) could refer to the process of that from C 0 to C 1 . However, we do not present the schemes of smoothing two connected BBCs from C r− 1 to C r+1 (r ≥ 1). We have tried to use the proposed ideology to smooth two connected BBCs from C 0 to C 2 , but the e ect is not satisfactory. is will be our next study issue.
Data Availability e data used for the numerical analysis are included within the article.  14 Complexity