From Spiral to Spline: Optimal Techniques in Interactive Curve Design
Total Page:16
File Type:pdf, Size:1020Kb
From Spiral to Spline: Optimal Techniques in Interactive Curve Design Raphael Linus Levien Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2009-162 http://www.eecs.berkeley.edu/Pubs/TechRpts/2009/EECS-2009-162.html December 3, 2009 Copyright © 2009, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission. From Spiral to Spline: Optimal Techniques in Interactive Curve Design by Raphael Linus Levien A dissertation submitted in partial satisfaction of the requirements for the degree of Doctor of Philosophy in Engineering–Electrical Engineering and Computer Sciences in the GRADUATE DIVISION of the UNIVERSITY OF CALIFORNIA, BERKELEY Committee in charge: Professor Carlo S´equin, Chair Professor Jonathan Shewchuk Professor Jasper Rine Fall 2009 From Spiral to Spline: Optimal Techniques in Interactive Curve Design Copyright © 2009 by Raphael Linus Levien Abstract From Spiral to Spline: Optimal Techniques in Interactive Curve Design by Raphael Linus Levien Doctor of Philosophy in Engineering–Electrical Engineering and Computer Sciences University of California, Berkeley Professor Carlo S´equin, Chair A basic technique for designing curved shapes in the plane is interpolating splines. The designer inputs a sequence of control points, and the computer fits a smooth curve that goes through these points. The literature of interpolating splines is rich, much of it based on the mathematical idealization of a thin elastic strip constrained to pass through the points. Until now there is little consensus on which, if any, of these splines is ideal. This thesis explores the properties of an ideal interpolating spline. The most important property is fairness, a property often in tension with locality, meaning that perturbations to the input points do not affect sections of the curve at a distance. The idealized elastic strip has two serious problems. A sequence of co-circular input points results in a curve deviating from a circular arc. For some other inputs, no solution (with finite extent) exists at all. The idealized elastic strip has two properties worth preserving. First, any ideal spline must be extensional, meaning that the insertion of a new point on the curve shouldn’t change its shape. Second, curve segments between any two adjacent control points are drawn from a two-parameter family (and this propety is closely related to good locality properties). A central result of this thesis is that any spline sharing these properties also has the property that all segments between two control points are cut from a single, fixed generating curve. Thus, the problem of choosing an ideal spline is reduced to that of choosing the ideal generating curve. The Euler spiral has excellent all-around properties, and, for some applications, a log-aesthetic curve may be even better. Shapes in applications such as font outlines contain extra features such as corners and transi- tions between straight lines and smooth curves. Attaching additional constraints to control points expresses these features, and, carefully applied, give the designer a richer palette of curve types. The splines presented in this thesis are entirely practical as well, especially for designing fonts. Sophisticated new numerical techniques compute the splines at interactive speeds, as well as convert to optimized cubic B´ezier representation. Professor Carlo S´equin Dissertation Committee Chair 1 To my father. i Contents Contents ii List of Figures vii List of Tables xi Acknowledgements xii 1 Introduction 1 2 Properties of splines 6 2.1 Fairness . 6 2.1.1 Empirical testing of fairness . 7 2.2 Continuity . 8 2.3 Roundness . 9 2.4 Extensionality . 10 2.5 Existence and uniqueness . 11 2.6 Locality . 13 2.7 Transformational invariance . 13 2.8 Counting parameters . 14 2.9 Monotone curvature . 14 2.10 Summary . 15 3 The Elastica 16 3.1 Statement of the elastica problem . 17 3.2 Variational study . 17 3.2.1 The Euler–Lagrange equation . 17 3.2.2 Application of the Euler–Lagrange equation to the elastica . 18 ii 3.3 A family of solutions . 19 3.4 Equilibrium of moments . 21 3.5 Pendulum analogy . 23 3.6 Equilibrium of forces: Finite element approach . 25 3.7 Solutions with length and endpoint constraints . 29 3.8 Elastica with general constraints . 29 3.9 Angle constraints . 32 3.10 Elastica as an interpolating spline . 35 3.11 SI-MEC . 35 3.12 Real splines . 39 4 Two-parameter splines 42 4.1 Extensional two-parameter splines have a generating curve . 43 4.2 Properties of the MEC spline . 45 4.3 SI-MEC . 46 4.4 Cubic Lagrange (with length parametrization) . 47 4.5 Ikarus (biarc) . 47 4.6 Euler’s spiral . 48 4.6.1 Euler’s spiral as a spline primitive . 51 4.6.2 Variational formulation of Euler’s spiral . 51 4.6.3 Euler spiral spline in use . 52 4.6.4 Existence and uniqueness of Euler spiral spline . 53 4.7 Hobby’s spline . 57 4.8 Splines from fixed generating curves . 60 4.8.1 Log-aesthetic curve splines . 61 4.9 Piecewise SI-MEC splines, or Kurgla 1 . 63 4.10 Circle splines . 64 4.11 Summary . 65 5 History of the elastica 67 5.1 Jordanus de Nemore – 13th century . 68 5.2 Galileo sets the stage – 1638 . 68 5.3 Hooke’s law of the spring – 1678 . 69 5.4 James Bernoulli poses the elastica problem – 1691 . 70 iii 5.5 James Bernoulli partially solves it – 1692 . 71 5.6 James Bernoulli publishes the first solution – 1694 . 73 5.7 Daniel Bernoulli proposes variational techniques – 1742 . 77 5.8 Euler’s analysis – 1744 . 78 5.8.1 Moments . 83 5.9 Elliptic integrals . 85 5.10 Laplace on the capillary – 1807 . 86 5.11 Kirchhoff’s kinetic analogy – 1859 . 87 5.12 Closed form solution: Jacobi elliptic functions – 1880 . 89 5.12.1 Inflectional solutions . 90 5.12.2 Non-inflectional solutions . 91 5.13 Max Born – 1906 . 91 5.14 Influence on modern spline theory – 1946 to 1965 . 92 5.15 Numerical techniques – 1958 through today . 93 6 History of the Euler spiral 95 6.1 James Bernoulli poses a problem of elasticity – 1694 . 95 6.2 Euler characterizes the curve – 1744 . 98 6.3 Euler finds the limits – 1781 . 100 6.4 Relation to the elastica . 101 6.5 Fresnel on diffraction problems – 1818 . 103 6.6 Talbot’s railway transition spiral – 1890 . 106 6.7 Mathematical properties . 107 6.8 Use as an interpolating spline . 108 6.9 Efficient computation . 109 7 Four-parameter curves 110 7.1 Why four parameters? . 110 7.2 Minimum Variation Curve . 114 7.2.1 Euler–Poisson equation . 114 7.2.2 Euler–Poisson solution of MVC . 115 7.3 Polynomial spiral spline . 117 7.4 Generalized constraints . 119 iv 8 Numerical toolbox 122 8.1 Numerical integration of polynomial spirals . 123 8.1.1 Polynomial approximation of the integral . 124 8.1.2 Higher-order polynomial approximations . 125 8.1.3 Hybrid approach . 126 8.2 Determining Euler spiral parameters . 127 8.3 Global constraint solver . 129 8.3.1 Two-parameter solver . 130 8.3.2 Four-parameter solver . ..