UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Two Segments Intersect?
Polygon Triangulation
UNC Chapel Hill Lin/Foskey/Manocha Steps in DP: Step 1 Think what decision is the “last piece in the puzzle” –Where to place the outermost parentheses.
Computational Geometry
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
Dynamic Planar Convex Hull Operations in Near- Logarithmic Amortized Time TIMOTHY M. CHAN.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Brute-Force Triangulation
Convex Hull obstacle start end Convex Hull Convex Hull
One of the most important problems is Computational Geometry is to find an efficient way to decide, given a subdivision of E n and a point P, in which.
UNC Chapel Hill M. C. Lin Polygon Triangulation Chapter 3 of the Textbook Driving Applications –Guarding an Art Gallery –3D Morphing.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
I. The Problem of Molding Does a given object have a mold from which it can be removed? object not removable mold 1 object removable Assumptions The object.
1 Voronoi Diagrams. 2 Voronoi Diagram Input: A set of points locations (sites) in the plane.Input: A set of points locations (sites) in the plane. Output:
15-853Page : Algorithms in the Real World Suffix Trees.
296.3: Algorithms in the Real World
Intersections. Intersection Problem 3 Intersection Detection: Given two geometric objects, do they intersect? Intersection detection (test) is frequently.
Lecture 7: Voronoi Diagrams Presented by Allen Miu Computational Geometry September 27, 2001.
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
6/2/ :35 AMIncremental Convex Hull1 q w u e zt.
TU/e computational geometry introduction Mark de Berg.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Persistent Data Structures Computational Geometry, WS 2007/08 Lecture 12 Prof. Dr. Thomas Ottmann Khaireel A. Mohamed Algorithmen & Datenstrukturen, Institut.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Voronoi Diagrams.
AALG, lecture 11, © Simonas Šaltenis, Range Searching in 2D Main goals of the lecture: to understand and to be able to analyze the kd-trees and.
Brute-Force Triangulation
UNC Chapel Hill M. C. Lin Point Location Chapter 6 of the Textbook –Review –Algorithm Analysis –Dealing with Degeneracies.
Delaunay Triangulations Presented by Glenn Eguchi Computational Geometry October 11, 2001.
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
March Trapezoidal Maps Shmuel Wimer Bar Ilan Univ., School of Engineering.
UNC Chapel Hill M. C. Lin Orthogonal Range Searching Reading: Chapter 5 of the Textbook Driving Applications –Querying a Database Related Application –Crystal.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
Point Location Dmitry Rusakov Boris Kronrod. Planar Point Location Lets S be a planar subdivision with n edges. The planar point location problem is.
UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
Line Arrangement Chapter 6. Line Arrangement Problem: Given a set L of n lines in the plane, compute their arrangement which is a planar subdivision.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
Sorting Fun1 Chapter 4: Sorting     29  9.
Mehdi Mohammadi March Western Michigan University Department of Computer Science CS Advanced Data Structure.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
An Introduction to Computational Geometry Joseph S. B. Mitchell Stony Brook University.
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
UNC Chapel Hill M. C. Lin Randomized Linear Programming For any set of H of half-planes, there is a good order to treat them. Thus, we can improve the.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
Polygon Triangulation
Computational Geometry
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
CMPS 3130/6130 Computational Geometry Spring 2017
Computational Geometry
Data Structures and Design in Java © Rick Mercer
Geometric Data Structures
CMPS 3130/6130 Computational Geometry Spring 2017
Algorithm design techniques Dr. M. Gavrilova
CMPS 3130/6130 Computational Geometry Spring 2017
Polygon Triangulation
I. The Problem of Molding
Computational Geometry
Overlay of Two Subdivisions
Presentation transcript:

UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation using Trapezoidal Maps –Polygonization of Implicit Surfaces

UNC Chapel Hill M. C. Lin Knowing Where You Are Given a map and a query point q specified by its coordinates, find the region of the map containing q. A map can be treated as a subdivision of the plane into regions, or planar subdivision. A map can be stored electronically for query preprocessing to answer point location query fast and display the map interactively.

UNC Chapel Hill M. C. Lin Planar Point Location Let S be a planar subdivision with n edges. The planar point location problem is to store S in such a way that we can answer: given a query point q, report the face f of S that contains q. If q lies on an edge or a vertex, report so.  Partition the plane into vertical slabs. Store the x - coordinates of the vertices in the sorted order in an array. This makes it possible to determine in O( log n ) time the slab contains a query point q.

UNC Chapel Hill M. C. Lin A Possible Solution Do a binary search with the x -coordinate of q in the array storing x -coordinates of the subdivision. Do a binary search within that slab. Given a segment s and the query point q, determine whether q lies above, below or on s. Query time is good: O ( log n ). But the storage requirement is high: O ( n 2 )!!!  We need a better solution: trapezoidal maps!

UNC Chapel Hill M. C. Lin Trapezoidal Maps We have a set S of n non-crossing line segments, enclosed in a bounding box R, and with no two distinct end points lie on a common vertical line. We call such a set a set of line segments in general position. The trapezoidal map T(S) of S -- also known as the vertical decomposition or trapezoidal decomposition of S -- is obtained by drawing two vertical extensions from every endpoint p of a segment in S, one going upwards and one going downwards. The extensions stop when they meet another segment of S or the boundary of R. A face in T(S) is bounded by some edges of T(S). Some of these edges or sides of a face may be adjacent & collinear.

UNC Chapel Hill M. C. Lin Left/Right Edge of Trapezoid It degenerates to a point, which is the common left/right endpoint of top(  ) and bottom(  ). It is the lower vertical extension of the left/right endpoint of top(  ) that abuts on bottom(  ). It is the upper vertical extension of the left/right endpoint of bottom(  ) that abuts on top(  ). It consists of the upper and lower extension of the right endpoint p of a third segment s. These extension abuts on top(  ) & bottom(  ) resp. It’s left/right edge of R.

UNC Chapel Hill M. C. Lin Properties of Trapezoidal Maps The trapezoidal map T(S) of a set S of n line segments in general positions contains at most 6n+4 vertices, at most 3n+1 trapezoids. –The general position assumption is used to established the complexity bounds, but doesn’t affect the algorithm, as will be shown later. A trapezoid  of T(S) is uniquely defined by its top(  ), bottom(  ), leftp (  ) and rightp (  ); together they store the records of the line segments & endpoints. This structure uses the adjacency of trapezoids to link the subdivision as a whole.

UNC Chapel Hill M. C. Lin Trapezoidal Map for Point Location Use randomized incremental algorithm to construct the trapezoidal map T(S) & point location data structure D. T(S) and D are inter-linked through pointers. The search structure D is a directed acyclic graph with a single root and exactly one leaf for every trapezoid of T(S). There are 2 types of inner nodes (of out-degree 2): x- nodes, labeled with an endpoint of some segment in S, and y- nodes, labeled with a segment itself. A query with q starts at the root and proceeds along a directed path to a leaf. At an x- node, the test is “Does q lie to the left or right of the vertical line through endpoint stored at this node?” At a y- node, the test is “Does q lie above or below the segment s stored here?”

UNC Chapel Hill M. C. Lin Randomized Incremental Algorithm Construction of the search structure is incremental: it adds one segment at a time. After each addition, it updates D and T(S). The order in which the segments are added affects the construction of search structure D. Some results in a good structure and good query time, while others will be bad. But, we are interested in the algorithm that gives us good expected performance, not the best worst-case performance.

UNC Chapel Hill M. C. Lin TrapezoidalMap(S) Input: A set S of n non-crossing line segments Output: The trapezoidal map T(S) and a search data structure D for T(S) in a bounding box. 1. Determine a bounding box R that contains all segments of S, and initialize trapezoidal map structure T & search structure D for it 2. Compute a random permutation s 1, s 2,…, s n of the elements of S. 3. for i  1 to n 4. do Find set  0,  1,…,  k of trapezoids in T properly intersected by s i 5. Remove  0,  1,…,  k from T and replace them by new trapezoids that appear because of the insertion of s i 6. Remove the leaves of  0,  1,…,  k from D, and create leaves for the new trapezoids. Link the new leaves to the existing inner nodes by adding some new inner nodes, as explained next.

UNC Chapel Hill M. C. Lin FollowSegment(T, s i ) Input: A trapezoidal map T and a new segment s i Output: The sequence  0,  1,…,  k of trapezoids intersected by s i 1. Let p and q be the left and right endpoint of s i 2. Search with p in the search structure to find  0 3. j  0 4. while q lies to the right of rightp(  i ) 5. do if rightp(  i ) lies above s i 6. then Let  j+1 be the lower right neighbor of  j 7. else Let  j+1 be the upper right neighbor of  j 8. j  j return  0,  1,…,  j

UNC Chapel Hill M. C. Lin Algorithm Analysis The expected running time is the average running time taken over all n! permutations. The expected size of D is the average sizes of all these resulting search structures. The expected query time for q is the average query time for point q over all runs. Algorithm TrapezoidalMap computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(n log n) expected time. The expected size of the search structure D is O(n) and for any query point q the expected query time is O(log n).

UNC Chapel Hill M. C. Lin Average Query Time Analysis The query time for q is linear in the length of the path in D that is traversed when querying with q. It is increased by at most 3 in every iteration based on case analysis. So, 3n is the best possible worst-case bound over all possible insertion order for S. But, we’re interested in average query time w.r.t. all n! possible insertion orders. Let X i, for 1  i  n, for denote the number of nodes on the path created in i’th iteration. We can express the expected path length as : E[  1  i  n X i ] =  1  i  n E[X i ]

UNC Chapel Hill M. C. Lin Average Query Time Analysis X i  3  E[X i ]  0*(1-P i ) + 3*P i  E[X i ]  3P i  q (S i ) disappears if and only if one of the top(  q (S i )), bottom(  q (S i )), leftp(  q (S i ) or rightp(  q (S i )) disappears with the removal of s i. The probability of each event is 1/i. So, P i = Pr[  q (S i )   q (S i-1 ) ] = Pr[  q (S i )  T(S i-1 ) ]  4/i E[  1  i  n X i ]   1  i  n 3P i   1  i  n 12/i = 12  1  i  n 1/i = 12H n H n = 1/1 + 1/2 + 1/3 + … + 1/n ln n < H n < (ln n + 1)  Therefore, the query time takes O(log n)

UNC Chapel Hill M. C. Lin Expected Size of the Structure To bound the size, it suffices to bound the number of nodes in D. The leaves in D are in one-to-one correspondence with the trapezoids in T(S), of which there are O(n). Let k i be no. of new trapezoids created in iteration i, due to insertion of segment s i : O(n) + E  1  i  n (number of inner nodes created in iteration i) O(n) + E[  1  i  n (k i - 1)] = O(n) +  1  i  n E[k i ]  s  Si   T(Si)  ( ,s)  4 | T(S i ) | = O(i) E[k i ] = (1/i)  s  Si   T(Si)  ( ,s)  O(i)/i = O(1)  Thus, the size of the structure is bounded by O(n).

UNC Chapel Hill M. C. Lin Expected Construction Time The time to insert segment s i is O(k i ) plus the time needed to locate the left endpoint of s i in T(S i-1 ). Use the earlier bound on k i, we get the expected running time for the construction: O(1) +  1  i  n { O(log i) + O(E[k i ]) } = O(n log n)

UNC Chapel Hill M. C. Lin Naïve Assumptions General position statement assumes no two distinct points have the same x - coordinate. Assume that a query point never lies on the vertical line of an x -node on its search path, nor on the segment of a y - node.

UNC Chapel Hill M. C. Lin Dealing with Degeneracies Use symbolic perturbation. In effects, use an affine mapping called “shear transform” along the x -axis. The algorithm does not compute any geometric objects; it never actually computes coordinates of the endpoints. All it does is to apply 2 elementary operations to the input points: –Take 2 distinct points p & q and decides whether q lies to the left, right or on the vertical line through p. –Take 1 of the input segments, specified by p 1 & p 2, and tests whether a third point q lies above, below, or on this segment. It is only applied when a vertical line through q intersects with this segment.