Computer Aded Geometrc Desgn 22 (2005) 183 197 www.elsever.com/locate/cagd Fast degree elevaton and knot nserton for B-splne curves Q-Xng Huang a,sh-mnhu a,, Ralph R. Martn b a Department of Computer Scence and Technology, Tsnghua Unversty, Bejng 100084, PR Chna b School of Computer Scence, Cardff Unversty, Cardff, CF24 3AA, Unted Kngdom Receved 30 Aprl 2004; receved n revsed form 15 October 2004; accepted 10 November 2004 Avalable onlne 30 November 2004 Abstract We gve a new, smple algorthm for smultaneous degree elevaton and knot nserton for B-splne curves. The method s based on the smple approach of computng dervatves usng the control ponts, resamplng the knot vector, and then computng the new control ponts from the dervatves. We compare our approach wth prevous algorthms and llustrate t wth examples. 2004 Elsever B.V. All rghts reserved. Keywords: B-splnes; Degree elevaton; Knot nserton 1. Introducton Several methods have been gven for degree elevaton of B-splne curves (Cohen et al., 1985; Lu and Wayne, 1997; Prautzsch, 1984; Prautzsch and Pper, 1991; Pgel and Tller, 1994), the fastest of whch s Prautzsch and Pper s algorthm (Prautzsch and Pper, 1991). Unfortunately, ther algorthm suffers from beng complcated and hard to mplement. On the other hand, Pegl and Tller s (1994) algorthm s more straghtforward, and easer to understand. It splts the B-splne curve nto Bézer curve peces, rases the degree of each pece, and then recombnes the degree-elevated Bézer curves to produce the new B-splne curve. Lu s algorthm (Lu and Wayne, 1997) has the benefts of beng both smple to mplement and fast. It takes the approach of computng the new control ponts usng a seres of knot nsertons followed by a seres of knot deletons. * Correspondng author. E-mal address: shmn@tsnghua.edu.cn (S.-M. Hu). 0167-8396/$ see front matter 2004 Elsever B.V. All rghts reserved. do:10.1016/j.cagd.2004.11.001
184 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 We gve here a new fast, smple method for degree elevaton of B-splne curves, whch can also smultaneously nsert knots. Our approach s based on the well known fact that a polynomal curve s unquely determned by ts value at a gven pont together wth the values of all ts dervatves at that pont. Ths observaton can be generalsed to B-splnes whch are pecewse polynomals, and hence B-splne curves: each curve segment over the knot nterval [t,t +1 ] s determned by the value of the curve and ts dervatves at the knot t. We have already used ths observaton to devse a knot adjustment algorthm for B-splnes (Ta et al., 2003). The dervatves of a B-splne can be computed effcently usng a varety of approaches (Ferrar et al., 1994; Wang et al., 1996). It has been shown that usng the nverse approach leads to a knot refnement algorthm (Sankar et al., 1994) whch s sgnfcantly faster than the usual Oslo algorthm (Cohen et al., 1980). In a smlar ven to (Sankar et al., 1994), ths paper gves a new degree elevaton algorthm based on representng a B-splne usng dervatves, and convertng t back to the usual pecewse polynomal form. Our new algorthm has the followng advantages: our algorthm s more effcent than exstng algorthms, our algorthm s smple to mplement, wth a readly understood conceptual bass, our algorthm can handle unclamped B-splne curves, whereas prevous algorthms only work n the clamped case, our algorthm can be generalzed to perform knot nserton. Secton 2 outlnes varous B-splne formulae we need later. Secton 3 descrbes our new algorthms. Secton 4 provdes examples and a comparson wth other approaches. We close the paper wth some conclusons and a dscusson. 2. B-splne formulae Here we summarze varous relevant B-splne formulae. A B-splne curve of order k s defned by a lnear combnaton of B-splne bass functons as: n P(t)= P N,k (t), t k 1 t t n+1, (1) =0 where the P are control ponts, and N,k (t), = 0,...,n, are B-splne bass functons defned recursvely on the knot vector T =[t 0,...,t n+k ] as (Pegl and Tller, 1997): { 1 f t t<t N,1 (t) = +1, (2) 0 otherwse, N,k (t) = t t N,k 1 (t) + t +k t N +1,k 1 (t). (3) t +k 1 t t +k t +1 (By conventon, f 0/0 appears n the formula, we replace t by 0.) We could explctly requre that t +k >t :ft +k = t, ths leads to N,k (t) = 0, resultng n a B-splne curve whch splts nto two separate B-splne curves. However, there s no need to mpose ths condton,
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 185 and Eq. (1) s stll vald wth ths choce of knot vector. Ths fact s mportant because the (k p)th dervatve of a B-splne curve may not satsfy the condton that t +p >t, but t s stll convenent to treat t as a sngle B-splne curve. As some knots wth consecutve subscrpts may be equal, for the sake of convenence, we rewrte the knot vector n another form as follows: T =[t 0,...,t k 2,u 0,u 1,...,u 1,u 2,...,u 2,...,u S 1,...,u S 1,u S,t n+2,...,t n+k ], (4) z 1 z S 1 z 2 where t 0 t k 2 u 0,u S t n+2 t n+k,and{u } =0,...,S s a strctly ncreasng sequence, wth {z } =1,...,S 1 beng a postve nteger sequence gvng the multplctes of each of the knots: 1 z k; = 1, 2,...,S 1. The multplcty of each u s z. Let P (l) (t) denote the lth dervatve of P(t).Then n l P (l) (t) = P l N +l,k l(t), =0 where N +l,k l (t) are the B-splne bass functons defned over the knot vector gven by Eq. (4), and the P l are defned recursvely by: P f l = 0, P l = k l t +k t +l (P l 1 +1 P l 1 ) f l>0andt +k >t +l, (6) 0 f l>0andt +k = t +l. Alternatvely, we can compute P l 1 +1 P l 1 +1 = P l 1 + t +k t +l P l k l. from P l 1 and P l by a rearrangement of Eq. (6): We call P j the dervatve coeffcents of the B-splne P(t). When a B-splne curve has only smple knots, Wang (Wang et al., 1996) gves the followng formula to compute the (k 1)th dervatves at the knots usng the P j as follows: P (k 1) (u ) = P k 1. (8) For curves havng multple knots, we now gve a smlar formula: Theorem 1. P (j) (u ) = P j β, k z j k 1, 1 S 1, (9) where β = l=1 z l. Proof. n j P (j) (u ) = =0 n j N +j,k j (u ) = P j N +j,k j (t β +k 1) P j =0 β +k j 1 = =β P j N +j,k j (t β +k 1) (5) (7)
186 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 = P j β N β +j,k j (t β +k 1) (10) = P j β. (11) Eq. (10) follows from u = t β +k 1 = t +j and Eq. (11) follows from β +k j 1 N β +j,k j (t β +k 1) = N +j,k j (t β +k 1) = 1. =β Knot vectors of B-splnes can be classfed as clamped or unclamped (Pegl and Tller, 1997). The knot vector of a clamped B-splne curve satsfes t 0 = t 1 = =t k 2 = u 0 and u S = t n+2 = =t n+k. We may also say that P(t) s left-clamped f t 0 = t 1 = =t k 1. It s well known that a left-clamped B-splne curve P(t)satsfes P (j) (u 0 ) = P j 0, 0 j k 1. (12) Exstng degree elevaton algorthms (Lu and Wayne, 1997; Prautzsch and Pper, 1991; Pgel and Tller, 1994) can only handle clamped B-splne curves, so exstng approaches to rasng the degree of an unclamped B-splne curve frst clamp ts knot vector by means of a clampng algorthm (Pegl and Tller, 1997). As an alternatve, we use a knot adjustment algorthm (Ta et al., 2003) for ths purpose; t can easly be combned wth our new degree elevaton algorthm to obtan greater overall effcency. 3. Degree elevaton 3.1. Degree elevaton of a clamped B-splne curve Snce a B-splne curve s a pecewse polynomal curve, t s possble to rase ts degree from k to k + m, where m s an nteger greater than or equal to 1. Thus, there must exst control ponts Q and a new knot vector T =[ t 0,..., t n+k+m ] such that P(t)= Q(t) = n =0 N,k+m (t)q, (13) where n s the number of control ponts of Q(t), and N,k+m (t), = 0,..., n, are the B-splne bass functons of order k + m defned on the knot vector T. The curves P(t) and Q(t) have the same geometry and parameterzaton. The computaton of n, Q, and T s referred to as rasng the degree of the curve (Pgel and Tller, 1994). The knot vector T and n can be computed as follows. Assume that T takes the form gven n Eq. (4). Snce degree elevaton preserves contnuty, Q(t) has contnuty of order C k z at u, and the new knot vector must take the form T =[u 0,...,u 0,u 1,...,u 1,u 2,...,u 2,...,u S 1,...,u S 1,u S,...,u S ], (14) k+m z 1 +m z 2 +m z S 1 +m k+m so that n = n + S m. We now consder how to fnd the Q.
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 187 3.1.1. The new degree elevaton algorthm Theorem 2. The dervatve coeffcents of P(t) and Q(t) are related as follows Q j 0 = P j 0, 0 j k 1, (15) Q t β p +pm = P β p, 1 p S 1, k z p k 1, (16) Q k 1 β p +pm+j = Qk 1 β p +pm, 1 p S 1, 1 j m. (17) Proof. Theorem 1 gves that, P () (u 0 ) = P0, 0 k 1, Q () (u 0 ) = Q 0, 0 k 1, P () (u p ) = Pβ p,q () (u p ) = Q β p, 1 p S 1, k z p k 1. As P(t) and Q(t) have the same geometry and parametrzaton, so do ther dervatves, whch proves Eqs. (15) and (16). Consder one segment of the knot vector, t [u p,u p+1 ). It s well known that at most k + m of the B-splne bass functons N,k+m (t) are nonzero n ths knot segment; more precsely, N +k,m (t) s nonzero on [u p,u p+1 ) when β p + (p 1)m k + 1 β p + pm k. Consder the kth dervatves of P(t)and Q(t). As the degree of P(t)s k 1, ts kth dervatve equals zero, and thus so does the kth dervatve of Q(t), sothat: n+s m 0 = P (k) (t) = Q (k) (t) = Q k n +k,m(t) = =0 β p +pm k =β p +(p 1)m k+1 Q k n +k,m(t). (18) Eq. (18) allows us to deduce that Q k = 0, β p + (p 1)m k + 1 β p + pm k, and as a result we can deduce Eq. (17): Q k 1 +1 = Qk 1 + t +k+m t +k (k + m) k Qk. Remark. It s obvous that Theorem 2 holds as long as P(t) and Q(t) are just left-clamped; t does not matter f the curve s rght-unclamped. To do degree elevaton for an unclamped curve, we can turn t nto a left-clamped curve usng the knot adjustment algorthm mentoned earler. For a gven l n Eqs. (6) and (7), we can see that dvson by a common factor of (k l) s needed for all, so from a software engneerng pont of vew, t smplfes matters f we defne nstead P j = P j / j (k l), l=1 Q j = / j Qj (k + m l), l=1 whch lets us rewrte Eqs. (6) and (7) n smpler form: P j = j 1 P +1 P j 1, t +k t +l (19)
188 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 P j 1 +1 = P j 1 + (t +k t +l ) P j. (20) Eqs. (15) (17) now become j ( ) Q j k l 0 = P j 0, 0 j k 1, (21) k + m l l=1 j ( ) k l Q j β p +pm = P j β k + m l p, 1 p S 1, k z p j k 1, (22) l=1 Q k 1 β p +pm+ = Q k 1 β p +pm, 1 p S 1, 1 m. (23) Ths leads to greater effcency. For example, n the case where the knots of P(t) are not repeated, then j l=1 ( k l ) can be computed a pror, so whle Eqs. (15) and (16) add a further n multplcatons, k+m l Eqs. (19) and (20) save a total of n(k 1) multplcatons and mn(k 1) dvsons respectvely. Based on the equatons developed above, we now gve a procedural method for degree elevaton of a clamped B-splne curve as follows: Algorthm 1. Rase a clamped B-splne curve from degree k to degree k + m. Use Eq. (19) to compute P j 0,0 j k 1and P β p,1 p S 1, k z p k 1. Use Eq. (14) to compute T and set ñ to n + S m. Use Eqs. (21) (23) to get Q j 0,0 j k 1, Q β p +pm, Q k 1 β p +pm+j. Use Eq. (20) to compute new control ponts Q 0. 3.1.2. Example We now gve a numercal example showng how our algorthm works. Fg. 1 shows a clamped B-splne curve. The orgnal curve P(t) s an order 4 B-splne curve wth knot vector {0, 0, 0, 0, 0.5, 0.5, 1, 1, 1, 1} and control ponts {(260, 100), (100, 260), (260, 420), (420, 420), (580, 260), (420, 100)}. The curve Q(t) after degree elevaton s an order 5 B-splne wth knots {0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 1, 1, 1, 1, 1} and wth control ponts {(260, 100), (140, 220), (180, 340), (280, 420), (400, 420), (500, 340), (540, 220), (420, 100)}. The dfferental coeffcents of the two curves are presented below together wth the relatons from Theorem 2: Q 0 0 = P 0 0, Q 0 1 = 3 4 P 0 1, Q 0 2 = 1 2 P 0 2, Q 0 3 = 1 4 P 0 3, Q 3 2 = 1 2 P 2 2, Q 3 3 = 1 4 P 3 2, Q 1 3 = Q 0 3, Q 4 3 = Q 3 3.
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 189 Fg. 1. Degree elevaton from order 4 to order 5. Dfferental coeffcents of P(t): P 0 0(260, 100) P 1 0(100, 260) P 2 0 (260, 420) P 0 1( 320, 320) P 1 1(320, 320) P 2 1 (160, 0) P 0 2(1280, 0) P 1 2( 320, 640) P 2 2 (320, 640) P 0 3( 3200, 1280) P 1 3(320, 640) P 2 3 ( 3200, 1280) P 3 0(420, 420) P 4 0(580, 260) P 5 0 (420, 100) P 3 1(320, 320) P 4 1 ( 320, 320) P 3 2 ( 1280, 0). Dfferental coeffcents of Q(t): Q 0 0 (260, 100) Q 0 1 (140, 220) Q 0 2 (180, 340) Q 0 3 (280, 420) Q 1 0 ( 240, 240) Q 1 1 (80, 240) Q 1 2 (200, 160) Q 1 3 (120, 0) Q 2 0 (640, 0) Q 2 1 (240, 160) Q 2 2 ( 160, 320) Q 2 3 (160, 320) Q 3 0 ( 800, 320) Q 3 1 ( 800, 320) Q 3 2 (160, 320) Q 3 3 ( 800, 320) Q 4 0 (0, 0) Q 4 1 (0, 0) Q 4 2 (0, 0) Q 4 3 (0, 0) Q 0 4 (400, 420) Q 0 5 (500, 340) Q 0 6 (540, 220) Q 0 7 (420, 100) Q 1 4 (200, 160) Q 1 5 (80, 240) Q 1 6 ( 240, 240) Q 2 4 ( 240, 160) Q 2 5 ( 640, 0) Q 3 4 ( 800, 320).
190 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 3.2. Degree elevaton of an unclamped B-splne curve The above method can readly be generalsed to the case of an unclamped B-splne curve. Ths s done by consderng the approprate knot adjustment and degree rasng results n turn, and combnng them. 3.2.1. Problem statement Let P(t)= n =0 N,k(t)P be a B-splne curve defned on the knot vector T =[t 0,...,t k 2,u 0,u 1,...,u 1,...,u S 1,...,u S 1,u S,t n+2,...,t n+k ]. z 1 z S 1 We wsh to rase the degree of ths B-splne from k to k + m, and compute an approprate new knot vector. We denote the fnal curve by Q(t), wth knot vector of the form: T =[ t 0,..., t k+m 2,u 0,u 1,...,u 1,...,u S 1,...,u S 1,u S, t n+sm+2,..., t n+(s+1)m+k ]. z 1 +m z S 1 As before { t 0 t 1 t k+m 2 u 0 } and {u S t n+sm+2... t n+(s+1)m+k } are nput values whch may be chosen by the user. 3.2.2. Degree elevaton algorthm Frst, we change the knot vector of P(t)to ts left-clamped form T 1 =[u 0,...,u 0,u 1,...,u 1,...,u S 1,...,u S 1,u S,t n+1,...,t n+k ]. k z 1 z S 1 The new curve R(t) defned on T 1 has control ponts R, = 0,...,n. By consderng the dervatve coeffcents of P(t)and R(t) arsng n the knot adjustment algorthm, we have R k 1 0 = P k 1 0 R k 2 l l = P k 2 l l, 0 l k 2. (24) R β p = P β p, 1 p S 1, k z p k 1, (25) R l = R +1 l (t +k t k 1 ) R l+1, = 0,...,k 3 l, l = k 3,...,0. (26) We now use the degree elevaton algorthm for a clamped B-splne curve to rase the degree of R(t) as desred. Let the result be U(t) wth control ponts U and knot vector T 2 =[u 0,...,u 0,u 1,...,u 1,...,u S 1,...,u S 1,u S, t n+sm+2,..., t n+(s+1)m+k ]. k+m z 1 +m z S 1 The relatons between the R j and the Ũ j are gven by Eqs. (21) (23) where we replace P by R and Q by U. Fnally, we change the knot vector T 2 to T and fnd Q(t). By consderng the dervatve coeffcents of U(t) and Q(t),andasQ l = U l = 0, l k from the knot adjustment algorthm, we have Q j β p +pm = Ũ j β p +pm, 1 p S 1, k z p j k 1, (27) Q k 1 β p +pm+ = Q k 1 β p +pm = Ũ k 1 β p +pm+ = Ũ k 1 β p +pm, 1 p S 1, 1 m, (28) Q j m+k 1 j = Ũ j m+k 1 j, 1 j k 1, Q k 1 = Ũ k 1, 1 l m, (29)
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 191 Q j = Q j +1 ( t +k+m t +j+1 ) Q j+1, = 0,...,k+ m 2 j, j = 0,...,k 2. (30) These may readly be cast nto algorthmc form as before. 3.3. Combnng knot nserton and degree elevaton 3.3.1. Problem statement In ths secton, we only consder the case of a clamped B-splne curve. Let P(t)= n =0 P N,k (t) be a B-splne curve defned over the knot vector T =[u 0,...,u 0,u 1,...,u 1,u 2,...,u 2,...,u S 1,...,u S 1,u S,...,u S ] k z 1 z 2 z S 1 k as before. We now wsh to rase ts degree from k to k + m, and also to nsert a set of new knots s each wth multplcty y : [s 0,...,s 0,s 1,...,s 1,...,s l,...,s l ]. (31) y 0 y 1 y l We denote the fnal curve by Q(t). We may express the fnal knot vector as: T =[ū 0,...,ū 0, ū 1,...,ū 1,...,ū l[1],...,u l[1],...,ū l[s] 1,...,ū l[s] 1, ū l[s],...,ū l[s] ], (32) k+m z 1 z l[1] z l[s] 1 k+m where ū l[] = u, 0 S, are the knots of orgnal curve and the knots [ū 1,...,ū 1,...,ū l[1] 1,...,ū l[1] 1, ū l[1],...,ū l[1],...,ū l[s] 1,...,ū l[s] 1 ] (33) z 1 z l[1] 1 z l[1] z 1 m z l[s] 1 are the ones nserted. Thus, the number of new knots s n = n + Sm + l =0 y,where l =0 y s the number of knots beng nserted. Here Eq. (33) gves another way of expressng Eq. (31). 3.3.2. Combnng knot nserton and degree elevaton Exstng degree elevaton and knot nserton algorthms use dfferent approaches whch are hard to combne. However, our degree elevaton algorthm and the knot nserton algorthm proposed by (Sankar et al., 1994) use the same dea,.e., computng dervatves from control ponts, resamplng the knot vector, and computng new control ponts from dervatves. It s thus possble to combne the two algorthms. The resultng algorthm s more effcent than performng degree elevaton and knot nserton separately. The followng theorem descrbes the relatons between dervatves of the curve before and after degree elevaton and knot nserton. Theorem 3. Q j 0 = P j 0, 0 j k 1, (34) Q j β = P j l[] β, k z j k 1, 1 S 1, (35) Q k 1 β l[]+h +j = P k 1 β, 1 S 1, 0 h l[ + 1] l[] 1, 0 j mn( z l[]+h 1,m), (36)
192 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 { Q j β = Q j β k + m, zh j k 2 f h l[], h h +(k m 1 z j) k + m z h j k z 1 f h = l[]. (37) Proof. The deas of the proof follow those of Theorem 2 and we omt them for brevty. We may now gve an algorthm for smultaneously rasng the degree and nsertng new knots, whch follows by analogy wth Algorthm 1. Algorthm 2. Smultaneous degree elevaton and knot nserton for a clamped B-splne curve. The order s beng rased from k to k + m. Use Eq. (19) to compute P j 0,0 j k 1, and P β p,1 p S 1, k z p k 1. Set T by Eq. (32) and set ñ = n + Sm + l =0 y as above. Use Theorem 3 to get Q j 0,0 j k 1, Q j β, k z j k 1, 1 S 1, and l[] Q k 1 1 S 1, β, 0 h l[ + 1] l[] 1, l[]+h +j 0 j mn( z l[]+h 1,m). Use Eqs. (20) and (37) to compute the new control ponts Q 0. Our algorthm s very effcent. For a 2D B-splne curve wth unque knots, we need only 3(k 1) addtons and 2(k 1) multplcatons per nserted knot, whle Böhm s knot nserton algorthm (Goldman and Lyche, 1993) takes 3(k + m 1) addtons and 2(k + m 1) multplcatons. 4. Comparson and dscusson We now gve the results of comparng our new algorthm wth exstng methods. 4.1. Degree elevaton Here we only consder the case of a clamped B-splne curve, as the algorthms proposed by Pegl (Pgel and Tller, 1994) and Prautzsch (Prautzsch and Pper, 1991) cover ths case. Frstly, we counted the number of operatons needed by varous algorthms. Prautzsch s algorthm s faster than Pegl s for rasng the order by one, but Pegl s algorthm s more effcent when rasng the order by an arbtrary degree m. Thus we compared our algorthm wth Prautzsch s n the former case and wth Pegl s n the latter. The followng tables gve the number of operatons requred, assumng all knots are of multplcty one; we consder knots wth hgher multplcty later. Tables 1 and 2 clearly show that for arbtrary n, k, andm, our algorthm takes less arthmetc operatons. Secondly, we expermentally tested and compared our algorthm to the algorthms consdered above. The followng tests were performed: The growth rate as a functon of m usng dfferent startng degrees (k = 2, 3,...).
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 193 Table 1 Rasng the degree by one Operatons Prautzsch s algorthm Our algorthm +, (n k + 1)(10k 8) + k 6(n k + 1)(k 1) + 2k(k 1) (n k + 1)(5k 2) + 2k (n k + 1)(2k 1) + k(k 1)/2 / (n k + 1)(2k 2) (n k + 1)(k 1) + k(k 1)/2 Table 2 Rasng the degree by m Operatons Pgel s algorthm Our algorthm +, ((2m + 1)(k 1) + 2k k)(n k + 1) 2(m + 2)(n k + 1)(k 1) + 2k(k 1) ((m + 1)(k 1) + 3k(k 1)/2)(n k + 1) (n k + 1)(km + (k m)) + k(k 1)/2 / k 2 (n k + 1)/2 (n k + 1)(k 1) + k(k 1)/2 Table 3 Tmes (n seconds) taken to elevate the degree startng at order 3 Elevaton Pgel s algorthm Prautzsch s algorthm Our algorthm 3to4 0.9432 0.7916 0.5338 3to5 0.9432 1.8412 0.689 3to6 1.5162 3.1578 0.8352 3to7 1.8116 4.7107 0.9734 3to8 2.108 6.5777 1.1446 3to9 2.3834 8.6342 1.3 The growth rate as a functon of the startng order k usng dfferent elevatons of order (k goes to k + 1, k goes to k + 2,...). In an attempt to be as far as possble to prevous methods, we used the prevous authors own code gven n (Prautzsch and Pper, 1991) and (Pgel and Tller, 1994). The hardware used was an Intel Pentum IV, 1.4 GHZ computer. We ran each program 10000 tmes, and counted the total tme taken n seconds. Each test curve was a 2D B-splne curve wth 20 randomly chosen control ponts and randomly dstrbuted knots. These tests all led to smlar conclusons; representatve results for order 3 curves are shown n Table 3 and Fg. 2. These tests showed that: Our algorthm s best n terms of absolute tme taken. Prautzsch and Pper s algorthm has the worst growth characterstcs; our algorthm has a slghtly slower growth rate than Pegl and Tller s algorthm. These examples used B-splne curves wth nteror knots of multplcty one. We also nvestgated tmngs n the order 4 case when the nteror knots were all double or trple knots, agan usng a B-splne
194 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 Fg. 2. Tmes taken to elevate the degree startng at order 3. Table 4 Tmes (n seconds) taken to rase the order by 3 startng at varous orders Elevaton Pgel s algorthm Prautzsch s algorthm Our algorthm 2to4 0.8344 1.3525 0.4135 3to5 1.2218 1.8412 0.689 4to6 1.701 2.3516 0.9441 5to7 2.3283 2.9312 1.1355 6to8 2.8171 3.1965 1.3819 7to9 3.381 3.5331 1.564 8to10 4.057 3.8652 1.7143 wth 20 control ponts. Smlar results were agan obtaned, agan showng that our algorthm to be best both n absolute tme taken, and n growth rate, when the splnes have multple knots. Next, we studed the performance of the varous algorthms wth respect to dfferent startng orders, and dfferng amounts of degree elevaton. Agan, as a representatve sample, we llustrate the results obtaned n the order k to order k + 3 case n Table 4 and Fg. 3. The results follow a smlar pattern to the prevous tests, and our algorthm s the clear wnner. The results of our practcal experments valdated our theoretcal comparsons n terms of the number of operatons used. Our new algorthm s clearly more effcent for degree elevaton than ether of the exstng algorthms used as benchmarks. 4.2. Degree elevaton and knot nserton We also expermentally tested and compared our combned degree elevaton and knot nserton algorthm to the use of a separate degree elevaton algorthm followed by a knot nserton algorthm. For the same reasons noted above, we used Prautzsch s degree elevaton algorthm when rasng the degree by one, and Pegl s algorthm when rasng the degree by more than one. We used Böhm s (1980) knot nserton algorthm, beng the fastest. Other test condtons were as descrbed n the prevous Secton.
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 195 Fg. 3. Tmes taken to rase the order by 3 startng at varous orders. Table 5 Tmes (n seconds) taken to rase the order by 1 and nsert varyng numbers of knots Number of knots nserted Separate algorthms Our algorthm 10 0.874 0.5894 30 1.042 0.7106 50 1.203 0.8118 70 1.375 0.9231 90 1.542 1.045 110 1.709 1.153 Fg. 4. Tmes (n seconds) taken to rase the order by 1 and nsert varyng numbers of knots. Two tests were carred out. In the frst, we always started wth an order 3 curve, and rased ts order to 4, whle at the same tme nsertng some number of knots, wth the number beng nserted ncreasng from 10 to 110. Tmes taken are shown n Table 5, and graphed n Fg. 4.
196 Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 In the second test, we started wth an order 4 curve, and rased ts order by varyng amounts to order 5, 6,...,10, whle at the same tme always nsertng 100 knots. In ths case, the relatve advantage of our method ncreased wth the amount of degree elevaton. Overall, our combned algorthm s faster than usng separate algorthms, as expected. 4.3. Handlng roundng errors Real arthmetc on a computer s not performed to perfect accuracy. Normally, the resultng errors (roundng errors) can be gnored because the nose they represent s extremely small compared to the sgnal. However, n certan ll-condtoned cases, the errors can be sgnfcant. Usually, normal floatng pont arthmetc works well for our algorthms, but the results can be unstable when the knots are dstrbuted n an extremely non-unform manner, e.g., f (u +1 u )/(u u 1 )< 10 7 for some. In ths case, a modfcaton to our new method may be used. We nsert u +1 and u, k z +1 and k z tmes respectvely, usng Böhm s approach (Böhm, 1980), so that the curve s segmented nto three separate B-splne curves. Degree elevaton can then be performed for each curve usng our algorthm, and then Eck s method (Eck and Hadenfeld, 1995) can be used to remove the knots u and u +1, k z and k z+1 tmes respectvely, to obtan the overall B-splne curve after degree elevaton. Stablty s acheved by dvdng the B-splne curve nto segments such the that knots are relatvely unformly dstrbuted wthn each segment. Note that ths process only takes O(k 2 ) tme for each knot nterval [u,u +1 ], whch has to be processed n ths way. If we do ths procedure for every knot, we obtan Pegl and Tller s algorthm. 5. Concluson In ths paper, we have gven an effcent algorthm to elevate the degree of a B-splne curve, and we have also shown how the process can be combned wth a complementary algorthm workng on smlar prncples for knot nserton, to gve an effcent algorthm whch can do degree elevaton and knot nserton smultaneously. These methods are computatonally superor to exstng approaches. The new method presented n ths paper can clearly also be extended to the case of degree reducton. Acknowledgement The work was supported by the Natural Scence Foundaton of Chna (Project Number 60225016, 60273012, 60321002) and the Natonal Basc Research Project of Chna (Project Number 2002CB312101). References Böhm, W., 1980. Insertng new knots nto B-splne curves. Computer Aded Desgn 12 (4), 199 201. Cohen, E., Lyche, T., Resenfeld, R.F., 1980. Dscrete B-splne subdvson technques n computer aded geometrc desgn and computer graphcs. Computer Graphcs and Image Processng 14 (2), 87 111.
Q.-X. Huang et al. / Computer Aded Geometrc Desgn 22 (2005) 183 197 197 Cohen, E., Lyche, T., Schumaker, L., 1985. Algorthms for degree rasng of splnes. ACM Trans. Graph. 4 (3), 171 181. Eck, M., Hadenfeld, J., 1995. Knot removal for B-splne curves. Computer Aded Geometrc Desgn 12 (3), 259 282. Goldman, R.N., Lyche, T., 1993. Knot Inserton Deleton Algorthms for B-Splne Curves and Surfaces. Socety for Industral and Appled Mathematcs. Ferrar, L.A., Sankar, P.V., Slbermann, M.J., 1994. Effcent algorthms for the mplementatons of general B-splnes. Computer Vson, Graphcs and Image Processng 56 (1), 102 105. Lu, W., Wayne, 1997. A smple, effcent degree rasng algorthm for B-splne curves. Computer Aded Geometrc Desgn 14 (7), 693 698. Prautzsch, H., 1984. Degree elevaton of B-splne curves. Computer Aded Geometrc Desgn 18 (12), 193 198. Prautzsch, H., Pper, B., 1991. A fast algorthm to rase the degree of B-splne curves. Computer Aded Geometrc Desgn 8 (4), 253 266. Pgel, L., Tller, W., 1994. Software-engneerng approach to degree elevaton of B-splne curves. Computer-Aded Desgn 26 (1), 17 28. Pegl, L., Tller, W., 1997. The NURBS Book, second ed. Sprnger-Verlag. Sankar, P.V., Slbermann, M.J., Ferrar, L.A., 1994. Curve and surface generaton and refnement based on a hgh speed dervatve algorthm. Computer Vson, Graphcs and Image Processng 56 (1), 94 101. Ta, C.-L., Hu, S.-M., Huang, Q.-X., 2003. Approxmate mergng of B-splne curves va knot adjustment and constraned optmzaton. Computer-Aded Desgn 35 (10), 893 899. Wang, S.Y., Ferrar, L., Slbermann, M.J., 1996. Hgh speed computaton of splne functons and applcatons. Internat. J. Imag. Syst. Technol. 7, 1 15.