180 likes | 348 Views
UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010. O’Rourke Chapter 6 with some material from de Berg et al. Chapter 8 Arrangements. Chapter 6 Arrangements. Introduction Combinatorics of Arrangements Incremental Algorithm
E N D
UMass Lowell Computer Science 91.504Advanced AlgorithmsComputational GeometryProf. Karen DanielsSpring, 2010 O’Rourke Chapter 6 with some material from de Berg et al. Chapter 8 Arrangements
Chapter 6Arrangements Introduction Combinatorics of Arrangements Incremental Algorithm Three and Higher Dimensions Duality Higher-Order Voronoi Diagrams Applications
What is an Arrangement? (2D) ARRANGEMENT: planar partition induced by a collection of lines “arranged” in the plane. face vertex edge
Combinatorics of Arrangements • “Simple” arrangement: • Not “degenerate” • Every pair of lines meets in exactly 1 point • no parallel lines • No 3 lines meet in a point • Forms worst-case for these combinatorial quantities • For every simple arrangement of n lines: Establish inductively. de Berg or O’Rourke derivation (see next slides) Each pair of lines intersects once.
Combinatorics of Arrangements de Berg derivation (upper bound) (for a simple arrangement) • Add lines one by one, bounding the increase in number of faces at each step. • Let and for define . • Denote the arrangement induced by L as A(L). • When adding li, every edge of li splits a face of the arrangement into 2. • Number of faces increases by number of edges of A(Li-1) on li. • Upper bounded by i • Total number of faces is therefore at most:
Combinatorics of Arrangements O’Rourke derivation (more complex) (for a simple arrangement) v p p’ • Reexamine proof of Euler’s formula (V – E + F = 2) • Puncture polytope at a vertex v (instead of interior of a face) and flatten to the plane • Effects: • lose 1 vertex, so (V – E + F = 1) • flattening stretches all edges incident to v to extend to infinity • How to flatten? Stereographic projection • result is topologically equivalent to an arrangement • so V – E + F = 1 holds for an arrangement • Now substitute for known values of V and E
ArrangementA L Combinatorics of ArrangementsZone Theorem Zone Z(L)= set of cells intersected by L. D C CellA B D C A B zn= maximum of |Z(L)| over all L The total number of edges in all the cells that intersect one line in an arrangement of n lines is zn ≤ 6n. O(n)
Combinatorics of ArrangementsZone Theorem ArrangementA (rotated) Left-bounding edge L Right-bounding edge Assume: no line parallel to L, L horizontal, (no vertical lines?) Partition edges of each cell of Z(L) into left-bounding and right-bounding edges: - left-bounding edge has interior points of cell immediately to its right. Analogous definition for right-bounding edge.
Combinatorics of ArrangementsZone Theorem Proof Goal: Show number of left edges In in zn is ≤ 3n. (Right case is symmetric.) ArrangementA (rotated) r L • Inductive Proof Sketch: Induct on number of lines n • Base Case: Empty arrangement has no left edges. • Inductive Hypothesis: In-1 ≤3(n-1) • Inductive Step: Remove a line r from A to form A’, then put it back. Line whose intersection with L is rightmost is r. Inductive hypothesis gives In-1 ≤3(n-1). Show putting r back adds at most 3 left edges so that In ≤3n-3+3 = 3n. Reason: r adds one new left edge and splits at most 2 old left edges. • - see next slide
Combinatorics of ArrangementsZone Theorem ArrangementA’ (rotated) C A B L A C B r • Inductive Proof Sketch (continued): • Inductive Step: Show putting r back adds at most 3 left edges so that In ≤3n-3+3 = 3n. • Reason: r adds one new left edge and splits at most 2 old left edges. • - r just adds one new left edge to C since r is rightmost • - proof by contradiction shows no other new left zone edges are created; r slopes upwards and has rightmost intersection • r splits at most 2 old left zone edges in convex rightmost cell of A’
Incremental Algorithm Inserting Line Li Li Structure of arrangement is leveraged to avoid sorting. x Algorithm: ARRANGEMENT CONSTRUCTION Construct A0, a data structure for an empty arrangement for each i = 1,...,n do Insert line Li into Ai-1 as follows: Find an intersection point x between Li and some line of Ai-1 Walk forward from x along cells in Z(Li) Walk backard from x along cells in Z(Li) Update Ai-1 to Ai Q(n2) time and space
Three and Higher Dimensions • 2D results extend to higher dimensions • For an arrangement of hyperplanes in d dimensions • number of faces is O(nd) • zone of a hyperplane has complexity O(nd-1) • construct in O(nd) time and space
y Y1(p2) Y1(p5) Y1(p1) x Y1(p4) Y1(p3) Y2(p5) y Y2(p2) x Y2(p1) Y2(p3) Y2(p4) Duality • Key to many arrangement applications • 1-1 mapping of (parameters of) collections of geometric entities • Desirable mappings preserve characteristics: incidence and/or order y p4 p3 dual spaces p2 x p5 p1 primal space (already seen in de Berg et al.)
y y D(p1) p4 p3 D(p4) D(p2) p2 x x D(p5) p5 p1 D(p3) primal space Duality via Parabolic Tangents (already seen in previous chapter) • Convenient in Computational Geometry • y = 2ax - a2 is tangent to parabola y=x2 at point (a,a2) Properties of D: - is its own inverse - preserves point-line incidence - 2 points determine a line <-> 2 lines determine an intersection point - preserves above/below ordering dual space
Duality via Parabolic Tangents • Intersection of two adjacent tangents projects to 1D Voronoi diagram of the two 1D points: • 2 tangents above x = a, x=b • 2ax-a2 = 2bx-b2 • 2x(a-b)=a2-b2=(a-b)(a+b) • x= (a+b)/2
projects to 2nd order diagram 2-level D(p1) D(p5) D(p3) x x p4 p2 p3 p5 p1 3-level D(p2) D(p4) Higher-Order Voronoi Diagrams • Relationship between Voronoi diagrams and arrangements • Order in which tangents are encountered moving down vertical x=b is same as order of closeness of b to the xi’s that generate the tangents • k-level of arrangement = set of edges whose points have exactly k-1 lines strictly above them, together with edge endpoints • Points of intersection of k- and (k+1)-levels in parabola arrangement project to kth-order Voronoi diagram projects to 1st order diagram Points on x-axis map to tangents to parabola y=x2 1-D diagram
Applications • K-Nearest Neighbors • kth order Voronoi diagram can be used to find k-nearest neighbors of query point • Hidden Surface Removal for Graphics • topological sweep of arrangement of objects • Aspect Graphs for Computer Vision • characteristic views an object can present to viewer (combinatorially equivalent) • Smallest Polytope Shadow • combinatorial structure of shadow projection changes when viewpoint crosses a plane • Ham-Sandwich Cuts of a Point Set • bisector of point set is line having at most ½ points strictly to each side • bisectors of point set dualize to median level of dual line arrangement • all ham-sandwich cuts for sets A, B: intersect median levels of A, B • higher dimensional generalization: for d point sets in d dimensions, there exists a hyperplane simultaneously bisecting each point set
de Berg et al. Chapter 8 • Motivating application: • Compute discrepancy to support “supersampling” (many rays per pixel) in graphics ray tracing • use random rays to avoid artifacts • Discrepancy: of sample set with respect to an object • measures quality of set of n random rays • = difference between % hits for an object and % of pixel area where object is visible (goal is to make difference small) • Object behaves like half-plane inside pixel, so define half-plane discrepancy = maximum of discrepancies over all possible half-planes • Compute this in O(n2) time by using (for one case) a point-to-line duality to create an arrangement, then evaluating levels in the arrangement. • Number of lines above, through, and below each vertex of arrangement provide means to compute half-plane discrepancy.