Arrangements and Duality ======================== Lectures 8 & 9 Overview -------- We will start out by studying arrangements of lines in the plane. We'll just call that an arrangement, for short. Arrangements are interesting (in itself, but also) because they find application in many other problems of computational geometry. After we know the basics of arrangements, we will see how other problems can be transformed into a problem based on arrangements by exploiting the concept of duality. So our plan is: - What is an arrangement? - Combinatorics of an arrangement - Properties of an arrangement (Zone theorem) - Incremental construction of an arrangement (later: topological sweep) - Duality - Example problems using Duality and Zone Theorem Arrangements ------------ Consider n line in the plane in general position (no two lines parallel, no more than two lines cross in a point). When two lines intersect, they form a vertex. Lines get cut into (open) line segments. These line segments form (open) regions, faces, or cells in the plane. Counting -------- Vertices: (n choose 2) Edges: n^2 Faces: (n choose 2) + n + 1 (n choose 2) faces are closed along the negative y direction and have one of the vertices as their lowest vertex. At the bottom, there are n+1 faces that are open along the negative y direction. To see this, draw a line below all vertices parallel to the x-axis. It is clear that every face must have a lowest vertex. Why is it also true that every vertex is the lowest of a cell, and only of one cell? Faces can have arbitrary complexity. If we would like to have constant complexity we apply triangulation. (Note: according to this definition trapezoidalization is also a triangulation.) Vertices of a trapezoidalization: 3 (n choose 2) + n + 1 Arrangements in Higher Dimensions --------------------------------- E^d is the d-dimensional Euclidean space. A hyperplane in E^d is a d-1 dimensional linear subspace. A k-flat is a k-dimensional linear subspace. An intersection of d-k hyperplanes forms a k-flat. The codimension of a k-dimensional subspace of E^d is d-k. Objects of dimension 0 are called vertices. Objects of dimension 1 are called edges. Objects of dimension 2,...,d are called faces. Objects of dimension (d-1) are called facets. Objects of dimension d are called cells. Vertices: (n choose d) Cells: (n choose d) + (n choose d-1) + .... + (n choose 1) + (n choose 0) Proof: Recall what we did in 2D. (n choose d) vertices bound cells from below. We need to count the unbounded cells. Draw hyperplane H below all vertices. Let's imagine this in 3D. The added hyperplane H (now just a plane) intersects the arrangement. If we only look at H, we see a 2D arrangement. How many intersections does it have? Well, we know that. Can you now complete this by induction? Faces of codimension k: (n choose k) SUM_{0 <= j <= d-k} (n-k choose j) Proof: Each face of codimension k (dimension d-k) lies in a (d-k)-flat. There are (n choose k) such (d-k)-flats. How many faces (cells) are in each of these flats? We just answered that question. The (d-k) flat is formed by intersecting k d-dimensional hyperplanes. The remaining n-k hyperplanes form an arrangement in d-k dimensions. We can count the cells of this new arrangement as before. We can rewrite this as SUM_{j=k}^d (n choose j)(j choose k). Now back to 2D. Our goal is the construction of the arrangement (see planar map). We would like to have faces with all adjacent edges, and the faces adjacent to those, etc. If we want to do that, what expects us? How difficult can that be? We know there are (n choose 2) vertices and n^2 edges... But how many edges does an "average" face have? # of edges of average face = (2 n^2)/((n choose 2) + n + 1) = approximately 4. If we add a new line to our arrangement, what faces to we touch, how many edges and vertices do we see from that line? We call the faces, edges and vertices "visible" from this new line L the horizon or the zone of that line. Obviously, any line intersects n+1 faces. Upper bound for vertices: any face can have at most n edges, there are n+1 faces, therefore O(n^2). But on average it is 4(n+1), so we should be able to do better. Zone Theorem ------------ The zone of a straight line L intersecting an arrangement of n straight lines in the plane has at most 6n edges. The same bound holds for the number of vertices. Proof: Assume L is horizontal, if not, we rotate everything until it is. We will only count "right" edges of the zone. We will bound that by 3n. Then we do a head-stand and do the same again for the (previously) left edges to obtain a 6n bound. Idea of the proof: incrementally add edges and show that any edge can only create 3 new right edges. We will add the edges sorted right-to-left by their intersection with L. This is easily seen with a drawing. Any new edge introduces a new right edge and splits two previous edges, adding at most 3 new edges. Zone Theorem in Higher Dimensions --------------------------------- The zone of a hyperplane in an arrangement of n hyperplanes in E^d has complexity O(n^{d-1}), counting all faces of all dimensions. We will not prove that but if you want to see the proof, come talk to me. Incremental Construction of Arrangement --------------------------------------- Idea: Add one line at a time, maintaining a data structure that represents the arrangement. (What should that data structure look like?) The Zone Theorem will give us O(n^2) time. This was first shown by Chazelle et al. '85 and by Edelsbrunner et al '86. Note that this bound is tight, since we know the arrangement has n^2 edges and (n choose 2) vertices. Algorithm: Initialize arrangement with a single line For each line l_i In O(n) find the intersection with l_i and a line in the arrangement Walk back and forth the O(n) edges along the zone and update the data structure. We will see a new form of sweep line algorithm to compute arrangements soon. Duality ------- At first sight it seems not very useful to have done all this work on arrangements. What can we use it for? With duality we can turn problems based on sets of points into problems based on lines. And then we might be able to solve them more efficiently or more easily. We will see an example of that. Duality I: ---------- point (a,b) ==> line y = a x + b line y = \lambda x + \mu ==> point (-\lambda, \mu) Property: Maintains incidence p on line l <=> D(l) is on D(p) Proof: p: (a,b) is on l: y = \lambda x + \mu iff b = \lambda a + \mu b - \lambda a - \mu indicates how far p is above l but assuming that b = \lambda a + \mu this must be zero -> they are incident dual case: p: (-\lambda, \mu) is on l: y = a x + b iff \mu = -\lambda a + b \mu + \lambda a + b is equal to - (b - \lambda a - \mu) Therefore: This duality preserves incidence, and aboveness, and the distance. Problem: No vertical lines. D(D(x)) =/= x Duality II: ----------- point (a,b) <==> line a x + b y + 1 = 0 Note: D(D(x)) = x Geometric interpretation: (a,b) maps onto the line with x-intercept -1/a and y-intercept -1/b reciprocal distance to origin Problem: No lines through the origin. Question: Is there a "universal" duality? No. Only if you go to a projective plan with a line at infinity. Applications of Duality and Zone Theorem ---------------------------------------- Vision Problem: Given a set of points in the plane, are there several on a line, maybe indicating that the set of points we see are mean that we see a line. Degeneracy Problem: We have an algorithm that only works if the input does not contain three collinear points. Naive Approach: Check (n choose 3) sets of points for collinearity. O(n^3) Dual Approach: Take dual I and look for 3 lines that intersect in a point by constructing the arrangement in O(n^2). Lower bound for this problem is Omega (n log n). O(n^2) has been the best bound for the last 20 years. --- Smallest Triangle Problem: Given a set of points, what is the smallest triangle defined by three of them? Naive Approach: Check (n choose 3) triangles for size. O(n^3) Pick (n choose 2) points, consider the line they form and find the closest point to the line. O(n^3) Dual Approach: Duality I preserves vertical distance! Rather than taking two points and forming a line, we take their dual's intersection and find the nearest line to that point. We dualize in linear time. We compute the arrangment in O(n^2). We walk around the edges of each face and compute the shortest thread to each intersection point of two edges. Using the Zone Theorem we see that this is O(n^2).