World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:13, No:8, 2019

Fast and Efficient Algorithms for Evaluating Uniform and Nonuniform Lagrange and Curves Taweechai Nuntawisuttiwong, Natasha Dejdumrong

Abstract—Newton-Lagrange Interpolations are widely used in quadratic computation time, which is slower than the others. . However, it requires a quadratic computational However, there are some curves in CAGD, Wang-Ball, DP time for their constructions. In computer aided geometric design and Dejdumrong curves with linear complexity. In order to (CAGD), there are some curves: Wang-Ball, DP and Dejdumrong curves, which have linear time complexity algorithms. reduce their computational time, Bezier´ curve is converted Thus, the computational time for Newton-Lagrange Interpolations into any of Wang-Ball, DP and Dejdumrong curves. Hence, can be reduced by applying the algorithms of Wang-Ball, DP and the computational time for Newton-Lagrange interpolations Dejdumrong curves. In order to use Wang-Ball, DP and Dejdumrong can be reduced by converting them into Wang-Ball, DP and algorithms, first, it is necessary to convert Newton-Lagrange Dejdumrong algorithms. Thus, it is necessary to investigate into Wang-Ball, DP or Dejdumrong polynomials. In this work, the algorithms for converting from both uniform and the conversion from Newton-Lagrange interpolation into non-uniform Newton-Lagrange polynomials into Wang-Ball, DP and the curves with linear complexity, Wang-Ball, DP and Dejdumrong polynomials are investigated. Thus, the computational Dejdumrong curves. An application of this work is to modify time for representing Newton-Lagrange polynomials can be reduced sketched image in CAD application with the computational into linear complexity. In addition, the other utilizations of using time reduction for plotting Newton-Lagrange curves. CAGD curves to modify the Newton-Lagrange curves can be taken. Keywords—Newton interpolation, Lagrange interpolation, linear II. NEWTON &LAGRANGE POLYNOMIALS complexity. Although Newton and Lagrange polynomials are different representations, their simple forms are the same polynomials. I. INTRODUCTION Newton applies Divided Difference method to represent its HERE are many interpolation methods used in numerical polynomial while Lagrange uses simpler formula. At the T analysis. The popular one is Newton’s divided-difference beginning, it is important to introduce both methods. Newton interpolating polynomial. The Newton’s method was given by and Lagrange polynomials can be shown as follows: written in Lemma 5 of Book III of his Principia Mathematica of 1687 [1] but it was known to him before from the letter he wrote to Oldenburg [2]. The simple forms A. Newton Polynomial of Newton interpolating polynomials, Lagrange interpolations, Let N (t) be the Newton polynomial of control points, n n were published by Joseph-Louis Lagrange under his name. {bi}i=0, and the weight, {ti}i=0, then However, the same formula had been produced by Waring n i sixteen years earlier. N (t)= f[ti,ti−1, .., t0] (t − tj),t[t0,tn] (1) Newton-Lagrange interpolations can be beneficial to i=0 j=0 estimate intermediate data between precise data points or to predict the future data. In addition, Newton-Lagrange where f[t ,t , .., t ] − f[t ,t , .., t ] interpolations can be used to vectorize a raster-image into a f[t ,t , .., t ]= i i−1 k+1 i−1 i−2 k , 2 i i−1 k vector image. However, a quadratic computational time, O(n ), ti − tk must be taken to construct a Newton-Lagrange interpolation. (2) In computer aided geometric design (CAGD), there are and

Open Science Index, Computer and Information Engineering Vol:13, No:8, 2019 waset.org/Publication/10010689 f[t ]= . many polynomial curves, e.g. Bezier´ [3], Said-Ball [4], i bi (3) Wang-Ball [5], DP [6], NB1 [7], [8] and Dejdumrong [9] curves. The difference between Newton-Lagrange and CAGD B. curves is the utilization of CAGD curves that is for CAD/CAM Let L(t) be the Lagrange polynomial of control points, modeling. In CAGD curves, Bezier´ curves are widely used n n {vi}i=0, and the weight, {ti}i=0, then in CAD software because they are better in shape preserving n n and possess simple forms. Unfortunately, Bezier´ curve has a t − tj L(t)= vi ,t[t0,tn]. (4) ti − tj T. Nuntawisuttiwong and N. Dejdumrong are with the Department i=0 j=0,j=i of Computer Engineering, King Mongkut’s University of Technology Thonburi, Bangkok, Thailand (e-mail: [email protected], In CAGD curves, there exists the power basis form [email protected]). for representing curves. In this work, the power basis

International Scholarly and Scientific Research & Innovation 13(8) 2019 448 ISNI:0000000091950263 World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:13, No:8, 2019

representations for Newton and Lagrange polynomial are O(n). Thus, the computational time can also be reduced by investigated. Thus, Newton and Lagrange polynomial can be using the conversion from Newton-Lagrange polynomials into computed by the following definition. Wang-Ball, DP or Dejdumrong curves. Definition 1. Newton-Lagrange Power Basis: Let N (t) and L(t) be Newton and Lagrange polynomial with their control n III. CONVERSION FROM UNIFORM NEWTON-LAGRANGE points, {bi}i=0. Newton and Lagrange polynomial can be POLYNOMIALS INTO CAGD CURVE represented by using power basis as follows: n n i A. Conversion from Uniform Newton-Lagrange Curve into N (t)=L(t)= bi · fi,j · t , (5) Wang-Ball Curve i=0 j=0 n Wang-Ball control points, {pi}i=0, can be obtained from where fi,j is Newton-Lagrange power basis defined by n Newton control points, {bi}i=0, and Lagrange control points, n n Fi,n−j(0) {vi}i=0, as follows: fi,j = n (6) t − t i=0,i=j j i −1 p0 p1 ··· pn = b0 b1 ··· bn · A and ⎧ (12) ⎨ 1 , for j =0, and n Fi,n−j(u)=  ⎩ n−j+1 n ··· = ··· · −1 k=u,k=i Fi,j−1(k +1)tk , for j>0. p0 p1 pn v0 v1 vn A (13) (7) where Definition 2. Newton-Lagrange Monomial Matrices: Newton ⎡ ⎤ a0,0 a0,1 ... a0,n and Lagrange polynomials can be represented by using ⎢ ⎥ ⎢ a1,0 a1,1 ... a1,n ⎥ monomial matrix forms as follows: A = ⎢ ⎥ (14) ⎡ ⎤ ⎣ . . .. . ⎦ 1 . . . . ⎢ ⎥ an,0 an,1 ... an,n ⎢ t ⎥ N (t)=L(t)= b0 b1 ··· bn · M · ⎢ . ⎥ (8) ⎣ . ⎦ and tn ⎧ (2t )i(1 − t )i+2 , for 0 ≤ i ≤ n − 1 ⎪ j j 2 where M is Newton-Lagrange monomial matrix defined as ⎪ ⎪ follows: ⎡ ⎤ ⎪ (2t )i(1 − t )n−i , for i = n ⎨⎪ j j 2 f0,0 f0,1 ... f0,n ⎢ ⎥ n (t)= f1,0 f1,1 ... f1,n ai,j n−i i n ⎢ ⎥ ⎪ (2(1 − tj )) (tj ) , for i = 2 M = ⎢ . . . ⎥ . (9) ⎪ ⎣ . . .. . ⎦ ⎪ . . . . ⎪ n n ⎪ a (1 − tj) , for +1≤ i ≤ n fn,0 fn,1 ... fn,n ⎩ n−i,j 2 The matrix inverse of Newton-Lagrange monomial matrix (15) can be expressed as follows: ⎡ ⎤−1 f0,0 f0,1 ... f0,n ⎢ ⎥ B. Conversion from Uniform Newton-Lagrange Curve into ⎢ f1,0 f1,1 ... f1,n ⎥ M−1 = ⎢ ⎥ DP Curve ⎣ . . .. . ⎦ . . . . n DP control points, {qi}i=0, can be obtained from Newton fn,0 fn,1 ... fn,n n n {bi} {vi} (10) control points, i=0, and Lagrange control points, i=0, ⎡ ⎤ as follows: g0,0 g0,1 ... g0,n ⎢ ⎥ ⎢ g1,0 g1,1 ... g1,n ⎥ −1 = ⎢ ⎥ , q0 q1 ··· qn = b0 b1 ··· bn ·C (16) Open Science Index, Computer and Information Engineering Vol:13, No:8, 2019 waset.org/Publication/10010689 . . . . ⎣ . . .. . ⎦ gn,0 gn,1 ... gn,n and

where ⎧ −1 ⎨ 1 , for i =0, q0 q1 ··· qn = v0 v1 ··· vn ·C (17) gi,j = (11) ⎩ i tj , for i>0. where ⎡ ⎤ c0,0 c0,1 ... c0,n Newton and Lagrange polynomial are very useful for ⎢ ⎥ c1,0 c1,1 ... c1,n . However, they take a lot of ⎢ ⎥ C = ⎢ . . . . ⎥ (18) computational time, O(n2). In CAGD curves, Wang-Ball, DP ⎣ . . .. . ⎦ and Dejdumrong curves consume linear computational time, cn,0 cn,1 ... cn,n

International Scholarly and Scientific Research & Innovation 13(8) 2019 449 ISNI:0000000091950263 World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:13, No:8, 2019

and IV. CONVERSION FROM NONUNIFORM ⎧ n−i n NEWTON-LAGRANGE INTO CAGD CURVES ⎪ (−1) (1 − tj) , for i =0 ⎪ ⎪ A. Conversion from Nonuniform Newton-Lagrange curve ⎪ (−1)n−i(1 − t )n−it , for 0

International Scholarly and Scientific Research & Innovation 13(8) 2019 450 ISNI:0000000091950263 World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:13, No:8, 2019

and V. FAST &EFFICIENT ALGORITHMS ⎧ n−i n ⎪ (−1) β , for i =0 An efficient algorithm used to plot uniform and nonuniform ⎪ ⎪ Newton-Lagrange with linear complexity can be defined by ⎪ (−1)n−iβn−iα,for 0

−1 computational time for the calculation of Newton-Lagrange d0 d1 ··· dn = v0 v1 ··· vn ·D (35) curve can be reduced from quadratic into linear computational complexity. Even though the conversion algorithm is cubic where ⎡ ⎤ d0,0 d0,1 ... d0,n computation, but it will be computed only once. An example ⎢ ⎥ of using our new proposed techniques is when we want ⎢ d1,0 d1,1 ... d1,n ⎥ D = ⎢ ⎥ (36) to convert a sketched image that can be recognized by ⎣ . . .. . ⎦ . . . . using Newton-Lagrange either uniform and non-uniform dn,0 dn,1 ... dn,n polynomials. and ⎧ i+1 i i+3 APPENDIX A ⎪ (−1) 3 β , for i =0 ⎪ PROOF FOR THE CONVERSION FROM UNIFORM ⎪ NEWTON-LAGRANGE INTO WANG-BALL POLYNOMIALS ⎪ (−1)i+13iβi+3αi , for 0

International Scholarly and Scientific Research & Innovation 13(8) 2019 451 ISNI:0000000091950263 World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:13, No:8, 2019

n {pi}i=0, can be represented using monomial matrix form as it is obvious that follows: n (t)=A· −1 ⎡ ⎤ ai,j M ⎧ i i+2 n 1 ⎪ (2tj) (1 − tj ) , for 0 ≤ i ≤ 2 − 1 ⎢ ⎥ ⎪ ⎢ t ⎥ ⎪ A(t)= ··· ·A·⎢ ⎥ , ⎪ i n−i n p0 p1 pn . (39) ⎪ (2tj) (1 − tj ) , for i = ⎣ . ⎦ ⎨ 2 n t = n−i i n ⎪ (2(1 − tj )) (tj) , for i = 2 ⎪ where A is Wang-Ball monomial matrix. ⎪ ⎪ n (1 − t ) , for n +1≤ i ≤ n Proof ⎩⎪ an−i,j j 2 The proof is started by equating N (t), L(t) and A(t), then ⎡ ⎤ (47) 1 ⎢ t ⎥ ⎢ ⎥ REFERENCES b0 b1 ··· bn · M · ⎢ ⎥ = ⎣ . ⎦ . [1] I. Newton, Philosophiae Naturalis Principia Mathematica. London, n 1687. ⎡t ⎤ 1 (40) [2] I. Newton, Letter to Oldenburg (24 october 1676). in The ⎢ ⎥ Correspondence of Isaac Newton, vol. 2, pp.110-161, 1960. ⎢ t ⎥ [3] G. Farin, Curves and Surfaces for Computer Aided Geometric Design, p0 p1 ··· pn ·A·⎢ . ⎥ . 5th ed. Academic Press, Morgan Kaufman Publishers, San Francisco, ⎣ . ⎦ 2002. tn [4] H. B. Said, Generalized Ball Curve and Its Recursive Algorithm. ACM Transactions on Graphics, vol. 8, pp. 360-371, 1989. Simplifying equation 40, we get [5] G. J. Wang, Ball Curve of High Degree and Its Geometric Properties. Appl. Math.: A Journal of Chinese Universities, vol. 2, pp. 126-140, 1987. ··· · = ··· ·A. [6] J. Delgado and J. M. Pena,˜ A Shape Preserving Representation with an b0 b1 bn M p0 p1 pn Evaluation Algorithm of Linear Complexity. Computer Aided Geometric (41) Design, vol. 20(1), pp. 1-20, 2008. Finally we obtain, [7] W. Hongyi, Unifying Representation of Bezier´ Curve And Genaralized Ball Curves. Appl. Math. J. Chinese Univ. Ser. B, vol. 5(1), pp. 109-121, −1 2000. b0 b1 ··· bn = p0 p1 ··· pn ·A·M . [8] Y. Dan and C. Xinmeng, Another Type Of Generalized Ball Curves And (42) Surfaces. Acta Mathematica Scientia, vol. 27B(4), pp. 897-907, 2007. −1 Thus, it needs to investigate the formula for A·M . [9] N. Dejdumrong, Efficient Algorithms for Non-rational and Rational From Wang-Ball curve, Bezier´ Curves. Fifth International Conference on Computer Graphics, ⎡ ⎤ Imaging and Visualisation, 2008. 1 n ⎢ t ⎥ n ⎢ ⎥ A(t)= ·pi ·A (t)= p0 p1 ··· pn ·A·⎢ ⎥ . i ⎣ . ⎦ i=0 . tn (43)

Consider that ⎡ ⎤ 1 ⎢ t ⎥ n ⎢ ⎥ Ai (t)=A·⎢ . ⎥ , (44) ⎣ . ⎦ tn

n and Ai (t) is already defined as follows: ⎧ n ⎪ (2t)i(1 − t)i+2 , for 0 ≤ i ≤ − 1, ⎪ 2 ⎪ ⎪ i n−i n ⎨ (2t) (1 − t) , if i = 2 , n Open Science Index, Computer and Information Engineering Vol:13, No:8, 2019 waset.org/Publication/10010689 A (t)= i ⎪ ⎪ (2(1 − t))n−iti , if i = n , ⎪ 2 ⎪ ⎩⎪ n n An−i(1 − t) , for 2 +1≤ i ≤ n. (45) Since ⎡ ⎤ 11... 1 ⎢ ⎥ ⎢ t0 t1 ... tn ⎥ −1 ⎢ t2 t2 ... t2 ⎥ A·M = A·⎢ 0 1 n ⎥ , (46) ⎢ . . . . ⎥ ⎣ . . .. . ⎦ n n n t0 t1 ... tn

International Scholarly and Scientific Research & Innovation 13(8) 2019 452 ISNI:0000000091950263