Bauerj 2018 Final.Pdf (827.5Kb)
Total Page:16
File Type:pdf, Size:1020Kb
More than one way to skin a cat: Interpolation techniques in one-dimension Jesica Bauer May 1, 2018 Abstract In this paper, we discuss and develop several one-dimensional interpolation techniques. Interpolation is a process for generating functions that pass through specified points in space. In general, given a set of points P = f(x0; y0); (x1; y1);:::; (xn; yn)g, interpolation provides a function f(x) such that f(xi) = yi for i = 0; : : : ; n. We start by discussing common techniques used for interpolation, including polynomial, piecewise linear, cubic splines, and B´eziercurves. We also develop two new interpolation techniques: one based on a refinement of quadratic interpolation and the other based on bending properties of physical materials. We examine quantitative and qualitative errors between the existing methods and our new techniques. Finally, we discuss how the new techniques could be generalized and extended into higher dimensions. 1 Contents 1 Introduction 3 2 1-Dimensional Interpolation4 2.1 Polynomial Interpolation................................4 2.2 Piecewise Linear Interpolation.............................7 2.3 Cubic Splines......................................8 2.4 B´ezierCurves...................................... 11 3 New Techniques 13 3.1 Quadrubics....................................... 13 3.2 Bending Beam..................................... 17 4 Method Comparisons and Error Analysis 21 4.1 The Carroll Cat..................................... 21 4.2 Sine Interpolations................................... 21 4.3 Method Comparisons.................................. 21 5 Future Work 22 5.1 2-Dimensional Interpolation.............................. 23 6 Conclusion 24 2 Figure 1: An example of skinning a point cloud of a rabbit. Left to right: original point cloud, control mesh, and interpolation result [1]. 1 Introduction Modern computers are able to create complex imagery with only a small set of information. For example, the fonts on your computer are saved as a set of points and the computer is told how to connect them. Many 3D animations are generated the same way, where the animation starts as a collection of points before the rest of the shape is systematically filled in. The challenge is to take a handful of points and turn them into something that doesn't look like it was drawn from the points. The general idea of interpolation is, given a finite set of points f(x0; y0); (x1; y1);:::; (xn; yn)g, find a function f such that f(xi) = yi for all i = 0; 1; : : : ; n. An interpolation technique can force the function to follow other constraints, such as continuity or restrictions on the derivatives. The restrictions that we force on the system alter how the final interpolation behaves. In this paper, we will discuss several interpolation techniques which provide mathematical functions that describe how an arbitrary set of points in 2-dimensions are to be connected. While we can do these calculations by hand, this paper focuses on derivations of techniques and their computer implementations. We discuss polynomial and piecewise polynomial interpolation, as well as the method of B´eziercurves. We also create two novel approaches to interpolation. One method, the \quadrubic", is a two-stage hybrid model that uses elements of both quadratic and cubic splines. Our other method is based upon the physical construction of cubic splines, utilizing the beam bending problem commonly studied in statics. 3 Figure 2: The original hand-drawn Carroll Cat. 2 1-Dimensional Interpolation The simplest setting for interpolation is one-dimension. The dimension of the interpolation is usually associated with the domain of the interpolating function. Single dimensional interpola- tion is how we determine how to connect a series of ordered-pairs to create a curve. Depending on the restrictions, we could end up with a single high-degree polynomial, a \connect-the-dots" method, or a collection of smooth curves that go through all of the points. In this section, we discuss four common methods of interpolation: polynomial, piecewise linear, cubic splines, and B´eziercurves. We describe how to generate the curves and how they perform against each other to re-create two test functions: a sine curve and the top-half of a cat (the Carroll Cat) shown in Figure2. 2.1 Polynomial Interpolation Given a finite list of points, P = f(x1; y1); (x2; y2);:::; (xn; yn)g, there are several common techniques for generating a interpolating polynomial. For this paper, we discuss the Lagrange and Newton form of the interpolation polynomial to give the reader some insight on how the interpolation process works. Q x−xj The Lagrange form of the interpolation polynomial utilizes weights 'i(x) = . j6=i xi−xj Notice that 'i(xi) = 1 and 'i(xj) = 0 when i 6= j, ensuring that polynomial p interpolates every point. That is, p(xi) = yi for every (xi; yi) 2 P . Then the Lagrange form of the interpolation polynomial is expressed as n n 0 1 X X Y x − xj p(x) = yi'(x) = yi @ A (1) xi − xj i=0 i=0 j6=i where (xi; yi) 2 P . 4 Example 2.1. Consider P = f(1; 2); (2; 3)g. Then the Lagrange interpolation polynomial is (x − 2) (x − 1) p(x) = 2 · + 3 · = x + 1: (1 − 2) (2 − 1) However, if we wanted to add another point (e.g. (3; 6)), then we have to recreate the interpolation polynomial from scratch. For the set P = f(1; 2); (2; 3); (3; 6)g, the polynomial would be (x − 2)(x − 3) (x − 1)(x − 3) (x − 1)(x − 2) p(x) = 2 · + 3 · + 6 · = x2 − 2x + 3: (1 − 2)(1 − 3) (2 − 1)(2 − 3) (3 − 1)(3 − 2) Having to re-create the interpolation polynomial from scratch each time isn't ideal if we're creating the polynomials by hand. Enter the Newton polynomial. The Newton form of the interpolation polynomial takes the form of n−1 Y p(x) = a0 + a1(x − x0) + a2(x − x0)(x − x1) + ::: + an (x − xj) (2) j=0 where a0, a1, ..., an are chosen so that p(xi) = yi; i = 0; :::; n [2]. Unlike the Lagrange form, the Newton form easily allows the introduction of new ordered-pairs to the interpolation. To find an, we just apply the condition p(xi) = yi to each point [2]. That is p(x0) =a0 = y0; y1 − a0 p(x1) =a0 + a1(x1 − x0) = y1 ) a1 = ; x1 − x0 p(x2) =a0 + a1(x2 − x0) + a2(x2 − x0)(x2 − x1) = y2 ) y2 − a0 − a1(x2 − x0) a2 = ; (x2 − x0)(x2 − x1) . n−1 Y p(xn) =a0 + a1(xn − x0) + a2(xn − x0)(xn − x1) + ::: + an (xn − xj) j=0 This system can be written as a lower triangular linear system for a0; : : : ; an [2]: 5 2 3 2 3 2 3 1 a0 y0 6 7 6 7 6 7 6 7 6 7 6 7 61 x − x 7 6a 7 6y 7 6 1 0 7 6 1 7 6 1 7 6 7 6 7 6 7 6 7 6 7 6 7 61 x2 − x0 (x2 − x0)(x2 − x1) 7 6a2 7 = 6y2 7 : (3) 6 7 6 7 6 7 6. 7 6 . 7 6 . 7 6. .. 7 6 . 7 6 . 7 6 7 6 7 6 7 4 Qn−1 5 4 5 4 5 1 xn − x0 (xn − x0)(xn − x1) ::: j=0 (xn − xj) an yn Example 2.2. Consider P = f(1; 2); (2; 3)g. Then we would write the Newton form of the interpolation polynomial as p(x) = a0 + a1(x − 1): By solving the lower matrix from Equation3, we get a0 = 2 and a1 = 1. So, our final interpolation is p(x) = 2 + 1(x − 1) = x + 1 which is the same as the Lagrange interpolation polynomial. However, if we want to add the third point (3; 6), then we simply add onto the polynomial p(x) = a0 + a1(x − 1) + a2(x − 1)(x − 2) and we can easily find a2 = 1, which gives p(x) = 2 + 1(x − 1) + 1(x − 1)(x − 2) = x2 − 2x + 3: As shown in Example 2.1 and 2.2, these techniques give rise to the same interpolation poly- nomial. In fact, we can guarantee that any method we use to generate a minimal degree inter- polating polynomial will be identical. Theorem 1. The interpolation polynomial of minimal order that passes through n distinct points is unique. Proof. Let P = f(x1; y1); (x2; y2);:::; (xn; yn)g and let p1(x) and p2(x) both interpolate P (that is, p1(xi) = p2(xi) = yi for i = 1; : : : ; n). Let f(x) = p1(x) − p2(x). Since p1(x) and p2(x) have order at most n − 1, then f has order at most n − 1. (Because we know the Newton form of interpolation polynomial has order at most n − 1, then the minimal order of the polynomial cannot exceed n − 1.) 6 Figure 3: In blue, the interpolation polynomial of the Carroll Cat, with a piecewise linear interpolation shown in red for reference. The polynomial interpolation is not ideal for re-creating the Carroll Cat, while the piecewise linear appears to be more appropriate. Since p1(x) and p2(x) interpolate P , then p1(xi) = yi and p2(xi) = yi for each i. Then f(xi) = 0 for all xi: So, f(x) has n distinct real roots, which means that f(x) ≡ 0 by the Fundamental Theorem of Algebra. Then, p1(x) − p2(x) = 0 for all x. Therefore, p1(x) = p2(x) and the interpolation polynomial is unique. Since our interpolation polynomial is unique, we can then use Newton or Lagrange to generate an interpolation polynomial for the Carroll Cat from Figure2. Figure3 shows what this form of interpolation would generate. The figure demonstrates that we do not maintain any of the structure of the Carroll Cat.