Solutions to problem set 1

Similar documents
Lecture 3: Art Gallery Problems and Polygon Triangulation

Polygon Triangulation. (slides partially by Daniel Vlasic )

Polygon Triangulation. (slides partially by Daniel Vlasic )

CS6100: Topics in Design and Analysis of Algorithms

Computational Geometry

CS 532: 3D Computer Vision 14 th Set of Notes

Computational Geometry

Connected Components of Underlying Graphs of Halving Lines

Polygon Partitioning. Lecture03

Computational Geometry

CMSC 754 Computational Geometry 1

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

CS 532: 3D Computer Vision 11 th Set of Notes

On the perimeter of k pairwise disjoint convex bodies contained in a convex set in the plane

Line segment intersection. Family of intersection problems

Lecture 4: Linear Programming

Lecture 16: Voronoi Diagrams and Fortune s Algorithm

Grids Geometry Computational Geometry

Computational Geometry. Algorithm Design (10) Computational Geometry. Convex Hull. Areas in Computational Geometry

Computing intersections in a set of line segments: the Bentley-Ottmann algorithm

Notes in Computational Geometry Voronoi Diagrams

Line Arrangements. Applications

Lecture 2 - Introduction to Polytopes

3. Voronoi Diagrams. 3.1 Definitions & Basic Properties. Examples :

Stabbers of line segments in the plane

Polygon decomposition. Motivation: Art gallery problem

Notes and Answers to Homework Exam 1, Geometric Algorithms, 2017

4 Linear Programming. Manufacturing with Molds

Other Voronoi/Delaunay Structures

Week 7 Convex Hulls in 3D

Geometric Computation: Introduction

Three Dimensional Geometry. Linear Programming

Chapter 8. Voronoi Diagrams. 8.1 Post Oce Problem

MATH 890 HOMEWORK 2 DAVID MEREDITH

26 The closest pair problem

Rubber bands. Chapter Rubber band representation

Line Arrangement. Chapter 6

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8!

Computational Geometry

Linear Programming in Small Dimensions

Approximation Algorithms for the Unit Disk Cover Problem in 2D and 3D

Convex Hulls in Three Dimensions. Polyhedra

Field: We have been doing geometry eg linear programming. But in computational geometry, key difference in focus: low dimension d

arxiv: v1 [cs.cg] 8 Jan 2018

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8

Pebble Sets in Convex Polygons

Optimal Compression of a Polyline with Segments and Arcs

Computational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm

Voronoi Diagrams and Delaunay Triangulations. O Rourke, Chapter 5

Computational Geometry [csci 3250]

CS S Lecture February 13, 2017

PS Computational Geometry Homework Assignment Sheet I (Due 16-March-2018)

Definition 2 (Projective plane). A projective plane is a class of points, and a class of lines satisfying the axioms:

Lecture 3 February 9, 2010

COMPUTING CONSTRAINED DELAUNAY

CS 372: Computational Geometry Lecture 10 Linear Programming in Fixed Dimension

6.854J / J Advanced Algorithms Fall 2008

Computational geometry

Discrete Mathematics I So Practice Sheet Solutions 1

Computational Geometry Lecture Duality of Points and Lines

The Simplex Algorithm

Computational Geometry Algorithmische Geometrie

Answers to practice questions for Midterm 1

1 Divide and Conquer Approach

Lecture 2 September 3

EXTREME POINTS AND AFFINE EQUIVALENCE

1. Meshes. D7013E Lecture 14

Computing the Fréchet Distance Between Simple Polygons

January 10-12, NIT Surathkal Introduction to Graph and Geometric Algorithms

POLYHEDRAL GEOMETRY. Convex functions and sets. Mathematical Programming Niels Lauritzen Recall that a subset C R n is convex if

2D Geometry. Pierre Alliez Inria Sophia Antipolis

7 Voronoi Diagrams. The Post Office Problem

CMSC 754 Computational Geometry 1

Preferred directions for resolving the non-uniqueness of Delaunay triangulations

The Art Gallery Problem: An Overview and Extension to Chromatic Coloring and Mobile Guards

CS 473: Algorithms. Ruta Mehta. Spring University of Illinois, Urbana-Champaign. Ruta (UIUC) CS473 1 Spring / 29

Improved Bounds for Intersecting Triangles and Halving Planes

Triangulation and Convex Hull. 8th November 2018

Trap Design for Vibratory Bowl Feeders

Geometric Algorithms in Three Dimensions Tutorial. FSP Seminar, Strobl,

Planar Graphs. 1 Graphs and maps. 1.1 Planarity and duality

Polygon Triangulation

Math 5593 Linear Programming Lecture Notes

GEOMETRIC SEARCHING PART 1: POINT LOCATION

Average case analysis of dynamic geometric optimization

Course Number: Course Title: Geometry

Projects & Polygon Triangulation

Review for Mastery Using Graphs and Tables to Solve Linear Systems

K-structure, Separating Chain, Gap Tree, and Layered DAG

Computational Geometry

MISCELLANEOUS SHAPES

Lecture 3. Corner Polyhedron, Intersection Cuts, Maximal Lattice-Free Convex Sets. Tepper School of Business Carnegie Mellon University, Pittsburgh

Partitions and Packings of Complete Geometric Graphs with Plane Spanning Double Stars and Paths

Tutte s Theorem: How to draw a graph

Geometry. Zachary Friggstad. Programming Club Meeting

Lecture 5: Properties of convex sets

Packing Two Disks into a Polygonal Environment

CAD & Computational Geometry Course plan

Combinatorial Gems. Po-Shen Loh. June 2009

Voronoi diagrams Delaunay Triangulations. Pierre Alliez Inria

Transcription:

Massachusetts Institute of Technology Handout 5 6.838: Geometric Computation October 4, 2001 Professors Piotr Indyk and Seth Teller Solutions to problem set 1 (mostly taken from the solution set of Jan Vondrák) Mandatory Part Problem 1. Application of convex hulls: diameter Let P be a set of points on the plane. The diameter of P is defined as max p,q P p q 2, where is the Euclidean norm. Let CH be the convex hull of P. A point p on the convex hull is called unnecessary, if it lies on the segment between its predecessor and its successor on CH. Show that removing unnecessary points from P does not change the diameter of P. Also, give an O(n) time algorithm which detects and removes from P all unnecessary points. For each CH segment s = p p, define anti(s) to be the set of points furthest from the line containing s. Show that if CH does not contain any unnecessary points, then the cardinality of anti(s) is at most 2. Show that the diameter pair is a subset of {p, p } anti(p p ) for some segment p p. Based on the above observations, give an O(n log n)-time algoritm for finding the diameter of P. More generally, if P is a polytope and diam(p ) = p q, p, q P then both p and q are vertices of P : Suppose p is not a vertex. Then there exists a vector z 0 such that p ± z P. We can assume that the dot product (p q, z) is nonnegative (otherwise consider z). By expanding the square of a norm as a dot product, we get (p + z) q 2 = (p q, p q) + 2(p q, z) + (z, z) p q 2 + z 2 > p q 2 which contradicts the fact that p and q maximize the distance between two points in P. For a given set of points which are on the boundary of the convex hull in cyclic order, we can remove the unnecessary points by simply going around the polygon and marking all points which lie on the line defined by their two neighbors.

2 Handout 5: Solutions to problem set 1 First, if s is a segment of the convex hull, then CH is contained in one of the corresponding halfplanes. (Otherwise points in the relative interior of s would be in the interior of the polygon.) Let l be the furthest line parallel to s which still intersects CH. Because CH is convex, the intersection l CH is either one point or a line segment. In case it is one point, anti(s) = 1. In case it is a line segment, assuming we have removed the unnecessary points, only the endpoints of l CH are in P and anti(s) = 2. Let diam(p ) = p q. Let l p, l q be two parallel lines going through p and q, respectively, perpendicular to p q. Then CH is contained in the stripe between l p and l q, otherwise there is a point in CH further away from p than q, or vice versa. Moreover, l p CH = {p} and l q CH = {q}. Now, start rotating the two lines simultaneously, until one of them hits another point in P. Denote the rotated lines by l p, l q and assume l p contains another point p P. Then l p contains a line segment p p and l q is still the furthest parallel line intersecting CH (otherwise we would stop rotating sooner because of l q ). So we have s = p p and q anti(s) l q. The algorithm can proceed as follows: First, find the convex hull of P in O(n log n) time. Then remove the unnecessary points in O(n) time. Finally, process the line segments of the convex hull in the clockwise order and for each of them, determine the set anti(s). While finding anti(s) for the first segment may take O(n) time, finding the next one takes only O(1 + k) where k is the number points separating anti(s) and anti(s ) in the clockwise order. We simply go around the boundary of CH as long as the distance from s increases. Due to the previous observations, there can be at most two points which maximize the distance from each line segment, and the diameter of CH can be found as the maximum of all these distances. Going around the whole polygon, we spend O(n) time to determine the diameter. The total running time is dominated by the convex hull algorithm which takes O(n log n). Problem 2. Vertical segment intersection. In the class (Lecture 2) we have seen an algorithm for reporting all segment intersections when all segments are either horizontal or vertical. The description given in the class focused on detecting intersections between horizontal and vertical segments, leaving open the problem of detecting the intersections between vertical and vertical (or horizontal and horizontal) segments. To fill this gap, construct an efficient algorithm, which given a set of vertical (only) segments, reports all pairs of segments having nonempty intersection. Initially, we sort the vertical segments by their horizontal position in O(n log n) time. Then we can separate them easily into buckets corresponding to different horizontal positions. Intersections can only occur within each bucket. In each bucket, we apply the 1D algorithm to detect intersections between intervals on the line. For a bucket of size n i, this takes time O(n i log n i + k i ) O(n i log n + k i ) where k i is the number of intersecting pairs in the bucket. The total running time is O(n log n + k) where k is the total number of intersections.

Handout 5: Solutions to problem set 1 3 Problem 3. Textbook, exercise 3.3, p. 60. A rectilinear polygon is a simple polygon of which all edges are either horizontal or vertical. Give an example to show that n/4 cameras are sometimes necessary to guard a rectilinear polygon with n vertices. The rectilinear polygon would contain n parallel alleys. At least n 4 4 because no camera can see more than one alley. cameras are needed Problem 4. Textbook, excercise 4.16, p. 94. On n parallel tracks n trains are going with constant speeds v 1... v n. At time t = 0 the trains are at positions k 1... k n. Give an O(n log n) time algorithm that detects all trains that at some moment are leading. To this end, use the algorithm for computing the intersection of half-spaces. The space-time diagram of each train is given by If we define a polyhedral set x i (t) = k i + v i t. H = {(t, x) : i; x x i (t)} a point (t, x ) on the bottom boundary of H has the property that no train is beyond x at time t. A train such that x i (t ) = x, i.e. a train which defines the boundary at that point, is leading at time t. It remains to determine which trains define the boundary of H. This can be done using the half-space intersection algorithm from the book. Optional Part Problem A. Textbook, excercise 2.12, p. 43. Let S be a set of n triangles in the plane. The boundaries of the triangles are disjoint, but it is possible that a triangle lies entirely inside another triangle. Let P be a set of n points in the plane. Give an O(n log n)-time algorithm that reports each point in P lying outside all triangles. If you want, you can assume that all x-coordinates of points in P as well as of vertices of triangles in T are different.

4 Handout 5: Solutions to problem set 1 We use the plane sweep method. First, let s sort all the points and triangle vertices by their horizontal position. We associate events with each object: Test Point - for a single point Insert Triangle - for the leftmost vertex of a triangle Modify Edge - for the middle vertex Remove Triangle - for the rightmost vertex Between two neighboring events, the interior of a triangle is defined by two linear functions - the top and bottom edge. Therefore we can test the position of a point relative to the triangles in constant time. During the plane sweep, we keep the active objects sorted by their vertical coordinate in a data structure allowing the Search, Insert and Delete operations in O(log n) time (for example, a dynamically balanced search tree). Since triangles don t intersect, the vertical ordering is well defined. If a triangle vertex is found to be inside another triangle, the inside triangle can be discarded. We handle the events in this way: Test Point - we search for its position among active triangles. If the point turns out to be outside any active triangle, we report it. Insert Triangle - insert a new a triangle in the data structure and mark the two leftmost edges as active (to be used in comparisons with points and other vertices). Modify Edge - Instead of the edge between the leftmost vertex and the middle vertex, activate the edge between the middle and rightmost vertex. Remove Triangle - Remove the triangle from the data structure. We spend O(log n) time on each event and the total running time is O(n log n). Problem B. The algorithm works if the horizontal edges are handled consistently. The usual way to avoid degeneracies is to rotate the polygon by a small angle, so that no two vertices have the same y-coordinate. Equivalently, we can set up rules to handle horizontal edges so that the behavior of the algorithm will be exactly the same as if we rotated the polygon slightly, for example clockwise. Specifically, these rules would be: When sorting vertices before the plane sweep, use lexicographic ordering - the y- coordinate and then the x-coordinate. Thus all horizontal segments will be processed from left to right. When deciding whether a vertex is a split vertex or a merge vertex, consider a horizontal edge on the left as going slight upward and a horizontal edge on the right as downward. Therefore vertices inside a horizontal row will be neither split nor merge vertices.

Handout 5: Solutions to problem set 1 5 When looking for the helper vertex, assume that all the vertices on a horizontal sequence of segments are visible from the left, but only the rightmost vertex is visible from the right. The rest of the algorithm should remain intact. The same rules should be applied to the monotone triangulation algorithm as well. Comment: the solution above is correct. However, almost no one pointed out that the triangles produced by this algorithm would have zero area, and would have to be removed by a post-processing step. Some people lost points if their solution simply referred to the text, with no elaboration. Problem C. Let the feasible region be F = {x R d : Ax b}. We define a new linear program in dimension d + 1: max{λ : λ 1, x R d ; Ax + jλ b} (where j denotes the (1, 1,..., 1) vector). Assuming that F is nonempty and full-dimensional, there exists a point which is wellinside, i.e. λ > 0, x F such that Ax + λj b. Since we have the additional contraint λ 1, the objective function is bounded and an optimum exists. Also, the optimum is strictly greater than zero. When we find any optimum solution (x, λ), we have λ > 0 and Ax b jλ < b which means that x is well inside F. Comment: several solutions suggested pushing the initial constraints inward by some small epsilon. This lost points unless an efficient method for determining epsilon was given. Programming Exercise Excellent solutions can be seen at http://web.mit.edu/drdaniel/www/6.838/convexhull/convexhull.html (IE only) and http://graphics.lcs.mit.edu/~jcyang/6.838/pset1/ These are due to Daniel Vlasic and Jason Yang, respectively. The 50 points for this section were apportioned as 10 for the basic GUI, 10 for polygon entry, 10 for Convex Hull of a simple polygon, 15 for Andrews s algorithm, and 5 for the explanatory web page.