Computational Geometry Lecture Notes HS 2013
Total Page:16
File Type:pdf, Size:1020Kb
Computational Geometry Lecture Notes HS 2013 Bernd Gärtner <[email protected]> Michael Hoffmann <[email protected]> Friday 10th January, 2014 Preface These lecture notes are designed to accompany a course on “Computational Geometry” that we teach at the Department of Computer Science, ETH Zürich, in every winter term since 2005. The course has evolved over the years and so have the notes, a first version of which was published in 2008. In the current setting, the course runs over 14 weeks, with three hours of lecture and two hours of exercises each week. In addition, there are three sets of graded homeworks which students have to hand in spread over the course. The target audience are third-year Bachelor or Master students of Mathematics or Computer Science. The selection of topics and their treatment is somewhat subjective, beyond what we consider essentials driven by the (diverse) research interests within our working group. There is a certain slant towards algorithms rather than data structures and a fair amount of influx from combinatorial geometry. The focus is on low-dimensional Euclidean space (mostly 2D), although we sometimes discuss possible extensions and/or remarkable differences when going to higher dimensions. At the end of each chapter there is a list of questions that we expect our students to be able to answer in the oral exam. Most parts of these notes have gone through a number of proof-readings, but expe- rience tells that there are always a few mistakes that escape detection. So in case you notice some problem, please let us know, regardless of whether it is a minor typo or punctuation error, a glitch in formulation, or a hole in an argument. This way the issue can be fixed for the next edition and future readers profit from your findings. We thank Tobias Christ, Anna Gundert, Gabriel Nivasch, Júlia Pap, Marek Sulovský, May Szedlák, and Hemant Tyagi for pointing out errors in preceding versions. Bernd Gärtner and Michael Hoffmann Institute of Theoretical Computer Science ETH Zürich Universitätstrasse 6 CH-8092 Zürich Switzerland E-mail address: {gaertner,hoffmann}@inf.ethz.ch 3 Contents 1 Fundamentals 9 1.1 Models of Computation . .9 1.2 Basic Geometric Objects . 11 2 Polygons 13 2.1 Classes of Polygons . 13 2.2 Polygon Triangulation . 16 2.3 The Art Gallery Problem . 20 3 Convex Hull 25 3.1 Convexity . 26 3.2 Classical Theorems for Convex Sets . 28 3.3 Planar Convex Hull . 30 3.4 Trivial algorithms . 32 3.5 Jarvis’ Wrap . 33 3.6 Graham Scan (Successive Local Repair) . 35 3.7 Lower Bound . 36 3.8 Chan’s Algorithm . 37 4 Plane Graphs and the DCEL 41 4.1 The Euler Formula . 42 4.2 The Doubly-Connected Edge List . 43 4.2.1 Manipulating a DCEL . 44 4.2.2 Graphs with Unbounded Edges . 47 4.2.3 Remarks . 48 5 Line Sweep 51 5.1 Interval Intersections . 52 5.2 Segment Intersections . 52 5.3 Improvements . 56 5.4 Algebraic degree of geometric primitives . 56 5.5 Red-Blue Intersections . 59 5 Contents CG 2013 6 Delaunay Triangulations 65 6.1 The Empty Circle Property . 68 6.2 The Lawson Flip algorithm . 70 6.3 Termination of the Lawson Flip Algorithm: The Lifting Map . 71 6.4 Correctness of the Lawson Flip Algorithm . 72 6.5 The Delaunay Graph . 74 6.6 Every Delaunay Triangulation Maximizes the Smallest Angle . 76 6.7 Constrained Triangulations . 79 7 Delaunay Triangulation: Incremental Construction 83 7.1 Incremental construction . 83 7.2 The History Graph . 86 7.3 The structural change . 87 8 The Configuration Space Framework 89 8.1 The Delaunay triangulation — an abstract view . 89 8.2 Configuration Spaces . 90 8.3 Expected structural change . 91 8.4 Bounding location costs by conflict counting . 93 8.5 Expected number of conflicts . 94 9 Voronoi Diagrams 99 9.1 Post Office Problem . 99 9.2 Voronoi Diagram . 100 9.3 Duality . 103 9.4 Lifting Map . 104 9.5 Point location in a Voronoi Diagram . 105 9.5.1 Kirkpatrick’s Hierarchy . 106 10 Trapezoidal Maps 113 10.1 The Trapezoidal Map . 113 10.2 Applications of trapezoidal maps . 114 10.3 Incremental Construction of the Trapezoidal Map . 114 10.4 Using trapezoidal maps for point location . 116 10.5 Analysis of the incremental construction . 117 10.5.1 Defining The Right Configurations . 117 10.5.2 Update Cost . 120 10.5.3 The History Graph . 121 10.5.4 Cost of the Find step . 122 10.5.5 Applying the General Bounds . 122 10.6 Analysis of the point location . 124 10.7 The trapezoidal map of a simple polygon . 126 6 CG 2013 Contents 11 Line Arrangements 133 11.1 Arrangements . 134 11.2 Construction . 135 11.3 Zone Theorem . 136 11.4 The Power of Duality . 138 11.5 Sorting all Angular Sequences. 138 11.6 Segment Endpoint Visibility Graphs . 139 11.7 Ham Sandwich Theorem . 141 11.8 3-Sum . 144 11.9 3-Sum hardness . 145 12 Davenport-Schinzel Sequences 149 12.1 Constructing lower envelopes . 154 13 Epsilon Nets 157 13.1 Motivation . 157 13.2 Range spaces and "-nets. 158 13.2.1 Examples . 158 13.2.2 No point in a large range. 159 13.2.3 Smallest enclosing balls. 160 13.3 Either almost all is needed or a constant suffices. 160 13.4 What makes the difference: VC-dimension . 161 13.4.1 The size of projections for finite VC-dimension. 162 13.5 VC-dimension of Geometric Range Spaces . 164 13.5.1 Halfspaces. 164 13.5.2 Balls. 165 13.6 Small "-Nets, an Easy Warm-up Version . 166 13.6.1 Smallest enclosing balls, again . 167 13.7 Even Smaller "-Nets . 167 7 Chapter 1 Fundamentals 1.1 Models of Computation When designing algorithms, one has to agree on a model of computation according to which these algorithms can be executed. There are various such models, but when it comes to geometry some are more convenient to work with than others. Even using very elementary geometric operations—such as taking the center of a circle defined by three points or computing the length of a given circular arc—the realms of rational and even algebraic numbers are quickly left behind. Representing the resulting real numbers/coordinates would be a rather painful task in, for instance, a Turing machine type model of computation. Therefore, other models of computation are more prominent in the area of geometric algorithms and data structures. In this course we will be mostly concerned with two models: the Real RAM and the algebraic computation/decision tree model. The former is rather convenient when designing algorithms, because it sort of abstracts from the aforementioned representation issues by simply assuming that it can be done. The latter model typically appears in the context of lower bounds, that is, proofs that certain problems cannot be solved more efficiently than some function depending on the problem size (and possibly some other parameters). So let us see what these models are in more detail. Real RAM Model. A memory cell stores a real number (that is what the “Real” stands for)1. Any single arithmetic operation (addition, subtraction, multiplication, division, and k-th root, for small constant k) or comparison can be computed in constant time.2 This is a quite powerful (and somewhat unrealistic) model of computation, as a single real number in principle can encode an arbitrary amount of information. Therefore we 1RAM stands for random access machine, meaning that every memory cell can be accessed in constant time. Not like, say, a list where one always has to start from the first element. 2In addition, sometimes also logarithms, other analytic functions, indirect addressing (integral), or floor and ceiling are used. As adding some of these operations makes the model more powerful, it is usually specified and emphasized explicitly when an algorithm uses them. 9 Chapter 1. Fundamentals CG 2013 have to ensure that we do not abuse the power of this model. For instance, we may want to restrict the numbers that are manipulated by any single arithmetic operation to be bounded by some fixed polynomial in the numbers that appear in the input. On the positive side, the real RAM model allows to abstract from the lowlands of numeric and algebraic computation and to concentrate on the algorithmic core from a combinatorial point of view. But there are also downsides to using such a powerful model. In particular, it may be a challenge to efficiently implement a geometric algorithm designed for the real RAM on an actual computer. With bounded memory there is no way to represent general real numbers explicitly, and operations using a symbolic representation can hardly be considered constant time. When interested in lower bounds, it is convenient to use a model of computation that encompasses and represents explicitly all possible execution paths of an algorithm. This is what the following model is about. Algebraic Computation Trees (Ben-Or [1]). A computation is regarded as a binary tree. The leaves contain the (possible) results of the compu- tation. a b − Every node v with one child has an operation of the form +, -, , =, , . associated to it. The operands of p 0 this operation∗ are constant input values, or among the ≤ ancestors of v in the tree. a c b c − Every node v with two children has associated to it a − branching of the form > 0, > 0, or = 0. The branch 0 0 is with respect to the result of v’s parent node.