Approximate Bézier curves by cubic LN curves

Approximate Bézier curves by cubic LN curves

Applied Mathematics and Computation 218 (2011) 3083–3092 Contents lists available at SciVerse ScienceDirect Applied Mathematics and Computation jour...

496KB Sizes 2 Downloads 145 Views

Applied Mathematics and Computation 218 (2011) 3083–3092

Contents lists available at SciVerse ScienceDirect

Applied Mathematics and Computation journal homepage: www.elsevier.com/locate/amc

Approximate Bézier curves by cubic LN curves Wei-Xian Huang, Cong-Jian Jin, Guo-Jin Wang ⇑ Department of Mathematics, Zhejiang University, Hangzhou 310027, China State Key Laboratory of CAD & CG, Zhejiang University, Hangzhou 310027, China

a r t i c l e

i n f o

Keywords: Offset Cubic LN Bézier curves Bézier curves Hausdorff distance Approximation

a b s t r a c t In order to derive the offset curves by using cubic Bézier curves with a linear field of normal vectors (the so-called LN Bézier curves) more efficiently, three methods for approximating degree n Bézier curves by cubic LN Bézier curves are considered, which includes two traditional methods and one new method based on Hausdorff distance. The approximation based on shifting control points is equivalent to solving a quadratic equation, and the approximation based on L2 norm is equivalent to solving a quartic equation. In addition, the sufficient and necessary condition of optimal approximation based on Hausdorff distance is presented, accordingly the algorithm for approximating the degree n Bézier curves based on Hausdorff distance is derived. Numerical examples show that the error of approximation based on Hausdorff distance is much smaller than that of approximation based on shifting control points and L2 norm, furthermore, the algorithm based on Hausdorff distance is much simple and convenient. Ó 2011 Elsevier Inc. All rights reserved.

1. Introduction Solving offset curves and surfaces is a classic problem in Computer Aided Geometric Design (CAGD), because offset curves and surfaces have wide applications in many fields, such as industrial design, computerized numerical control drawing. In the past several decades, numerous research has been done about offset curves and surfaces. Farouki and Sakkalis [1] introduced the concept of PH curves whose offset curves can be represented rationally. Later, Pottmann [2] introduced the concept of PN surfaces which was the generalization of PH curves. But it is difficult to realize the parameterizations of PN surfaces. Recently, some new methods have been introduced into CAGD. For example, Jüttler presented the class of curves and surfaces with a linear field of normal vectors (the so-called LN curves or LN surfaces) in [3], and the class of surfaces with rational support functions in [4]. Then a method to compute free-form curve and surface offsets, based on LN approximation was presented in [5]. Later in [6,7], this approach was extended to the more general operation of convolution. In 2007 Lávicˇka and Bastl [8] and Peternell [9] studied Bézier quadratic triangular patches: they proved that these well known surfaces are indeed LN surfaces. Because not all cubic Bézier curves are LN curves, some properties of cubic LN Bézier curves were studied in [10,11]. Ahn and Hoffmann [10] presented the sufficient and necessary condition that the cubic Bézier curve is a LN curve, and [11] studied the sufficient and necessary condition that the convolution curve of two cubic LN Bézier curves is rational. But they did not mention how to approximate the given Bézier curves by cubic LN Bézier curves. It is well known that the problem of curve approximation has been sufficiently studied, and there has been many algorithms, such as degree reduction approximation in [12], Hermite approximation in [5]. But actually, the special geometric properties of the LN curve have potential application values in geometric approximation, and the objective of this paper is to efficiently discover and display the above values. Because the LN Bézier curve has a linear field of normal vectors, it has the following two advantages. Firstly, it is simple to derive its convolution curves with circular arcs, that is to say, it is simple to obtain its offset curves; secondly, it is convenient ⇑ Corresponding author at: Department of Mathematics, Zhejiang University, Hangzhou 310027, China. E-mail address: [email protected] (G.-J. Wang). 0096-3003/$ - see front matter Ó 2011 Elsevier Inc. All rights reserved. doi:10.1016/j.amc.2011.08.032

3084

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

to compute its Hausdorff distance with other curves. As a result, the errors of approximation can be easily measured by Hausdorff distance. Therefore, the LN Bézier curve is suitable for curve approximation. Given the curve a(t), t 2 [0, 1] and its approximate curve b(t), t 2 [0, 1], the approximate error under L2 norm can be R1 expressed as L2 ðaðtÞ; bðtÞÞ ¼ 0 ðaðtÞ  bðtÞÞ2 dt. The error shows the global effect of approximation, but local error may be very large. Another metric in common use is L1 norm, but the corresponding approximate curve is difficult to be obtained. What is worse, the approximate error based on L2 norm and L1 norm depends on the parameterizations of the curves, so it cannot demonstrate the geometric error between the two curves. Fortunately, there is a measurement for the approximate error that can precisely show the geometric error between the two curves. It is Hausdorff distance defined as follows:

DH ðaðtÞ; bðsÞÞ ¼ maxfsup inf kaðtÞ  bðsÞk; sup inf kaðtÞ  bðsÞkg; t

s

s

t

where kk denotes the length of the vector. It is clearly that Hausdorff distance between two curves does not depend on the parameterizations of the curves, so it is necessary to do more research about Hausdorff distance. Recently, Hausdorff distance between curves and surfaces has been a hot research subject. For instance, [13] presented Hausdorff distance between two planar curves by using biarc approximation, [14] presented a precise algorithm that computed Hausdorff distance between two polyhedrons, and [15] constructed the approximate curve of the convolution curve of two conics based on Hausdorff distance. Aiming at the special properties of cubic LN Bézier curves, the paper will present three methods for approximating Bézier curves by cubic LN Bézier curves, which includes two traditional methods and one new method based on Hausdorff distance. Method 1 is the approximation based on shifting control points. It only needs to compute a quadratic equation, so this method is simple. But method 1 is only suitable for cubic Bézier curves. As for the Bézier curve with degree larger than 3, it needs to reduce the degree first [8], and then approximate the curve after degree reduction by the cubic LN Bézier curve. As a result, the error is much large. Method 2 is the approximation based on L2 norm. It only needs to compute a quartic equation, so this method is also simple. But the error depends on the parameterizations of the curve, which results in large error. Method 3 is the approximation based on Hausdorff distance. The paper presents the sufficient and necessary condition that the approximate curve is the best, and suggests the corresponding algorithm. Numerical examples show that the approximation based on Hausdorff distance is effective, simple, and convenient, what is more, the approximate error is much smaller than the error of method 1 and method 2. 2. Preliminaries This section will present some preliminaries. [10] presented the detailed description of cubic LN Bézier curves, including the corresponding expressions of normal vectors and tangent vectors. Here we describe the cubic LN Bézier curve briefly in Definition 1. Lemma 1 presents the sufficient and necessary condition that Hausdorff distance between two curves is reached, which is the base of method 3. Definition 1. Given three non-collinear points b0, bm, b3 and a parameter s 2 (1, 0) [ (1, 1], the cubic Bézier curve

bðtÞ ¼ ð1  tÞ3 b0 þ 3ð1  tÞ2 tb1 þ 3ð1  tÞt2 b2 þ t 3 b3 is a regular LN curve on [0, 1], where the control points are defined as follows:

½b0 ; b1 ; b2 ; b3  ¼ ½b0 ; ð1  d0 Þb0 þ d0 bm ; ð1  d1 Þb3 þ d1 bm ; b3 ; d0 ¼

2s 2ðs  1Þ ; d1 ¼ : 3s  2 3s  1

Furthermore, the normal vector of the curve is

nb ðtÞ ¼ ð3s  2ÞN 0 ð1  tÞ þ ð3s  1ÞkN 1 t and the tangent vector is

T b ðtÞ ¼ ð3s  2Þðbm  b0 Þð1  tÞ þ ð3s  1Þðb3  bm Þt; where N0 (see Fig. 1) denotes the unit vector in the direction of a rotation p2 of b0bm anticlockwise, N1 denotes the unit vector 3 bm k in the direction of a rotation p2 of bmb3 anticlockwise, and k ¼ kb . kbm b0 k Lemma 1. Suppose two planar regular parametric curves a(t), t 2 [0, 1], b(s), s 2 [0, 1] have the same endpoints, then Hausdorff distance

DH ðaðtÞ; bðsÞÞ ¼ maxfsup inf kaðtÞ  bðsÞk; sup inf kaðtÞ  bðsÞkg; t

s

s

t

between them can be reached at the points that have the same normal vectors. That is to say, if DH(a(t), b(s)) = ka(t0)  b(s0)k, then the normal vector of a(t) at the parameter to and the normal vector of b(s) at the parameter so are collinear [12]. Furthermore, the vector a(t0)  b(s0) is parallel to the normal vector of a(t) at the parameter to.

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

3085

4 3.5

bm

3 2.5

δ1 δ: 1− 1

2

0

:1 − δ

1.5

0.5

0

δ

1

N

N1

2

b3

0

0

b

0

−0.5 −1 −1

b

b1

0

1

2

3

4

5

6

Fig. 1. The control polygon of cubic LN Bézier curves.

3. Approximation based on shifting control points and L2 norm Suppose the degree n Bézier curve is defined as follows:

pðtÞ ¼

n X

Bni ðtÞP i ;

ð1Þ

i¼0

  n ð1  tÞni t i are Bernstein polynomials of degree n, Pi are control points. From Definition 1, it can be seen i that the cubic LN Bézier curve b(t) is convex, and the oriented angle for the vector b0bm to the vector bmb3 is less than p. Without loss of generality, the curve p(t) is supposed to be convex, and the oriented angle from the vector p0p1 to the vector pn1pn is less than p, because it can be done easily through subdivision of the curve. The details about subdivision of Bézier curves can be found in [16].

where Bni ðtÞ ¼

3.1. Approximation for cubic Bézier curves based on shifting control points Suppose the approximate curve b(t) of the cubic Bézier curve

pðtÞ ¼

3 X

B3i ðtÞP i

i¼0

is a cubic LN Bézier defined in Definition 1. In order to make the approximate curve be G1 interpolation at the endpoints, the following interpolating conditions have to be established:

b0 ¼ p0 ;

b3 ¼ p3 ;

bm ¼ p3 þ ðp2  p3 Þ

kðp0  p3 Þ  ðp1  p0 Þk ; kðp2  p3 Þ  ðp1  p0 Þk

where  denotes the cross product of vectors, and the geometric meaning of the point bm is the intersection of two straight lines p0p1 and p3p2. Therefore, if the value of the parameter s is determined, then the approximate curve is also determined. The problem is reduced to determining the minimum value of the following function:

f ðsÞ ¼ kb1  p1 k2 þ kb2  p2 k2 ; s 2 ð1; 0Þ [ ð1; 1: In order to simplify the solution, the above function is transformed into the following function whose minimum value has to be determined:

f ðsÞ ¼ kð3s  1Þðb1  p Þk2 þ kð3s  2Þðb2  p Þk2 ; 1 2

s 2 ð1; 0Þ [ ð1; 1:

This is a quadratic function with respect to s, which is simplified as follows:

f ðsÞ ¼ c2 s2 þ c1 s þ c0 ;

s 2 ð1; 0Þ [ ð1; 1;

where

c2 ¼ ðb0 þ 2bm  3p1 Þ2 þ ðb3 þ 2bm  3p2 Þ2 ; c1 ¼ 2½ðb0 þ 2bm  3p1 Þðb0  p1 Þ þ ðb3 þ 2bm  3p2 Þð2bm  2p2 Þ; c2 ¼ ðb0  p1 Þ2 þ ð2bm  2p2 Þ2 : The minimum value of the above equation can be obtained at one parameter of

n

o 0 ; 1þ ;  2cc12 .

3086

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

3.2. Approximation for degree n (n P 3) Bézier curves based on L2 norm For the Bézier curve p(t) of degree n defined as Eq. (1), the curve can first be approximated by a cubic Bézier curve if n > 3, such that they have degree 1 continuity at the endpoints [12], and then the cubic LN approximate Bézier curve b(t) can be obtained according to the method in Section 3.1. But we present another simple method based on L2 norm in this paper. Actually, in order to make the approximate curve be G1 interpolation at the endpoints, the following equations can be obtained:

b0 ¼ p0 ;

b3 ¼ pn ;

bm ¼ pn þ ðpn1  pn Þ

kðp0  pn Þ  ðp1  p0 Þk : kðpn1  pn Þ  ðp1  p0 Þk

ð2Þ

Therefore, we only need to determine the value of the parameter s. We minimize the following distance between the approximate curve b(t) and the given curve p(t) under the L2 norm:

L2 ðsÞ ¼

Z

1

ðbðtÞ  pðtÞÞ2 dt;

s 2 ð1; 0Þ [ ð1; 1:

0

If the function L2(s) has a minimum value at the parameter s0, and s0 does not belong to [0, 1], then the derivative of L2(s) with respect to s equals to 0,

 Z 1 @ 2  @ L ðsÞ ¼ ðbðtÞ  pðtÞÞ2 dtjs¼s0 ¼ 0: @s 0 @s s¼ s0

Clearly, the above equation has degree 4 with respect to s0, which can be simplified as follows:

a0 ð3s0  1Þð3s0  2Þ3 þ a1 ð3s0  1Þ3 ð3s0  2Þ þ a2 ð3s0  1Þ3 ðs0  1Þ þ a3 ð3s0  1Þ3 s0 þ a4 ð3s0  2Þ3 s0 þ a5 ð3s0  2Þ3 ðs0  1Þ þ a6 ð3s0  1Þð3s0  2Þ2 ðs0  1Þ þ a7 ð3s0  1Þð3s0  2Þ2 s0 þ a8 ð3s0  1Þ2 ð3s0  2Þs0 þ a9 ð3s0  1Þ2 ð3s0  2Þðs0  1Þ ¼ 0; where

a0 ¼

n X 1 1 b0 ðb0  bm Þ þ b3 ðb0  bm Þ  42 105 i¼0

  n Cði þ 2ÞCðn  i þ 3Þ ðb0  bm Þpi ; Cðn þ 5Þ i

a1 ¼

n X 1 1 b3 ðbm  b3 Þ þ b0 ðbm  b3 Þ  42 105 i¼0

  n Cði þ 3ÞCðn  i þ 2Þ ðbm  b3 Þpi ; Cðn þ 5Þ i

a2 ¼

2 bm ðbm  b3 Þ; 35

a3 ¼

1 b3 ðbm  b3 Þ; 35

a6 ¼

3 bm ðb0  bm Þ; 70

a7 ¼

3 b3 ðb0  bm Þ; 140

a4 ¼

2 bm ðb0  bm Þ; 35

a8 ¼

3 bm ðbm  b3 Þ; 70

a5 ¼

1 b0 ðb0  bm Þ; 35

a9 ¼

3 b0 ðbm  b3 Þ: 140

If the solutions do not belong to (1, 0) [ (1, 1], then the minimum value of L2(s) can be obtained at one of {0, 1+}; if some   2 of solutions belong to (1, 0) [ (1, 1], suppose they are s10 ; . . . ; sm 0 ; 1 6 m 6 4, then minimum value of L (s) can be  1  obtained at one of s0 ; . . . ; sm . 0 Remark 1. Because quadratic Bézier curves are always LN curves, the degree of the Bézier curves in this paper is assumed to be larger than or equal to 3.

4. Approximation based on Hausdorff distance 4.1. Hausdorff distance between the cubic LN approximate curve and the given curve Suppose the given Bézier curve p(t) of degree n is defined as Eq. (1). Because the approximate curve and the given curve have the same endpoints, their Hausdorff distance is independent of the singularity of the endpoints. In addition, it can be seen that the approximate curve b(s) should satisfy Eq. (2) in Section 3.2. Hence, the curves p(t) and b(s) satisfy the conditions in Lemma 1. Suppose their Hausdorff distance is obtained as follows:

DH ðpðtÞ; bðsÞÞ ¼ kpðt 0 Þ  bðs0 Þk;

t 0 2 ð0; 1Þ;

s0 2 ð0; 1Þ;

then the curve p(t) at the parameter t0 and the curve b(s) at the parameter s0 should satisfy the following two equations:

½pðt 0 Þ  bðs0 ÞT b ðs0 Þ ¼ ½pðt 0 Þ  bðs0 Þ½ð3s  2Þðbm  b0 Þð1  s0 Þ þ ð3s  1Þðb3  bm Þs0  ¼ 0;

ð3Þ

T p ðt 0 Þnb ðs0 Þ ¼ T p ðt 0 Þ½ð3s  2ÞN 0 ð1  s0 Þ þ ð3s  1ÞkN 1 s0  ¼ 0;

ð4Þ

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

3087

where Tb(s0), nb(s0) are defined in Definition 1, and Tp(t0) is the tangent vector of the curve p(t) at the parameter t0. Because Eq. (4) is a linear function with respect to s0, we can obtain the following equation:

s0 ðt0 Þ ¼

ð3s  2ÞT p ðt0 ÞN 0 : ð3s  2ÞT p ðt 0 ÞN 0  ð3s  1ÞÞkT p ðt0 ÞN 1

Substitute above equation into Eq. (3), the following equation is obtained:

½pðt 0 Þ  bðs0 ðt0 ÞÞ½kðbm  b0 ÞðN 1 T p ðt 0 ÞÞ þ ðb3  bm ÞðN 0 T p ðt 0 ÞÞ ¼ 0;

t 0 2 ð0; 1Þ:

ð5Þ

It can easily be seen that Eq. (5) is an algebraic equation of degree 5n  4 with respect to t0. As a result, in order to obtain Hausdorff distance between the approximate curve and the given curve, it is sufficient to solve an algebraic equation of degree 5n 4. According to Lemma 1, Eq. (5) has at least on solution.    1   We  suppose   these solutions are t10 ; t20 ; . . . ; tm s0 t0 ; s0 t20 ; . . . ; s0 tm . Therefore, Hausdorff 0 ; m P 1, and then we can get the corresponding parameters 0 distance between the approximate curve and the given curve can be obtained as follows:

DH ðpðtÞ; bðsÞÞ ¼ max

i¼1;2;...;m

  i      p t  b s0 t i : 0 0

ð6Þ

4.2. Approximation based on Hausdorff distance Because the approximate curve depends on the parameter s, it is denoted by b(s, s) for convenience. If the approximate curve satisfies the following equation:

DH ðpðtÞ; bðs; sB ÞÞ 6 fDH ðpðtÞ; bðs; sÞÞ;

s 2 ð1; 0Þ [ ð1; 1g; sB 2 ð1; 0Þ [ ð1; 1;

then the curve b(s, sB) is called the best approximate curve based on Hausdorff distance. In addition, denote         Dn t i0 ; s ¼ p t i0  b s0 t i0 ; s .           Lemma 2. If the vector p ti0  b s0 t i0 ; s and nb s0 t i0 ; s have opposite directions, then it can be obtained that

  @ @   i   nb ðs0 ðt i0 Þ; sÞ Dn t i0 ; s ¼ b s0 t0 ; s    i   : nb s0 t ; s @s @s 0           If p ti0  b s0 t i0 ; s and nb s0 t i0 ; s have the same direction, then it can be obtained that

    i  @ @   i   nb s0 t i0 ; s     : D n t 0 ; s ¼  b s0 t 0 ; s  nb s0 t i ; s @s @s 0

Proof. First, according to Lemma 1, we obtain the following equations:

 i     @ pðt i0 Þ ¼ 0; p t 0  b s0 ti0 ; s @t

 i     @   i   b s0 t 0 ; s ¼ 0; p t 0  b s0 ti0 ; s @t

          in addition, the vectors p ti0  b s0 ti0 ; s and nb s0 ti0 ; s are collinear. As a result, we obtain the formula as follows:

 i             p t 0  b s0 ti0 ; s @@s p ti0  b s0 t i0 ; s @   i    i   Dn t i0 ; s ¼ p t  b s0 t ; s  @s 0 0

 i   i   @  i  @         p t 0  b s0 t0 ; s @t p t 0 @s t  @t@ b s0 t i0 ; s @@s t  @@s b s0 ti0 ; s   i    i    ¼ p t  b s0 t ; s  0 0

 i   i   @   i            p t 0  b s0 t 0 ; s @ s b s0 t 0 ; s nb s0 t i0 ; s @@s b s0 ti0 ; s   i      i      i   ¼ ¼ : p t  b s0 t ; s  nb s0 t ; s  0 0 0

Hence, it can be seen that Lemma 2 holds. h Lemma curve b(s, sB) is the best approximate curve if and only if there are two different points    3. The approximate    b s0 ta0 ; sB ; b s0 tb0 ; sB on the curve which satisfy the following three conditions:     (1) @@s Dn ta0 ; sB @@s Dn t b0 ; sB < 0; a  b  (2) Dn t 0 ; sB ¼ Dn t0 ; sB ;       (3) Dn t a0 ; sb ¼ Dn tb0 ; sB is the largest among all Dn t i0 ; sB .

3088

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

Proof. The proof is similar to that in [15], so we omit it. h     It can be easily seen that if @@s Dn t i0 ; s > 0, the distance Dn t i0 ; s will decrease with the decrease of the parameter s, and vice versa. Since the Hausdorff distance DH(p(t), b(s,s)) depends continuously on the parameter s, we see that there must be a parameter s0 2 (1, 0) [ (1, 1] for which the Hausdorff distance DH(p(t), b(s, s)) attains its minimum value. We use the iterative algorithm to derive the best  approximate   curve b(s, sB) for the degree n Bézier curve p(t) based on Hausdorff distance. Suppose that we obtain Dn ta0 ; s0 and Dn tb0 ; s0 which are defined is the following Step 3, and suppose that a  b  a  b  Dn t 0 ; s0  P Dn t0 ; s0 . If Dn t0 ; s0 ¼ Dn t 0 ; s0 , then according to Lemma 3, the best approximate curve is b(s, s0). If Dn t a0 ; s0 > Dn tb0 ; s0 , then we update the parameter s0 by s0 + d. The variation d is determined by the condition (2) in Lem    ma 3, that is, Dn ta0 ; s0 þ d ¼ Dn t b0 ; s0 þ d . In order to simply solve this equation with respect to d, a first order approximation is applied to the equation as follows:

        @ @ Dn ta0 ; s0 þ d Dn ta0 ; s0 ¼ Dn tb0 ; s0 þ d Dn t b0 ; s0 : @s @s Hence, we can obtain the variation d according to the above linear equation. Actually, the iteration process to obtain the best parameter sB is Newton’s method. So the convergence of the iteration process is promised. We present the details of the iterative algorithm in the following Algorithm 1. Algorithm 1. (The approximate algorithm based on Hausdorff distance) Input. Degree n Bézier curve p(t), and the tolerance . Output. Cubic LN Bézier curve b(s, sB). Step1. According to Eq. (2), three control points of the curve b(s, sB) are obtained as follows:

b0 ¼ p0 ;

b3 ¼ pn ;

bm ¼ pn þ ðpn1  pn Þ

kðp0  pn Þ  ðp1  p0 Þk : kðpn1  pn Þ  ðp1  p0 Þk

Step2. Compute the initial value s0, such that the curve b(s, s0) interpolates p(0.5). That is to say, solve the following equation:

bðs0 ; s0 Þ ¼ pð0:5Þ; for the parameters s0, s0. If the initial value s0 belongs to [0, 1] or there is no real solution s0, then the best approximate curve b(s, sB) is one of {b(s, 0), b(s, 1+)}, the algorithm stops. Otherwise, goto Step 3. Step3. Solve Eq. (5) in Section 4.1, and obtain

        Dn ti0 ; s0 ¼ p t i0  b s0 t i0 ; s0 ; i ¼ 1; 2; . . . ; m:     According to the signs of @@s Dn t i0 ; s0 , we distribute Dn t i0 ; s0 into two groups and denote the maximum values of each group as follows:



  @   Dn ti0 ; s0 j Dn t i0 ; s0 > 0 ; i¼1;2;...;m @s

b  i  @   Dn t 0 ; s0 ¼ max Dn t 0 ; s0 j Dn t i0 ; s0 < 0 : i¼1;2;...;m @s

  Dn t a0 ; s0 ¼ max

     If Dn ta0 ; s0  Dn t b0 ; s0  < , then the algorithm stops. The best approximate curve is b(s, sB) = b(s, s0). Otherwise, goto Step4. Dn ðt a ;s ÞDn ðt b ;s Þ Step4. Update s0 by s0 þ @ D t0b ;s0  @ D 0ta 0;s . If the updated s0 belongs to [0, 1], then the best approximate curve @s n ð 0 0 Þ @s n ð 0 0 Þ b(s, sB) is one of {b(s, 0), b(s, 1+)}. Compute their corresponding Hausdorff distance to determine which is the best, and the algorithm stops. Otherwise, goto Step 3.       Remark 2. In the Step 3 of Algorithm 1, we suppose that Dn ta0 ; s0 and Dn t b0 ; s0 can be obtained, that is to say, Dn t a0 ; s0 b  and Dn t0 ; s0 are non-empty, because they can always be obtained by shifting the interpolating point in Step 2. Remark 3. In all three methods, in order to reduce the approximate error, if the derived approximate curve is one of {b(s, 0), b(s, 1+)}, then it is necessary to do mid-point subdivision for the given curve, and approximate the subdivided curves by cubic LN Bézier curves.

3089

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092 7

7

bm

6

b2

5

b2

5

b1

b1

y

4

y

4

bm

6

3

3

2

2

1

b3

b0

0 0

1

2

3

4

5

6

0 0

7

b3

b0

1

1

2

3

4

x

5

6

7

x

Fig. 2. The approximate curves in Example 1: (left) the approximate curve based on shifting control points, (right) the approximate curve based on L2 norm.

7

b1

6

4

bm

3.9 3.8

5

3.7

y

y

4

b2

3

3.5

2 1

3.6

3.4

b0

b3

3.3 3.2

0 0

1

2

3

4

5

6

7

3.5

3.6

x

3.7

3.8

x

3.9

4

4.1

4.2

Fig. 3. The approximate curves in Example 1: (left) the approximate curve based on Hausdorff distance, (right) zoom in for the curves in the rectangle of Fig. 3(left).

Remark 4. Because the algorithm needs the normals of the curves, we consider only regular Bézier curves in the paper. Corollary 1. Suppose two planar regular curves a1(t), t 2 [0, 1], a2(t), t 2 [0, 1] have the same endpoints, and the cubic LN Bézier curve b(s, sB) is the best approximation of a1(t), then Hausdorff distance between the curves a1(t) and a2(t) satisfies:

DH ða1 ðtÞ; a2 ðsÞÞ 6 DH ða1 ðtÞ; bðs; sB ÞÞ þ DH ða2 ðtÞ; bðs; sB ÞÞ; where DH(ai(t), b(s, sB)), i = 1, 2 can be computed by Eq. (6). Table 1 Approximation for the curve in Example 1 based on Hausdorff distance. 

s

t

s

@ @ s Dn

Initial values

1.4063

One iteration

1.4376

Two iterations

1.4393

0.3336 0.7123 0.3719 0.7390 0.3739 0.7405

0.2370 0.5970 0.2697 0.6248 0.2715 0.6267

0.1673 0.0851 0.1323 0.0970 0.1305 0.0975

ti0 ; s0



  Dn t i0 ; s0 0.0154 0.0075 0.0108 0.0104 0.0105 0.0105

Hausdorff distance 0.0154 0.0108 0.0105

3090

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092 7

7

bm

6

6

b1

5

b1

bm

5

b2 y

4

y

4 3

3

2

2

1

b3

b0

0 0

1

2

3

4

5

6

1

7

b2 b0

0 0

b3 1

2

3

4

5

6

7

x

x

Fig. 4. The approximate curves in Example 2: (left) the approximate curve based on L2 norm, (right) the approximate curve based on Hausdorff distance.

5. Numerical examples This section will present several examples, and give comparisons between the corresponding approximate curves derived from three methods. In the following figures, the solid curves denote the given curves and their corresponding control polygons, the dashed curves denote the approximate curves and their corresponding control polygons, and the dashdotted curves denote the corresponding offset curves. If we obtain the approximate cubic LN Bézier curve b(s, sB), then the offset curve can be computed as: pd(s) = b(s, sB) + d  nb(s, sB)/knb(s, sB)k. Example 1. The control points of the given cubic Bézier curve are (1, 1), (3, 4), (5, 5), (6, 1). The approximate curve derived from method 1 (based on shifting control points) is shown as Fig. 2(left), and its Hausdorff distance is 0.0747. The approximate curve derived from method 2 (based on L2 norm) is shown as Fig. 2(right), and its Hausdorff distance is 0.0729. The approximate curve derived from method 3 (based on Hausdorff distance) is shown as Fig. 3, and its Hausdorff distance is 0.0105. See Table 1 for details. Example 2. The control points of the given degree 4 Bézier curve are (1, 1), (2, 3), (3, 4), (5, 3), (6, 1). The approximate curve derived from method 2 is shown as Fig. 4(left), and its Hausdorff distance is 0.2177. The approximate curve derived from method 3 is shown as Fig. 4(right), and its Hausdorff distance is 0.1028. See Table 2 for details. Example 3. The control points of the given degree 7 Bézier curve are (1, 1), (1.85, 2.28), (2.7, 3.1), (3.5, 3.9), (4.3, 4.1), (5, 3.5), (5.5, 2.7), (6, 1). The approximate curve derived from method 2 is shown as Fig. 5(left), and its Hausdorff distance is 0.0480. The approximate curve derived from method 3 is shown as Fig. 5(right), and its Hausdorff distance is 0.0334. See Table 3 for details. It can be seen that from the above three examples, the approximate errors based on Hausdorff distance are much smaller than the approximate errors based on shifting control points and based on L2 norm. It is efficient and convenient to derive the best approximate curve based on Hausdorff distance through Algorithm 1. In addition, as an application of approximation by cubic LN Bézier curve, the approximate offset curves of the given curves in all figures are presented.

Table 2 Approximation for the curve in Example 2 based on Hausdorff distance. 

s

t

s

@ @ s Dn

Initial values

1.1420

One iteration

1.1250

Two iterations

1.1257

0.3146 0.6928 0.3091 0.6882 0.3094 0.6884

0.2300 0.5831 0.2237 0.5732 0.2240 0.5736

0.2751 0.3952 0.2879 0.4418 0.2874 0.4398

ti0 ; s0



  Dn t i0 ; s0 0.1074 0.0960 0.1062 0.1031 0.1028 0.1028

Hausdorff distance 0.1074 0.1062 0.1028

3091

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092 7

7

b

6

m

b

5

b1

5

2

b

1

4

b2

y

y

4

bm

6

3

3

2

2

0

b3

b0

1

0

1

2

3

4

5

6

b0

1 0

7

0

b 1

2

x

3

4

5

3

6

7

x

Fig. 5. The approximate curves in Example 3: (left) the approximate curve based on L2 norm, (right) the approximate curve based on Hausdorff distance.

Table 3 Approximation for the curve in Example 3 based on Hausdorff distance. 

s

t

s

@ @ s Dn

Initial values

1.7619

One iteration

1.7062

Two iterations

1.7105

0.2773 0.6984 0.2712 0.6895 0.2717 0.6902

0.2084 0.6124 0.2019 0.5993 0.2024 0.6003

0.0221 0.0569 0.0241 0.0682 0.0239 0.0672

  Dn t i0 ; s0

Hausdorff distance

0.0346 0.0302 0.0333 0.0337 0.0334 0.0334

0.0346 0.0337 0.0334

4

3 2

3

1

2

y

y



5

4

0

1

−1

0

−2

−1

−3

−2

−4

ti0 ; s0

0

2

4

x

6

8

2

4

6

8

10

x

Fig. 6. The approximate curves based on Hausdorff distance in Example 4: (left) the C-type Bézier curve, (right) the S-type Bézier curve.

Example 4. In this example, we present one C-type and one S-type quartic Bézier curves (see Fig. 6). First, we need to subdivide the curves into two sub-curves. Then, we apply Algorithm 1 to obtain their approximate cubic LN Bézier curves based on Hausdorff distance. The error for the curve in Fig. 6(left) is 0.1103, and the error for the curve in Fig. 6 (right) is 0.1362.

6. Conclusion This paper presents three methods for approximating general degree n Bézier curves by cubic LN Bézier curves, which includes two traditional methods and one new method based on Hausdorff distance. The methods based on shifting control

3092

W.-X. Huang et al. / Applied Mathematics and Computation 218 (2011) 3083–3092

points and L2 norm are traditional, and the solutions are simple. Algorithm 1 derives the approximate curve based on Hausdorff distance by applying the special properties of cubic LN Bézier curves. From the numerical examples in the paper, it can be seen that Algorithm 1 is much efficient, and the approximate errors based on Hausdorff distance are much smaller than those based on shifting control points and L2 norm. Acknowledgements This work was supported by the National Nature Science Foundations of China under Grant Nos. 60933007 and 61070065. We thank to all referees for their comments which helped us to improve the paper. References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

R.T. Farouki, T. Sakkalis, Pythagorean hodographs, IBM J. Res. Dev. 34 (1990) 36–752. H. Pottmann, Rational curves and surfaces with rational offsets, Comput. Aided Geo. Des. 12 (1995) 75–192. B. Jüttler, Triangular Bézier surface patches with linear normal vector field: the mathematics of surfaces VIII, R. Cripps, Information Geometers, 1998. Z. Sı´r, J. Gravesen, B. Jüttler, Curves and surfaces represented by polynomial support functions, Theor. Comput. Sci. 39 (2008) 141–157. B. Jüttler, M.L. Sampoli, Hermite interpolation by piecewise polynomial surfaces with rational offsets, Comput. Aided Geo. Des. 17 (2000) 361–385. M.L. Sampoli, Computing the convolution and the Minkowski sum of surfaces, Proceedings of the Spring Conference on Computer Graphics ACM Digital Library (2005) 111–117. M.L. Sampoli, M. Peternell, B. Jüttler, Rational surfaces with linear normals and their convolution with rational surfaces, Comput. Aided Geo. Des. 23 (2006) 179–192. M. Lávicˇka, B. Bastl, Rational hypersurfaces with rational convolutions, Comput. Aided Geo. Des. 24 (2007) 410–426. M. Peternell, B. Odehnal, Convolution surfaces of quadratic triangular Bézier surfaces, Comput. Aided Geo. Des. 25 (2008) 116–129. Y.J. Ahn, C. Hoffmann, Constraint-based LN Curves, in: Proceedings of ACM Symposium on Applied Computing’10, Symp. Appl. Comput. 2010, pp.1242– 1246. Y.J. Ahn, C. Hoffmann, Approximate convolution with pairs of cubic Bézier LN curves, Comput. Aided Geo. Des. 28 (2011) 357–367. R.J. Zhang, G.J. Wang, Constrained Bézier curves’ best multi-degree reduction in the norm, Prog. Nat. Sci. 15 (2005) 843–850. Y.J. Kim, Y.T. Oh, S.H. Yoon, M.S. Kim, G. Elber, Precise Hausdorff distance computation for planar freeform curves using biarcs and depth buffer, Vis. Comput. 26 (2010) 1007–1016. M. Barton, I. Hanniel, G. Elber, M.S. Kim, Precise Hausdorff distance computation between polygonal meshe, Comput. Aided Geo. Des. 27 (2010) 580– 591. S. Hur, T.W. Kim, Finding the best conic approximation to the convolution curve of two compatible conic based on Hausdorff distance, Comput. Aided Des. 41 (2009) 513–524. G. Farin, Curves and Surfaces for Computer Aided Geometric Design, a Practical Guide, third ed., Academic Press, 1993.