Automatic G arc spline interpolation for closed ... - Semantic Scholar

Report 1 Downloads 87 Views
Computer-Aided Design 36 (2004) 1205–1218 www.elsevier.com/locate/cad

Automatic G1 arc spline interpolation for closed point set Xiao-Diao Chena,b, Jun-Hai Yonga,b,*, Guo-Qin Zhenga,b, Jia-Guang Suna,b a School of Software, Tsinghua University, Beijing 100084, People’s Republic of China Department of Computer Science and Technology, Tsinghua University, Beijing 100084, People’s Republic of China

b

Received 22 July 2003; received in revised form 10 December 2003; accepted 12 December 2003

Abstract A method for generating an interpolation closed G1 arc spline on a given closed point set is presented. For the odd case, i.e. when the number of the given points is odd, this paper disproves the traditional opinion that there is only one closed G1 arc spline interpolating the given points. In fact, the number of the resultant closed G1 arc splines fulfilling the interpolation condition for the odd case is exactly two. We provide an evaluation method based on the arc length as well such that the choice between those two arc splines is made automatically. For the even case, i.e. when the number of the given points is even, the points are automatically moved based on weight functions such that the interpolation condition for generating closed G1 arc splines is satisfied, and that the adjustment is small. And then, the G1 arc spline is constructed such that the radii of the arcs in the spline are close to each other. Examples are given to illustrate the method. q 2003 Elsevier Ltd. All rights reserved. Keywords: Arc spline; Circular arc interpolation; Closed point set; G1 continuity

1. Introduction Research on arc splines has been very active for some decades [1 –3,5 – 29]. Arc splines play a very important role in a lot of applications such as computerized numerical control (CNC) machinery [1,3,18,24,27,28,29], geometric modeling [8,25], computer graphics [17,21], computer vision [21], and robot path planning [5,25]. The elementary knowledge on arc splines can be found in Ref. [22]. At the beginning, people did research on G0 arc splines [18] as well as G1 arc splines [8]. Currently, more and more people [24,27] point out the superior properties of G1 arc splines over G0 arc splines. For example, the use of a G1 arc spline as an NC tool path usually leads to significant reduction of the times of a CNC machine getting into the stop-and-go motion, and dramatic improvement of the quality of the finished surface [27]. Moreover, the G1 continuity is often mandatorily required in the design of practical mechanical parts so as to ensure such that the resultant surfaces are smooth. Therefore, recent research on arc splines has been focusing on G1 arc splines [19,25,26,28,29]. * Corresponding author. Address: School of Software, Tsinghua University, Beijing, 100084, Peoples Republic of China. Tel.: þ10-62795455; fax: þ 10-6279-5460. E-mail address: [email protected] (J.-H. Yong). 0010-4485//$ - see front matter q 2003 Elsevier Ltd. All rights reserved. doi:10.1016/j.cad.2003.12.001

In the literature, the G1 arc spline interpolation problem on a closed point set was first proposed by Hoschek [6] in 1992. Given nð. 2Þ different points with a given order, a closed G1 arc spline is required to be built to connect those points in the given order. Between every two neighboring points, there should be only an arc or a straight-line segment with the two end points being exactly the two neighboring points. Thus, the join point of every two sequential arcs (or line segments) in the spline should be exactly one of the given points. This problem has by far not been well studied. When n is odd, Hoschek suggested manually rotating the direction of the starting tangent vector of the first arc such that a closed G1 arc spline was constructed. When n is even, a point in the closed point set is manually chosen and moved to a new place to satisfy the closed G1 arc spline interpolation condition, and then the direction of the starting tangent vector of the first arc is obtained manually as well. This is a time consuming task and requires sophisticated experience. To address this problem, the biarc technique [3,9] is a possible solution. However, it increases n join points in the resultant arc spline, i.e. the number of the join points becomes twice of the number of the given points. In 2002, Lu, Wang, Yang and Chen [7] presented a method for an alternative problem, using a closed G1 arc spline with n arcs to interpolate those given points. However, they

1206

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

Fig. 1. An application of a closed G1 arc spline.

imposed the extra constraint that no three sequential given points are collinear, and the join points of arcs in the resultant spline usually are not the given points. The requirement of the join points being the given points is often mandatory in a lot of applications. Fig. 1 shows an example of such an application. In the example, a practical mechanical part, a pump cover, is produced by our commercial geometric modeling software, GEMS 6.0. The three-dimensional modeling technique is based on features. The first step is to build a two-dimensional sketch, as shown in Fig. 1(b). It is a closed G1 arc spline, whose join points are the given points. And then, the extrusion feature is built to create the base solid body of the pump cover. In this paper, a method for automatically generating an interpolation closed G1 arc spline on a given closed point set is presented. For the odd case, i.e. when the number of the given points is odd, we prove that there are exactly two different closed G1 arc splines interpolating the given points. The method for evaluating those two arc splines is given as well such that the choice between those two arc splines is made automatically. For the even case, we first develop the explicit interpolation condition for generating closed G1 arc splines, and define a weight function for each given point. Thus, the points are automatically chosen and moved based on weight functions such that the interpolation condition is fulfilled, and that the adjustment is small. Then, the G1 arc splines are constructed such that the radii of the arcs in the spline are close to each other. The remaining part of the paper is arranged as follows. The sufficient and necessary condition for interpolating given points with a closed G1 arc spline is given in Section 2. For the odd case, this condition refers to the constraint on

the direction of the starting tangent vector of the first arc. For the even case, the condition is imposed on the given points directly because in this case whether there is a closed G1 arc spline interpolating the given points only depends on the positions of those points. Section 3 provides the methods for moving the given points to satisfy the interpolation condition. Section 4 constructs a G1 arc spline interpolating the points after the adjustment and with the radii of the arcs close to each other. Some examples and concluding remarks are presented in Section 5.

2. Sufficient and necessary interpolation condition A closed G1 arc spline is required to be constructed to interpolate the given points with the join points in the arc spline being exactly the given points. Suppose that the given point set is made of a sequence of nð. 2Þ points {Pi li ¼ 0; 1; …; n 2 1}: Connect those points in the given order with straight line segments, and we obtain the polygon as shown in Fig. 2(a). To construct the arc spline, an arc or a straight line segment is created for each edge of the polygon, and each arc or line segment should share the same two end points with the corresponding edge. As shown in Fig. 2(b), each vertex of the polygon joins two arcs (or line segments), and the two arcs (or line segments) should have the same normalized tangent vector at this vertex. For convenience and to avoid confusion, we give the definition of the angle from one vector to another vector as follows. Definition 1. The angle f from the vector V1 to the vector V2 is defined by the counterclockwise angle from V1 to V2 : Here, the angle is 2p-periodic, i.e. 2kp þ f (where k is an arbitrary integer) presents the same angle with f: Clockwise measure of an angle gives negative values. In this paper, the inner angles ui ði ¼ 0; 1; …; n 2 1Þ of the polygon are defined as the angles from the vectors ðPððiþ1Þ%nÞ 2 Pi Þ to the vectors ðPi 2 Pðði21Þ%nÞ Þ: Here ‘%’ is the modulus operator given by i%n ¼ kn þ i [ {0; 1; …; n 2 1};

Fig. 2. Create an interpolation G1 arc spline on a closed point set: (a) the polygon using the given points as its vertices; (b) a closed G1 arc spline interpolating the given points; (c) an arc spline when the interpolation condition is not satisfied.

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

where i and k are integers, and n is a positive integer. Let Ai ði ¼ 0; 1; …; n 2 1Þ notate the arcs or the straight line segments in the resultant arc spline. Then, the directions of Ai are from Pi to Pððiþ1Þ%nÞ : Let Ti ði ¼ 0; 1; …; n 2 1Þ notate the normalized tangent vectors of Ai at the starting points Pi : Since the arc spline is G1 continuous, Ti are the normalized tangent vectors of Aðði21Þ%nÞ at the ending points Pi as well. If the closed point set {Pi li ¼ 0; 1; …; n 2 1} is given, the starting direction T0 determines a unique arc spline, which is G1 continuous everywhere except for the starting point P0 of the closed spline. This is the corollary of the following lemma. Lemma 1. As shown in Fig. 3, suppose an arc or a line segment is from the starting point P to the ending point Q; and has the two unit tangent vectors TP and TQ at those two points. Let a and b be the angles from the vector ðQ 2 PÞ to TP and TQ ; respectively. Then, we have

b ¼ 2kp 2 a;

where k is an arbitrary integer:

If it is an arc, then the center of the arc is C¼

P1Q cos akQ 2 Pk2 2 V; 2 2sin a

and the radius of the arc is r¼

kQ 2 Pk2 ; l2sin al

where V is the unit vector after counterclockwise rotating the direction ðQ 2 PÞ through the angle p2 : If the unit vector of the direction ðQ 2 PÞ is " # x ; y then V¼

"

2y x

1207

which, in turn, would become the unit tangent vector at the new starting point of the next arc or line segment. Thus, the starting direction T0 determines a unique G1 arc spline if the continuity at the join point of the first segment A0 and the last segment An21 is not considered. Let Tn be the unit tangent vector of An21 at the ending point P0 ; which is the starting point of the arc spline as well. Given an arbitrary unit vector T0 ; Tn usually does not have the same direction with T0 for an arbitrary closed point set {Pi li ¼ 0; 1; …; n 2 1}: Hoschek [6] pointed out that the sufficient and necessary condition for interpolating given points with a closed G1 arc spline was Tn ¼ T0 :

ð1Þ

Hoschek [6] analyzed Eq. (1) in a complex plane. In his conclusions, Eq. (1) depends on both T0 and the positions of the given points for the odd case, and is invariant with respect to the changes in T0 for the even case. Therefore, he suggested manually rotating the starting direction T0 until Eq. (1) became true when the number of the given points was odd, and manually changing the position of one of the given points until Eq. (1) was fulfilled. This is indeed not an easy task. In the following, we will present the explicit formula for T0 under the odd case, and provide the sufficient and necessary interpolation condition under the even case using the inner angles of the polygon of the given point set. The analysis method in this paper is based on Lemma 1 rather than using the complex plane by Hoschek [6]. With our new method, no conversion between a point (or a vector) and a complex number is needed. Through our analysis, we show that there are two different closed G1 arc splines for the odd case, which is against the traditional opinion that the closed G1 arc spline is unique for this case [7]. Theorem 1. The sufficient and necessary condition for interpolating given points with a closed G1 arc spline is different for the odd case and the even case.

# :

Here, assume that the unsigned angle of an arc is less than 2p: Therefore, two points and a unit tangent vector at the starting point determine a unique arc or a line segment, and lead to a unique unit tangent vector at the ending point,

(1) For the odd case, the sufficient and necessary condition is that the starting unit tangent vector T0 is determined by 2 3 X p u0 4 1 n21 jþ1 5 þ þ a0 ¼ k p þ ð21Þ uj ; ð2Þ 2 j¼1 2 2 where a0 is the angle from the vector ðP1 2 P0 Þ to T0 ; ui ði ¼ 0; 1; …; n 2 1Þ are the inner angles of the polygon, and k is an arbitrary integer. (2) For the even case, the sufficient and necessary condition is that there exists an integer k such that 2 3 n21 X 2kp þ 4 ð21Þ j uj 5 ¼ 0; ð3Þ

Fig. 3. A single arc.

j¼0

1208

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

where ui ði ¼ 0; 1; …; n 2 1Þ are the inner angles of the polygon.

Proof. As shown in Fig. 2(c), let ai ði ¼ 0; 1; …; nÞ be the angles from the vectors ðPððiþ1Þ%nÞ 2 Pði%nÞ Þ to the vectors Ti ; and bi ði ¼ 0; 1; …; n 2 1Þ be the angles from the vectors ðPi 2 Pððiþ1Þ%nÞ Þ to the vectors ð2Tðiþ1Þ Þ: Let bi be equal to the angles from the vectors ðPððiþ1Þ%nÞ 2 Pi Þ to the vectors Tðiþ1Þ : According to Lemma 1, we have

bi ¼ 2ki p 2 ai ;

for i ¼ 0; 1; …; n 2 1;

where ki are arbitrary integers. Because Ti ði ¼ 0; 1; …; nÞ are the unit tangent vectors at the ending points Pði%nÞ of Aðði21Þ%nÞ as well as the unit tangent vectors at the starting points Pði%nÞ of Aði%nÞ ; we have

ai ¼ 2hi p þ p þ bði21Þ þ ui ;

2 3 i X 1 þ ð21Þiþ1 þ p þ ð21Þi a0 þ 4 ð21Þiþj uðj%nÞ 5; 2 j¼1 for i ¼ 1; 2; …; n; and 82 3 2 39 i i < X = X iþj iþjþ1 bi ¼ 2p 4 ð21Þ kj 5 þ 4 ð21Þ hj 5 : j¼0 ; j¼1 2 3 i X 1 þ ð21Þiþ1 2 p þ ð21Þiþ1 a0 þ 4 ð21Þiþjþ1 uj 5; 2 j¼1 for i ¼ 0; 1; …; n 2 1: The above equations could collapse into 1 þ ð21Þiþ1 p þ ð21Þi a0 2 3

2 i X þ 4 ð21Þiþj uðj%nÞ 5;

for i ¼ 1; 2; …; n;

ð4Þ

j¼1

and

bi ¼ 2hi p 2

1 þ ð21Þiþ1 p þ ð21Þiþ1 a0 2 3

2 i X þ 4 ð21Þiþjþ1 uj 5;

a n ¼ a0 : Substituting Eq. (4) into the above equation, we get the conclusions in the theorem. A As shown in Definition 1, an angle from one vector to another one is 2p-periodic, and the angles in Formula (2) are p-periodic. Therefore, when the number of the given points is odd, there are two different directions of T0 matching the interpolation condition, which correspond to 2 3 21 p u0 4 1 nX þ þ a0 ¼ 2kp þ ð21Þjþ1 uj 5 and a0 2 j¼1 2 2 2 3 X 3p u0 4 1 n21 þ þ ¼ 2kp þ ð21Þjþ1 uj 5; 2 j¼1 2 2

for i ¼ 1; 2; …; n;

where hi are arbitrary integers. Recursively applying the above two equations, we obtain 82 3 2 39 21 i < iX = X iþjþ1 iþj ai ¼ 2p 4 ð21Þ kj 5 þ 4 ð21Þ hj 5 : j¼0 ; j¼1

ai ¼ 2ki p þ

the condition

respectively. Consequently, there are two different closed G1 arc splines. Hence, a user has two choices. An evaluation method is required such that the choice could be made automatically. Usually, we choose the G1 arc spline with the smaller arc length nX 21

kAi k2 ;

where Ai ði ¼ 0; 1; …; n 2 1Þ are the arcs or the line segments in the arc spline, and kAi k2 are the (arc) length of Ai : Thus, the algorithm for interpolating given points with a closed G1 arc spline for the odd case is given as follows. Algorithm 1. Create an interpolation closed G1 arc spline on a given closed point set for the odd case. Input: a given closed point set {Pi li ¼ 0; 1; …; n 2 1}; where n is an odd integer. Output: a closed G1 arc spline interpolating the given points.  0 such that 1. Calculate two unit vectors T0 and T the angles from ðP1 2 P0 Þ to the directions T0  0 are and T 2 3 21 p u0 4 1 nX þ þ a0 ¼ 2kp þ ð21Þ jþ1 uj 5 2 j¼1 2 2 and

2 3 21 3p u0 4 1 nX þ þ a0 ¼ 2kp þ ð21Þ jþ1 uj 5; 2 j¼1 2 2

for i ¼ 0; 1; …; n 2 1;

j¼1

where ki and hi are arbitrary integers. Thus, the sufficient and necessary condition Tn ¼ T0 is equivalent to

ð5Þ

i¼0

2.

respectively; Recursively apply Lemma 1, and generate two closed G1 arc splines S0 and S1 ; which

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

3.

4.

interpolate the given points Pi ði ¼ 0; 1; …; n 2 1Þ; and have the starting directions T0 and T 0 ; respectively; Using Formula (5), calculate the arc lengths of S0 and S1 ; and output the arc spline which has the smaller arc length. End of Algorithm 1.

When the number of the given points is even, there exist some closed G1 arc splines interpolating those points if and only if Eq. (3) is satisfied. Hence, if Eq. (3) is not satisfied, the positions of the given points should be changed to make Eq. (3) valid. How to move the given points will be illustrated in Section 3. When Eq. (3) is fulfilled, any starting direction T0 could lead to an interpolation closed G1 arc spline. Section 4 gives a method for automatically choosing T0 such that the radii of the arcs in the resultant arc spline are close to each other.

3. Moving given points For the even case, Eq. (3) usually is not satisfied. Therefore, the positions of the given points should be changed. In Ref. [6], Hoschek suggested manually selecting a point and changing its position to make Eq. (1) valid. Eq. (1) is not intuitive at all. The relationship between Eq. (1) and the positions of the given points is vague. Eq. (3) developed in this paper would be a better substitute. However, it is still a hard manual task. This section gives an automatic method for the selection and the movement of a single point to fulfill the condition. From our experience, it is usually better to move multiple points than just to move a single point. The total moving distance would become smaller. Therefore, we present a method in which multiple points are moved. The main process of the method is a loop of selecting a point, and moving this point such that the inner angle of the polygon at this point equals to a given value. The locus of the points fulfilling the new value of the inner angle in the polygon is given in Theorem 2.

Theorem 2. As shown in Fig. 4(a), when the given angle ui – kp; the locus of P i ; which fulfills the angle from

1209

the vector ðPiþ1 2 P i Þ to the vector ðPi21 2 P i Þ is ui ; is an arc from Piþ1 to Pi21 : The center of the arc is Ci ¼

Pi21 þ Piþ1 cosðui ÞkPi21 2 Piþ1 k2 þ V: 2 2sinðui Þ

The radius of the arc is ri ¼

kPi21 2 Piþ1 k2 ; 2lsinðui Þl

and the angle g from the vector ðPi21 2 Piþ1 Þ to the starting tangent vector V0 is 2kp þ p 2 ui ; where " # 2y V¼ x if the unit vector of the direction ðPi21 2 Piþ1 Þ is " # x : y When ui ¼ kp; the locus degenerates into a line segment with two end points Pi21 and Piþ1 : Therefore, moving a point, for example Pi ; with the minimum perturbation such that the inner angle of the polygon at Pi equals to a given value is moving Pi to the position, which is the closest to Pi and on the locus given by Theorem 2. Let P i be the point after the movement. As shown in Fig. 4(b), we usually require that Pi and P i are kept on the same side of the vector ðPðði21Þ%nÞ 2 Pððiþ1Þ%nÞ Þ: This requirement is satisfied if and only if there exist two integers k0 and k1 such that ððui 2 k0 pÞ [ ð0; pÞ and ðui 2 k1 pÞ [ ð0; pÞÞ or ððui 2 k0 pÞ [ ðp; 2pÞ and ðui 2 k1 pÞ [ ðp; 2pÞÞ;

ð6Þ

where ui is the inner angle of the polygon before the movement, and ui is the inner angle after the movement. If Requirement (6) is fulfilled, the formula for P i of the minimum movement is Pi 2 C i r P i ¼ Ci þ kPi 2 Ci k2 i

Fig. 4. Moving a point to a new position to satisfy the angle condition.

1210

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

where the formulae for calculating Ci and ri are given by Theorem 2. As shown in Fig. 4(b), we have kP i 2 Pi k2 ¼ lkPi 2 Ci k2 2 ri l:

ð7Þ Algorithm 2. Moving a point in a given closed point set to satisfy the closed G1 arc spline interpolation condition for the even case.

Define a weight function wi ðui Þ ¼ kPi 2 Ci k22 2 ri2 ; which is used to substitute kP i 2 Pi k2 for evaluating the movement of each point in the given point set. The idea here is to select a point or Ppoints, and calculate its/their new inner angle(s), such that i lwi ðui Þl is small, and that the sufficient and necessary condition for the closed G1 arc spline, i.e. Eq. (3), is satisfied. Substituting the formulae for Ci and ri into the function wi ðui Þ; we have wi ðui Þ ¼ ðPi 2Mi Þ2 2

ðPðði21Þ%nÞ 2Pððiþ1Þ%nÞ Þ2 4

Input: a given closed point set {Pi li ¼ 0; 1; …; n 2 1}; where n is an even integer. Output: a new closed point set {P i li ¼ 0; 1; …; n 2 1}: 1. Calculate lwi 0 ðui Þl for each point Pi ; where i ¼ 0; 1; …; n 2 1; 2. Find ip such that lwip 0 ðuip Þl ¼ min{lwi 0 ðui Þlli ¼ 0; 1; …; n 2 1}; 3. Move Pip to P ip such that the new inner angle

uip ¼ uip þ

2ðPi 2Mi ÞVkPðði21Þ%nÞ 2Pððiþ1Þ%nÞ k2 ctgðui Þ;

4. 5.

where Mi ¼

each inner angle would be even smaller. Based on the above analysis, we have the following algorithms.

Pððiþ1Þ%nÞ þPðði21Þ%nÞ : 2

6.

ð21Þipd ; 2

and kP ip 2 Pip k2 is mini-

mum; P j ¼ Pj ; for all j ¼ 0; 1; …; n 2 1 and j – ip; Output the closed point set {P i li ¼ 0; 1; …; n 2 1}; End of Algorithm 2.

And the first derivative of wi ðui Þ is wi 0 ðui Þ ¼

Algorithm 3. Moving points in a given closed point set to satisfy the closed G1 arc spline interpolation condition for the even case.

1 ðPi 2Mi ÞVkPðði21Þ%nÞ 2Pððiþ1Þ%nÞ k2 : sin ðui Þ 2

According to Lagrange Theorem (or Rolle Theorem) [4], if lui 2 ui l ¼ luj 2 uj l is small enough, and lwi 0 ðui Þl , lwj 0 ðuj Þl; then we have lwi ðui Þl , lwj ðuj Þl (note that lwi ðui Þl ¼ lwj ðuj Þl ¼ 0). Therefore, we usually move the point(s) with small lwi 0 ðui Þl: Now the problem is how to determine new inner angle(s) for the point(s), which will be moved. Let 2 3 n21 X j d ¼ 2kp þ 4 ð21Þ uj 5 and d [ ½2p; pÞ; j¼0

where k is an integer:

ð8Þ

For convenience, let an even (odd) point refer to a point with an even (odd) index in the polygon, and an even (odd) inner angle refer to an inner angle of the polygon at even (odd) point. Moving an even point Pi such that the inner angle is changed from ui to ui will increase the sum of even angles with ðui 2 ui Þ; and decrease the sum of odd angles with ðui 2 ui Þ as well. It is symmetry for moving an odd point. Therefore, when only a point, for example Pi ; is allowed to be moved to fulfill the interpolation condition, the new angle at the point Pi is i

ð21Þ d : ui ¼ ui þ 2 Because d [ ½2p; pÞ; the change of the inner angle will be within p=2: When multiple points are moved, the change of

Input: a given closed point set {Pi li ¼ 0; 1; …; n 2 1}; where n is an even integer. Output: a new closed point set {P i li ¼ 0; 1; …; n 2 1}: 1. Calculate lwi 0 ðui Þl for each point Pi ; where i ¼ 0; 1; …; n 2 1; 2. Add all lwi 0 ðui Þl into a set Sw ; and sort it in the increasing order; 3. Calculate s ¼ d=n; where d is given by Eq. (8); 4. For j ¼ 1 to n=2 by j þ þ do begin 4.1. Find the first element, say lwi 0 ðui Þl; in Sw such that Requirement (6) is fulfilled. Then, the inner angle is ui ¼ ui þ ð21Þi s; and the point Pi will be moved; 4.2. Move Pi to P i such that the new inner angle is ui ; and kP i 2 Pi k2 is minimum; 4.3. Calculate lwðði21Þ%nÞ 0 ðuðði21Þ%nÞ Þl; lwi 0 ðui Þl; and lwððiþ1Þ%nÞ 0 ðuððiþ1Þ%nÞ Þl according to the new point set, and adjust the set Sw such that its elements are still in the increasing order; 5. 6.

end/*End of the loop for*/ Output the closed point set after adjustment; End of Algorithm 3.

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

In Algorithm 3, the running time of the loop is determined by s: For each time, the difference between the sum of the even angles and the sum of the odd angles is P changed by 2s: A smaller s usually leads to a smaller  i lwi ðui Þl: However, it will require a longer running time. Experience shows that s ¼ d=n is a good trade-off between the two sides.

1211

The above formula is p-periodic, so fi ða0 Þ is p-periodic as well. For i ¼ 0; 1; …; n 2 1; let fi;0 ða0 Þ ¼ sinðaððiþ1Þ%nÞ þ ð21Þiþ1 a0 ÞkPððiþ1Þ%nÞ 2 Pi k2 and fi;1 ða0 Þ ¼ sinðai þ ð21Þi a0 ÞkPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 : From the first derivatives of fi;0 ða0 Þ fi;1 ða0 Þ

4. G1 arc spline generation For the even case, when Eq. (3) is fulfilled, any starting direction T0 could lead to an interpolation closed G1 arc spline. Therefore, the current problem is how to design T0 such that the resultant arc spline has the best quality. In the literate and also in the practical applications, it is often required that the radii of the arcs in the arc spline are close to each other [22]. This idea is adopted in this paper as well. Let Ri be the radii of Ai ; where Ai ði ¼ 0; 1; …; n 2 1Þ are the arcs in the resultant G1 arc spline, and, for i ¼ 0; 1; …; n 2 1; define 8 Ri Ri > > ; if # 1; > < Rððiþ1Þ%nÞ Rððiþ1Þ%nÞ f i ð a0 Þ ¼ ð9Þ > Rððiþ1Þ%nÞ Ri > > ; if . 1: : Ri Rððiþ1Þ%nÞ n21 fi ða0 Þ ¼ min{f0 ða0 Þ;f1 ða0 Þ;…;fn21 ða0 Þ}: Let gða0 Þ ¼ mini¼0 Thus, the objective is to find an angle a0 ; which determines the direction T0 ; such that

maxgða0 Þ is achieved. Let

a0 ¼ 0 and

2 3 i X 1 þ ð21Þiþ1 iþj ai ¼ 2ki p þ p þ 4 ð21Þ uðj%nÞ 5; 2 j¼1 i ¼ 1; 2; …; n; where ui ði ¼ 0; 1; …; n 2 1Þ are the inner angles of the polygon (see Theorem 1). According to Eq. (4), we have

ai ¼ ai þ ð21Þi a0 : From Lemma 1 and the above formula, we obtain Ri Rððiþ1Þ%nÞ

¼

lsinðaððiþ1Þ%nÞ þ ð21Þiþ1 a0 ÞlkPððiþ1Þ%nÞ 2 Pi k2 ; lsinðai þ ð21Þi a0 ÞlkPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2

i ¼ 0; 1; …; n 2 1: (

ð10Þ

and fi;1 ða0 Þ ; fi;0 ða0 Þ we obtain that fi;0 ða0 Þ fi;1 ða0 Þ and fi;1 ða0 Þ fi;0 ða0 Þ are monotone or constant at each periodic interval. All possible shapes of fi;0 ða0 Þ fi;1 ða0 Þ and fi;1 ða0 Þ fi;0 ða0 Þ can be classified into two categories, horizontal lines (constant functions) or the shapes similar to what are shown in Fig. 5(a) and (b). The differences in shapes only lie in the scaling in the vertical direction and the translation in the horizontal direction. The monotone and periodic properties are the same. Hence, the shape of fi ða0 Þ is either a horizontal line (a constant function) or a shape similar to the one shown in Fig. 6. The only possible differences are the scaling in the vertical direction and the translation in the horizontal direction. If fi ða0 Þ is not a constant function, fi ða0 Þ is monotone from the point fi ða0 Þ ¼ 0 to the point fi ða0 Þ ¼ 1; and then from fi ða0 Þ ¼ 1 to fi ða0 Þ ¼ 0; and so forth, as shown in Fig. 6. Therefore, maxgða0 Þ is achieved only at the point fi ða0 Þ ¼ 1; or the intersection points between fi ða0 Þ and fj ða0 Þ; where i; j ¼ 0; 1; …; n 2 1; and i – j: The following theorems give the formulae for calculating a0 such that fi ða0 Þ ¼ 1: Theorem 3. fi ða0 Þ is a 1-constant function, i.e. fi ða0 Þ ¼ 1 for all a0 [ R; if and only if

kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 cosðai Þ þ kPððiþ1Þ%nÞ 2 Pi k2 cosðaððiþ1Þ%nÞ Þ ¼ 0 kPððiþ1Þ%nÞ 2 Pi k2 sinðaððiþ1Þ%nÞ Þ 2 kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 sinðai Þ ¼ 0

1212

X.-D. Chen et al. / Computer-Aided Design 36 (2004) 1205–1218

where w [ R is the variable, sinðw þ w2 Þ – 0; and a; w1 ; w2 [ R are constants, and g 2 ð wÞ ¼

bsinðw þ w3 Þ ; sinðw þ w4 Þ

where w [ R is the variable, sinðw þ w4 Þ – 0; and b; w3 ; w4 [ R are constants. Then, the intersection results of g1 ðwÞ and g2 ðwÞ are as follows. Fig. 5. Typical shapes of fi;0 ða0 Þ=fi;1 ða0 Þ and fi;1 ða0 Þ=fi;0 ða0 Þ:

or (

(1) g1 ðwÞ and g2 ðwÞ represent the same function if and only if ðacosðw1 Þcosðw4 Þ ¼ bcosðw2 Þcosðw3 ÞÞ and

kPððiþ1Þ%nÞ 2 Pi k2 cosðaððiþ1Þ%nÞ Þ 2 kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 cosðai Þ ¼ 0 kPððiþ1Þ%nÞ 2 Pi k2 sinðaððiþ1Þ%nÞ Þ þ kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 sinðai Þ ¼ 0

is fulfilled.

ðasinðw1 þ w4 Þ ¼ bsinðw2 þ w3 ÞÞ and ðasinðw1 Þsinðw4 Þ ¼ bsinðw2 Þsinðw3 ÞÞ: (2) If ðacosðw1 Þcosðw4 Þ ¼ bcosðw2 Þcosðw3 ÞÞ and ðasinðw1 þ w4 Þ ¼ bsinðw2 þ w3 ÞÞ and ðasinðw1 Þsinðw4 Þ – bsinðw2 Þ sinðw3 ÞÞ; g1 ðwÞ and g2 ðwÞ have no intersection point.

Theorem 4. If fi ða0 Þ does not satisfy the conditions in Theorem 3, fi ða0 Þ ¼ 1 is achieved only at the following values of a0 ; 8 p > if kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 cosðai Þ þ kPððiþ1Þ%nÞ 2 Pi k2 cosðaððiþ1Þ%nÞ Þ ¼ 0 kp þ ; > > 2 < " # a0 ¼ kPððiþ1Þ%nÞ 2 Pi k2 sinðaððiþ1Þ%nÞ Þ 2 kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 sinðai Þ > 21 > > ; ð21Þi : kp þ tg kPððiþ2Þ%nÞ 2 Pððiþ1Þ%nÞ k2 cosðai Þ þ kPððiþ1Þ%nÞ 2 Pi k2 cosðaððiþ1Þ%nÞ Þ

otherwise;

or 8 p > kp þ ; > > 2
kp þ ; > > 2