Planar Point Location

Similar documents
Trapezoid and Chain Methods

Point Enclosure and the Interval Tree

Line Arrangements. Applications

GEOMETRIC SEARCHING PART 1: POINT LOCATION

CS6100: Topics in Design and Analysis of Algorithms

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

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

Computational Geometry

Lecture 3 February 9, 2010

Notes in Computational Geometry Voronoi Diagrams

CMSC 754 Computational Geometry 1

Fractional Cascading

6.854J / J Advanced Algorithms Fall 2008

Orthogonal Range Search and its Relatives

A note on Baker s algorithm

Planarity: dual graphs

Trapezoidal Maps. Notes taken from CG lecture notes of Mount (pages 60 69) Course page has a copy

Chapter 8. Voronoi Diagrams. 8.1 Post Oce Problem

Range Searching II: Windowing Queries

Lecture 3 February 23, 2012

CMPS 3130/6130 Computational Geometry Spring Voronoi Diagrams. Carola Wenk. Based on: Computational Geometry: Algorithms and Applications

Lecture 16: Voronoi Diagrams and Fortune s Algorithm

Computational Geometry

External-Memory Algorithms with Applications in GIS - (L. Arge) Enylton Machado Roberto Beauclair

1 The range query problem

The Unified Segment Tree and its Application to the Rectangle Intersection Problem

2 A Plane Sweep Algorithm for Line Segment Intersection

Planar graphs. Math Prof. Kindred - Lecture 16 Page 1

would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp

[Ba] Bykat, A., Convex hull of a finite set of points in two dimensions, Info. Proc. Lett. 7 (1978),

Line segment intersection. Family of intersection problems

Polygon Triangulation. (slides partially by Daniel Vlasic )

10. Line Arrangements Lecture on Monday 2 nd November, 2009 by Michael Homann

Planar graphs. Chapter 8

Lecture 3: Art Gallery Problems and Polygon Triangulation

Geometric Data Structures

Lecture 9 March 15, 2012

! Linear programming"! Duality "! Smallest enclosing disk"

Pebble Sets in Convex Polygons

Computational Geometry

Binary Space Partitions for Orthogonal Segments and Hyperrectangles Adrian Dumitrescu Joe Mitchell Micha Sharir

Improved Bounds for Intersecting Triangles and Halving Planes

A Fast Algorithm for Optimal Alignment between Similar Ordered Trees

Polygon decomposition. Motivation: Art gallery problem

Lecture 13 Thursday, March 18, 2010

1. Meshes. D7013E Lecture 14

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Ray Tracing Acceleration Data Structures

Computational Geometry

Range-Aggregate Queries Involving Geometric Aggregation Operations

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

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

Line Arrangement. Chapter 6

Randomized incremental construction. Trapezoidal decomposition: Special sampling idea: Sample all except one item

Assignment 1 Introduction to Graph Theory CO342

Flavor of Computational Geometry. Voronoi Diagrams. Shireen Y. Elhabian Aly A. Farag University of Louisville

VORONOI DIAGRAM PETR FELKEL. FEL CTU PRAGUE Based on [Berg] and [Mount]

Bar k-visibility Graphs

CS S Lecture February 13, 2017

Computational Geometry Lecture Duality of Points and Lines

Range Searching and Windowing

Analysis of Algorithms

Voronoi diagram and Delaunay triangulation

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

LAMC Advanced Circle October 9, Oleg Gleizer. Warm-up

The Geometry of Carpentry and Joinery

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

CS 2336 Discrete Mathematics

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

Exercise set 2 Solutions

ICS 691: Advanced Data Structures Spring Lecture 3

Polygon Triangulation. (slides partially by Daniel Vlasic )

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

[Me] Meisters, G. H., Polygons have ears, American Mathematical Monthly, June/July 1975, pp

Optimal Expected-Case Planar Point Location

Efficient minimum spanning tree construction without Delaunay triangulation

Lecture 20 : Trees DRAFT

Straight-Line Drawings of 2-Outerplanar Graphs on Two Curves

Different geometry in the two drawings, but the ordering of the edges around each vertex is the same

Lecture Notes: External Interval Tree. 1 External Interval Tree The Static Version

Week 8 Voronoi Diagrams

INTRODUCTION TO THE HOMOLOGY GROUPS OF COMPLEXES

Motorcycle Graphs and Straight Skeletons

HW Graph Theory Name (andrewid) - X. 1: Draw K 7 on a torus with no edge crossings.

Organizing Spatial Data

External Memory Algorithms for Geometric Problems. Piotr Indyk (slides partially by Lars Arge and Jeff Vitter)

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem

Computational Geometry

c 2007 Society for Industrial and Applied Mathematics

Polygon Partitioning. Lecture03

Voronoi Diagrams and Delaunay Triangulation slides by Andy Mirzaian (a subset of the original slides are used here)

Finding sets of points without empty convex 6-gons. Mark H. Overmars

A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES)

An Introduction to Computational Geometry: Arrangements and Duality

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

Lesson 05. Mid Phase. Collision Detection

9 Bounds for the Knapsack Problem (March 6)

I/O-Algorithms Lars Arge Aarhus University

The statement implies that any three intersection points of two distinct planes lie on a line.

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

Transcription:

C.S. 252 Prof. Roberto Tamassia Computational Geometry Sem. II, 1992 1993 Lecture 04 Date: February 15, 1993 Scribe: John Bazik Planar Point Location 1 Introduction In range searching, a set of values, or one-dimensional points, divide a line into segments, and the problem is to find the segment on which a query point falls. The analogous problem in two dimensions is planar point location. In planar point location, the search space is a plane subdivided by the edges of a graph. The graph is constructed of edges connecting vertices. Since the graph is planar, the edges are straight lines that do not cross one another. Without an embedded graph, the plane is a single infinite region. As the edges of a graph enclose portions of that region, a planar subdivision is created. r 1 r 2 r 6 r 3 r 5 Figure 1: A Planar Subdivision. Essential to any discussion of planar graph algorithms is Euler s formula, which relates the number of edges to the number of vertices in a completely connected planar straight-line graph (PSLG). If R is the number of regions, V the number of vertices and E the number of edges, then Euler s formula states R + V = E + 2. (1) Proof: The proof is by induction. For any fixed number of vertices, V, if there is only one region, R = 1, then there are V 1 edges, since the graph is connected. Each new edge creates exactly one new region, so R increases with E. 1

If the graph is not completely connected, the formula becomes R + V = E + 1 + C. (2) where C is the number of completely connected components. If C is 1, this is just Euler s formula. Any incompletely connected graph can be transformed into a completely connected one by connecting the components to each other with edges. This requires at least C 1 edges, and can be done without adding any new regions or vertices. Hence the problem becomes the completely connected one. The number of regions is bounded by the number of edges in a PSLG as given by the following formula. R (2/3)E (3) Proof: The proof is by induction. We prove that the smallest number of edges used to form the largest number of regions is bounded by the formula. At least 3 edges are required to form 2 regions, creating a triangle. We assume that the formula holds as we create regions using the smallest number of edges possible. New regions are created by connecting two existing vertices with either one or two new edges. One edge is used when the vertices are not already connected, otherwise the two-edge method is required. If the minimum number of edges are always used, then to maintain planarity, these methods must be applied in alternating sequence. Two edges are needed to increase the number of regions from 2 to 3. If the edges are added interior to the original triangle, then it is possible to add a single edge to increase the regions from 3 to 4. But now each interior region is triangular and two edges are required to advance further. Combining these two formulas gives a useful result for reasoning about planar graphs. R (2/3)E R = E V + 2 (2/3)E (1/3)E V 2 E 3V 6 E = O(V ) (4) Euler s formula is important for the analysis of graph algorithms in the plane because it establishes a linear relationship among the numbers of regions, edges and vertices in planar graphs. We look at three methods for planar point location next. 2 Segment Tree Method A method suggested by Overmars [1] applies ray-shooting to the point location problem. A ray originates at a query point in a planar subdivision and is directed, by convention, downward. Each edge of the graph stores the name of the region above it, so the first edge encountered by the ray identifies the region containing the point. 2

r 1 r 2 r 6 r 3 q r 5 Figur: Vertical ray shooting. The primary data structure is a segment tree T. Each segment represents a vertical slab of the plane, delimited by the sorted x components of the vertices of the embedded graph. Since the graph is planar, the edges that cross each slab do not cross one another, and so they are strictly ordered in the vertical dimension. The secondary data structure captures this ordering of the edges. At each node of T, a balanced tree contains the edges whose projections on the x axis span the interval represented by that node, but do not span the interval of its parent node. That is, edges are stored with each allocation node of their segment along the x axis. q Figure 3: Segment Tree Method. To locate a point P, we search the segment tree for the interval containing the x component of P. At each node encountered during this search, we search the secondary tree for the edge closest to P but below it. Each of these secondary searches represents a ray shot downward at some of the edges of the graph. The closest edge discovered in these repeated searches supplies the region containing P. O(log n) searches of O(log n) each yield a query time of O(log 2 n) for this algorithm. The segment tree contains O(n) nodes, since each internal node corresponds to a vertex in the graph. Each edge may be stored at at most O(log n) nodes since there are at most 2 3

allocation nodes at each level of the segment tree for each edge. By Euler s theorem, there are O(n) edges, so the total space used is O(n log n). 3 Slab Method The slab method (Dobkin and Lipton [2]) offers optimal query time behavior, at the expense of needing possibly worst-case space. e 1 e 3 e 4 e 1 e 3 e 4 Figure 4: The Slab Method. A planar subdivision is divided into horizontal slabs delimited by the sorted y components of the vertices of the embedded graph. Each slab consists of trapezoids created by the nonintersecting segments of the graph edges that pass through it. Finding the region containing a query point means identifying first the slab, then the trapezoid that contains it. The primary data structure is a segment tree T. Each segment represents a horizontal slab of the plane. Each leaf of T contains a balanced tree. These secondary structures contain all the graph edges that pass through the slab, ordered left to right. The region names are stored with the edges. To locate a point P, we search the segment tree for the interval containing the y component of P. Then we search the secondary tree for the edges between which P lies. These two searches give us a query time of O(log n). A worst-case storage requirement of O(n 2 ) results from O(n) slabs of O(n) segments each (see Figure 5). The preprocessing cost of this data structure is as onerous as its size. First, an O(n log n) sort of the vertices by y coordinate is needed. Then a line-sweep algorithm is used to construct the tree as follows. Consider each vertex in ascending y order, and maintain at all times a left-to-right ordered list of graph edges. Initially that list is empty. As each vertex is encountered, edges below and incident upon it are deleted from the list and edges above and incident upon it are added. If the list is kept as a balanced tree, a single upward sweep produces at each vertex the secondary structure for the slab above it. Since each edge is inserted and deleted exactly once, the time complexity of the sweep is O(n log n). But generating the secondary trees requires O(n 2 ) time equal to their aggregate size. 4

4 Trapezoid Method Figure 5: Worst-Case PSLG. The trapezoid method of Preparata [3] refines the slab method by reducing storage and preprocessing time while maintaining O(log n) query time. In this approach, a search tree is constructed by slicing the graph into regions, as in the slab method. However, the slices are alternately horizontal and vertical, producing more slabs (or trapezoids), but fewer and simpler secondary structures. Figure 6: The Trapezoid Method. As defined by this method, a trapezoid has two horizontal sides and may be bounded to the left and right by edges of the graph, or it may be unbounded on either or both sides. Furthermore, it may not contain an edge that spans from top to bottom. Such an edge is a spanning edge that effects a vertical cut of the trapezoid, dividing it in two. A horizontal cut is a horizontal line drawn through the median interior vertex of a trapezoid, again, dividing it in two (see Figure 7). Consider a planar subdivision as a trapezoid, with horizontal sides drawn through the top and bottom vertices, and unbounded to the left and right. The data structure is a tree constructed by alternately and recursively applying horizontal and vertical cuts to the initial trapezoid. The nodes of the tree are of two types. nodes have two children and correspond to a horizontal cut. There are exactly n of these, one 5

Figure 7: Vertical and Horizontal Cuts. for each vertex. O nodes have k children and correspond to k 1 vertical cuts (spanning edges). The leaves of O nodes correspond to empty trapezoidal regions. Compound nodes are O nodes that correspond to more than one spanning edge (see Figure 9). These contain a secondary search tree analogous to that used in the slab method. r 1 e 4 e 5 e 9 e 13 e 14 e 15 e 3 e 6 e 12 0 e 11 e21 l 1 e 10 2 e 7 l 2 e 1 e 19 e 8 e 16 e 17 e 18 Figure 8: Trapezoidal Decomposition. To search for a query point, the primary tree is traversed by comparing the y value of the point with each node encountered, and the left-to-right ordering of the point with respect to the spanning edge represented by each O node encountered. If the point is neither to the left nor to the right of a compound O node, the O node s secondary tree is traversed. The data structure contains n 2 nodes. The number of O nodes depends on how many fragments the O(n) edges are divided into. To estimate this number, consider the way the data structure is created. After the first horizontal cut of an edge, each additional horizontal cut of that edge produces a trapezoid spanned by it (the trapezoid bounded by the two horizontal cuts). Since each horizontal cut takes place at the median vertex in its trapezoid, half of those vertices will not result in further cutting of the edge. That is, the edge is not exposed to further horizontal cuts from the vertices in any trapezoid that it spans. Since the horizontal cuts proceed in a binary fashion, the worst-case number of fragments an edge can be cut into is O(log n). So for O(n) edges, O(n log n) O nodes may be needed. Together with the nodes, the total space complexity of the Trapezoid method is O(n log n). 6

l 1 l 2 e 16 e 17 e 18 e 11 e 16 e 17 e 18 e 10 2 Figure 9: The Data Structure. Discussion of the Trapezoid Method continues in the next lecture. References [1] M. Overmars, Range Searching in a Set of Line Segments, Proc. (1st) ACM Symposium on Computational Geometry, pp. 177 185, 1985. [2] D. Dobkin and R. Lipton, Multidimensional Searching Problems, SIAM Journal of Computing vol. 5, no. 2, pp. 181 186, June 1976. [3] F. P. Preparata, A New Approach to Planar Point Location, SIAM Journal of Computing vol. 10, no. 3, pp. 473 482, 1985. 7