C-shaped G2 Hermite interpolation with circular precision based on cubic PH curve interpolation

C-shaped G2 Hermite interpolation with circular precision based on cubic PH curve interpolation

Computer-Aided Design 44 (2012) 1056–1061 Contents lists available at SciVerse ScienceDirect Computer-Aided Design journal homepage: www.elsevier.co...

333KB Sizes 0 Downloads 58 Views

Computer-Aided Design 44 (2012) 1056–1061

Contents lists available at SciVerse ScienceDirect

Computer-Aided Design journal homepage: www.elsevier.com/locate/cad

C-shaped G2 Hermite interpolation with circular precision based on cubic PH curve interpolation Yajuan Li, Chongyang Deng ∗ School of Science, Hangzhou Dianzi University, Hangzhou 310018, China

article

info

Article history: Received 10 October 2011 Accepted 24 April 2012 Keywords: Cubic PH curve Rational cubic Bézier curve Circular arc G2 Hermite interpolation

abstract Based on the technique of C-shaped G1 Hermite interpolation by a cubic Pythagorean-hodograph (PH) curve, we present a simple method for C-shaped G2 Hermite interpolation by a rational cubic Bézier curve. The method reproduces a circular arc when the input data come from it. Both the Bézier control points, which have a well-understood geometrical meaning, and the weights of the resulting rational cubic Bézier curve are expressed in explicit form. We test our method with many numerical examples, and some of them are presented here to demonstrate the properties of our method. The comparison between our method and a previous method is also included. © 2012 Elsevier Ltd. All rights reserved.

1. Introduction Hermite interpolation, the generation of smooth curve segments satisfying given end conditions, is a popular modeling method in computer-aided geometric design (CAGD). In particular, because (rational) Bézier curve are common to all modern design systems [1], Hermite interpolation with a (rational) Bézier curve has been extensively studied [1–7]. Related to interpolating G2 Hermite data by a (rational) Bézier curve, as early as the 1980s, de Boor et al. [2] obtained an interpolation of high accuracy for second-order geometric contact by a planar cubic Bézier curve. Degen [4] improved this method by introducing a rational cubic Bézier curve. The methods of both de Boor et al. and Degen depend on the solution of a system of two simultaneous quadratic equations, which may be expressed as a single fourth-degree polynomial equation. Rational schemes offer the additional flexibility of weights over nonrational schemes. Sakai [5] used the additional degrees of freedom for shape-preserving G2 interpolation and Chen [6] used the additional degrees of freedom to match the torsion for spatial splines. None of these methods can reproduce a circular arc when the input data are sampled from one. For ‘pleasant’ curve shapes, according to Farin [8], the change in curvature is more important than the magnitude of curvature. That is, the less the change in curvature of the curve, the better the curve. A circular arc is thus the best curve. Hence striving for circular arcs seems desirable wherever possible. Recently,



Corresponding author. Tel.: +86 571 85185531; fax: +86 571 86919030. E-mail addresses: [email protected] (Y. Li), [email protected], [email protected] (C. Deng). 0010-4485/$ – see front matter © 2012 Elsevier Ltd. All rights reserved. doi:10.1016/j.cad.2012.04.007

Farin proposed some G1 Hermite interpolation methods using a rational cubic Bézier curve [8], which reproduce a circular arc when the input data come from it. Walton and Meek presented a G2 Hermite interpolation method by improving Farin’s method [7]. The method in [7] also reproduces a circular arc when the input data come from it, but the tangential angle between the given tangent vector and the line joining the two end points must be no more than 23 π . Furthermore, the solvability condition is complex, so the result has to be obtained by numerical solution. In this paper, based on C-shaped G1 Hermite interpolation by a cubic Pythagorean-hodograph curve, we give a simple method for C-shaped G2 Hermite interpolation by a rational cubic Bézier curve, which also reproduces a circular arc when the input data sampled from it. Our method allows circular arcs with a span up to (not equal to) 34 π , i.e. the largest possible span for a circular arc represented by a rational cubic Bézier curve [9]. The upper limit of the tangential angle between the given tangent vector and the line joining the two end points is now increased to be no more than π . Pythagorean-hodograph (PH) curves were introduced by Farouki and Sakkalis [10]. The property of PH curves provides a number of advantages in applications such as computer numerical control machining, interpolation of discrete data, and control of digital motion along curved paths. As the simplest class of PH curves, cubic PH curves possess an elegant control polygon, and this has been thoroughly investigated [11–14]. To interpolate given C-shaped G2 Hermite data, we first interpolate the corresponding G1 Hermite by a cubic PH curve and then achieve the end curvature interpolation by assigning weights. So the control polygon of the interpolation rational cubic Bézier curve has the same elegant control polygon as a cubic PH curve. The rest of this paper is organized as follows. The definition of a cubic PH curve, the definition of the Bézier control polygon

Y. Li, C. Deng / Computer-Aided Design 44 (2012) 1056–1061

1057

(1) When 0 < α + β < π , L1 = L

sin β(sin β − sin α + A) sin(α + β)(sin α + sin β + A) 2 sin α sin β

,

, (sin α + sin β + A) sin α(sin α − sin β + A) . L3 = L sin(α + β)(sin α + sin β + A)

L2 = L Fig. 1. The Bézier control polygon of a cubic PH curve.

sin

(1)

α+β 2

(2) When α + β = π , L1 = L

cos α +



1 + 3 sin2 (α) 2

,

L2 = L sin α, L3 = L

(2)

− cos α +



1 + 3 sin2 (α)

2

Fig. 2. G1 Hermite interpolation data.

(3) When π < α + β < of a cubic PH curve matching C-shaped G1 Hermite interpolation data, and the definition of a rational cubic Bézier curve are given in Section 2. Then, in Section 3, C-shaped G2 Hermite data interpolation by a rational cubic Bézier curve is proposed, and a discussion of the circular precision is given. Examples and remarks are presented in Section 4. Section 5 is devoted to conclusions.

L1 = L

4 3

.

π,

sin α + sin β[4 cos(α + β) + 3] + A 2 sin(α + β)[2 cos(α + β) + 1]

,

−(sin α + sin β + A)

, [2 cos(α + β) + 1] sin β + sin α[4 cos(α + β) + 3] + A . L3 = L 2 sin(α + β)[2 cos(α + β) + 1] L2 = L

2. Preliminaries

2 sin

α+β

(3)

2

Here,

2.1. Bézier control polygon of a cubic PH curve A cubic PH curve with Bézier form is defined in [11].

L = ∥b3 − b0 ∥ and

3 Definition 1. A cubic Bézier curve b(t ) = i=0 Bi (t )bi is a PH curve if and only if the following equations hold (see Fig. 1):

3

L22 = L1 L3 where

B3i

and

(t ) =

b0 b1 b2 = ̸ b1 b2 b3 ,

̸

  3 i

(1 − t )

t (i = 0, 1, 2, 3) are the Bernstein

3−i i

basis functions and Li = ∥bi − bi−1 ∥ (i = 1, 2, 3) are side length of the control polygon in Bézier form (Fig. 1).

A=

 (sin α + sin β)2 + 4 sin α sin β[1 + 2 cos(α + β)].

Proof. Let M be the intersection point of extended lines of b0 b1 and b2 b3 . Let ∥b1 − M∥ = ∥b2 − M∥ = D (see Fig. 3). By the sine law, we get the following equations. (1) When 0 < α + β < π (see Fig. 3(a)), D + L1

2.2. G1 Hermite interpolation with a cubic PH curve Given G1 Hermite data {b0 , T0 ; b3 , T1 }, without loss of generality, we assume that the middle point of the line segment joining b0 and b3 is the origin, and that b3 is on the positive real axis. Let α be the angle from the positive x-axis to the given tangent vector T0 , and let β be the angle from the given tangent vector T1 to the positive x-axis. A cubic PH curve has no inflection points, so we assume that the tangent vector rotates clockwise as one traverses the curve, which means that we have curvatures with the same sign and the tangential angle restriction 0 < α, β < π . That is, the G1 Hermite data must be C-shaped (see Fig. 2). Based on the geometric relationship among Bézier control points of a cubic PH curve, Meek and Walton construct a unique cubic PH curve in Bézier form matching the G1 Hermite data [12]. For the sake of convenience, we change the form of the cubic PH curve by giving the length of every side of control polygon using explicit formulae as follows. Theorem 1. For given G1 Hermite interpolation data {b0 , T0 ; b3 , T1 } with 0 < α, β < π , α + β < 34 π , a unique cubic PH curve in Bézier form that matches the G1 Hermite data has the following explicit formulae.

sin β L2

=

L

sin(α + β)

=

sin

D + L3

=

sin(α + β) D

sin α

,

.

α+β 2

(2) When α + β = π (See Fig. 3(b)), L2 = L sin α,

L1 = L3 + L cos α.

(3) When π < α + β < D − L1 sin β L2

=−

sin(α + β)

4 3

π,

L sin(α + β) D

=−

sin

α+β

=

D − L3 sin α

,

.

2

Substituting the above equations into Definition 1 respectively, we can get Eqs. (1)–(3). The Bézier control points of the cubic PH curve matching the given G1 Hermite interpolation data are b0 = (−L/2, 0),

b3 = (L/2, 0),

b1 = b0 + L1 (cos α, sin α), b2 = b3 + L3 (− cos β, sin β). 

(4)

1058

Y. Li, C. Deng / Computer-Aided Design 44 (2012) 1056–1061

(a) 0 < α + β < π .

(b) α + β = π .

(c) π < α + β <

4 3

π.

Fig. 3. Bézier control polygon of a cubic PH curve.

3.1. G2 Hermite interpolation algorithm To interpolate given G2 Hermite data {b0 , T0 , κ0 ; b3 , T1 , κ1 } by a rational cubic Bézier curve r(t ), first, we define the control polygon of r(t ) as the control polygon of the cubic PH curve interpolating G1 Hermite data {b0 , T0 ; b3 , T1 }. Second, by a similar method to that given in [1] (fifth ed. p. 234), we compute the values of weights w1 , w2 such that the cubic rational Bézier curve matches the G2 Hermite data. For convenience, we choose the same coordinate as in the G1 Hermite interpolation problem addressed in Section 2.2. Substituting the value of κ0 , κ1 into Eq. (6), we have

Fig. 4. G2 Hermite interpolation data.

2.3. Rational cubic Bézier curve

κ0 =

Let us express a rational cubic Bézier curve [9] as r(t ) =

B30 (t )b0 + B31 (t )w1 b1 + B32 (t )w2 b2 + B33 (t )b3 B30 (t ) + B31 (t )w1 + B32 (t )w2 + B33 (t )

0 ≤ t ≤ 1,

C0 = (5)

∥r′ (t ) × r′′ (t )∥ , ∥r′ (t )∥3

, ∥(b1 − b0 )∥3 2w1 ∥(b3 − b2 ) × (b2 − b1 )∥ κ(1) = . ∥(b3 − b2 )∥3 3w22

κ1 =

2w1 3w22

C1 ,

C1 =

∥(b1 − b0 ) × (b2 − b1 )∥ L31

∥(b3 − b2 ) × (b2 − b1 )∥ L33

3κ0 w12 = 2C0 w2 ,

(7)

, (8)

.

3κ1 w22 = 2C1 w1 .

According to the interpolation condition, κ0 , κ1 , C0 , C1 are positive; thus the unique and positive w1 , w2 can be obtained as

2w2 ∥(b1 − b0 ) × (b2 − b1 )∥

3w12

C0 ,

By changing the form of the above system of equations, we have

we represent the ending curvature as

κ(0) =

3w

2 1

where

,

where w1 , w2 > 0 are weights, and bi (i = 0, 1, 2, 3) are control points. By the curvature formula

κ(t ) =

2w2

(6)

w1 =

2 3

 3

C1 C02

, 2

κ1 κ0

w2 =

2 3

 3

C0 C12

κ0 κ12

.

(9)

Thus the following theorem holds. 3. C-shaped G 2 Hermite interpolation by a rational cubic Bézier curve The two-point G2 Hermite interpolation problem is to find a parametric curve matching G1 Hermite interpolation data and the curvature κ0 at b0 , κ1 at b3 (see Fig. 4). The interpolation method is given in Section 3.1, and the circular precision property is proposed in Section 3.2.

Theorem 2. For given C-shaped G2 Hermite data {b0 , T0 , κ0 ; b3 , T1 , κ1 } (see Fig. 4) with 0 < α, β < π , 0 < α + β < 34 π , there exits a unique rational cubic Bézier curve (Eqs. (4), (5) and (9)) matching the G2 Hermite data, with the same control points as those of a cubic PH curve. We now present the whole algorithm.

Y. Li, C. Deng / Computer-Aided Design 44 (2012) 1056–1061

1059

1 + 2 cos α w1 = w2 = , 3   L sin α −L , , b1 = 2(1 + 2 cos α) 1 + 2 cos α   L sin α L b2 = , , 2(1 + 2 cos α) 1 + 2 cos α So 3w1 − 1 = 3w2 − 1, 3w1 b1 − b0 = 3w2 b2 − b3 = (0, L sin α), w 1 L1 = w 2 L2 .



Fig. 5. Curves and control polygons when the input data come from a circular arc.

Algorithm 1 G2 Hermite data interpolation by rational cubic Bézier curve Input: C-shaped G2 Hermite data {b0 , T0 , κ0 ; b3 , T1 , κ1 } with 0 < α, β < π , 0 < α + β < 43 π , κ0 , κ1 > 0 (see Fig. 4). Output: A rational cubic Bézier curve which interpolates {b0 , T0 , κ0 ; b3 , T1 , κ1 }. Procedure 1: Compute L, L1 , L3 using Eqs. (1), (2), and (3) when 0 < α + β < π , α + β = π and π < α + β < 34 π , respectively ; 2: Compute b1 , b2 using Eq. (4); 3: Compute C0 , C1 using Eq. (8); 4: Compute w1 , w2 using Eq. (9); 5: return A rational cubic Bézier curve as Eq. (5). 3.2. Circular precision The method produces a circular arc when the input data come from such. To prove this proposition, we input a set of data coming from a circular arc: 2π 4π 2 sin α 0<α=β < , α+β < , κ0 = κ1 = . 3 3 L Substituting the above equalities into Eqs. (1)–(4), (8) and (9), we obtain L L1 = L2 = L3 = , 1 + 2 cos α

(a) Curves and control polygons.

By the relationship between control points and weights of a rational cubic Bézier curves representing a circular arc [9], we can easily come to the conclusion that the rational cubic curve (5) is a circular arc when the input data come from it. We present two different sets of curves and control points, obtained by our method and by the method in [7], in Fig. 5. From this figure, we can see that both methods produce the same curve and the same control polygon. 4. Examples and remarks For convenience, and without loss of generality, we assume that L = 2, which means that b0 = (−1, 0), b3 = (1, 0) in all of the examples. For the simple reason that all other G2 Hermite interpolation methods cannot reproduce a circular arc, we only give the curves produced by our method and by the method in [7]. We tested our method and compared it with the method in [7] using many numerical examples. Here we give four examples which represent four classes: 0 < α + β < π , α + β = π , π < α + β < 43π , and 32 π < α < π and 23 π < β < π . For every example, the curves and control polygons produced by our method (red lines) and the curves and control polygons produced by the method in [7] (blue dot–dashed lines) are given in one figure, which is followed by another figure, in which the curvature plots of the two curves are given. 4.1. Example for 0 < α + β < π Example 4.1 (see Fig. 6). α = 0.65π , β = 0.25π , κ0 = 8,

κ1 = 0.5.

(b) Curvature plots. Fig. 6. Example 4.1.

1060

Y. Li, C. Deng / Computer-Aided Design 44 (2012) 1056–1061

(a) Curves and control polygons.

(b) Curvature plots. Fig. 7. Example 4.2.

(a) Curves and control polygons.

(b) Curvature plots.

Fig. 8. Example 4.3.

(a) Curves and control polygons.

(b) Curvature plots. Fig. 9. Example 4.4.

4.2. Example for α + β = π Example 4.2 (see Fig. 7). α = 0.35π , β = 0.65π , κ0 = 0.8,

κ1 = 3.

4.3. Example for π < α + β < 43π Example 4.3 (see Fig. 8). α = 0.45π , β = 0.65π , κ0 = 0.8,

κ1 = 1.5.

4.4. Example when 23 π < α < π (or 23 π < β < π ) Example 4.4 (see Fig. 9). α = 0.85π , β = 0.45π , κ0 = 3,

κ1 = 0.4.

To prevent negative weights for the rational cubic Bézier curve determined in [7], there is a restriction that α, β < 23 π . With our method, the upper limit of α and β are now increased to be no more than π . Of course, the sum of them must be less than 43 π at the same time.

Y. Li, C. Deng / Computer-Aided Design 44 (2012) 1056–1061

In these examples and many other examples, our method gives better or at least no worse curvature distribution than those obtained by the method in [7]. Furthermore, the control polygons derived by our method are always ‘better’ than those derived by Walton and Meek’s method, where ‘better’ means having a better understood geometrical meaning. The explicit formulae to obtain a unique and exact solution were given in this article, while the solvability condition in [7] is complex, so the result has to be obtained by numerical solution. 5. Conclusion In this paper, we have proposed a C-shaped G2 Hermite interpolation method by a rational cubic Bézier curve based on cubic PH curve interpolation. Given input data coming from a circular arc, the method reproduces the arc. The input tangential angle can be only less than π . The weights and Bézier control points are expressed in explicit form, and the control polygon has a wellunderstood geometrical meaning. A disadvantage of our method lies in the fact that we cannot handle S-shaped G2 Hermite interpolation. In fact, to improve the method so that it can produce an S-shaped curve by one rational curve, we can try a kind of higher-degree PH curve, or look for the help of the TC-interpolant in [15]. Acknowledgment This work is supported by NSFC (11026107, 60970079, and 61003194).

1061

References [1] Farin G. Curves and surfaces for computer aided geometric design. New York: Academic Press; 1996. [2] de Boor C, Höllig K, Sabin M. High accuracy geometric Hermite interpolation. Computer Aided Geometric Design 1987;4:269–78. [3] Goodman TNT. Shape preserving interpolation by parametric rational cubic splines. International series of numerical mathematics, vol. 86. Basel: Birkhauser Verlag; 1988. p. 149–58. [4] Degen WLF. High accurate rational approximation of parametric curves. Computer Aided Geometric Design 1993;10:293–313. [5] Sakai M. Osculatory interpolation. Computer Aided Geometric Design 2001; 18(8):739–50. [6] Chen J, Zhang S, Bao H, Peng Q. G3 continuous curve modeling with rational cubic Bézier spline. Progress in Natural Science 2002;12(3): 217–221. [7] Walton DJ, Meek DS. G2 Hermite interpolation with circular precision. Computer-Aided Design 2011;42(9):749–58. [8] Farin G. Geometric Hermite interpolation with circular precision. ComputerAided Design 2008;40(4):476–9. [9] Piegl L, Tiller W. The NURBS book. 2nd ed. New York, NY: Springer-Verlag; 1997. [10] Farouki RT, Sakkalis T. Pythagorean hodograph. IBM Journal of Research and Development 1990;34(5):736–52. [11] Farouki RT. The conformal map z → z 2 of the hodograph plane. Computer Aided Geometric Design 1994;11(4):363–90. [12] Meek DS, Walton DJ. Geometric Hermite interpolation with Tschirnhausen cubics. Journal of Computational and Applied Mathematics 1997;81(2): 299–309. [13] Jüttler B, Mäurer C. Cubic Pythagorean-hodograph spline curves and applications to sweep surface modeling. Computer-Aided Design 1999;31: 73–83. [14] Pelosi F, Farouki R, Manni C, Sestini A. Geometric Hermite interpolation by spatial Pythagorean-hodograph cubics. Advances in Computational Mathematics 2005;22(4):325–52. [15] Byrtus M, Bast B. G1 Hermite interpolation by PH cubics revisited. Computer Aided Geometric Design 2010;27:622–30.