1 Point Location Strategies Idit Haran 13.4.2005.

Slides:



Advertisements
Similar presentations
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Advertisements

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.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
 Distance Problems: › Post Office Problem › Nearest Neighbors and Closest Pair › Largest Empty and Smallest Enclosing Circle  Sub graphs of Delaunay.
Searching on Multi-Dimensional Data
Brute-Force Triangulation
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.
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:
The Divide-and-Conquer Strategy
Ruslana Mys Delaunay Triangulation Delaunay Triangulation (DT)  Introduction  Delaunay-Voronoi based method  Algorithms to compute the convex hull 
By Groysman Maxim. Let S be a set of sites in the plane. Each point in the plane is influenced by each point of S. We would like to decompose the plane.
Intersections. Intersection Problem 3 Intersection Detection: Given two geometric objects, do they intersect? Intersection detection (test) is frequently.
Voronoi Diagram Presenter: GI1 11號 蔡逸凡
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
Computational Geometry and Spatial Data Mining
1cs542g-term Notes. 2 Meshing goals  Robust: doesn’t fail on reasonable geometry  Efficient: as few triangles as possible Easy to refine later.
1 Lecture 8: Voronoi Diagram Computational Geometry Prof. Dr. Th. Ottmann Voronoi Diagrams Definition Characteristics Size and Storage Construction Use.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 O’Rourke Chapter 7 Search & Intersection.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Chapter 5: Voronoi Diagrams Wednesday,
Voronoi Diagrams Computational Geometry, WS 2006/07 Lecture 10 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Duality and Arrangements Computational Geometry, WS 2007/08 Lecture 6 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 Lecture 2 Chapter 2: Polygon Partitioning.
Mark Waitser Computational Geometry Seminar December Iterated Snap Rounding.
Lecture 8 : Arrangements and Duality Computational Geometry Prof. Dr. Th. Ottmann 1 Duality and Arrangements Duality between lines and points Computing.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Computing the Delaunay Triangulation By Nacha Chavez Math 870 Computational Geometry; Ch.9; de Berg, van Kreveld, Overmars, Schwarzkopf By Nacha Chavez.
Lecture 6 Divide and Conquer for Nearest Neighbor Problem Shang-Hua Teng.
Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Voronoi Diagrams.
1 University of Denver Department of Mathematics Department of Computer Science.
Duality and Arrangements Computational Geometry, WS 2006/07 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Brute-Force Triangulation
Orthogonal Range Searching I Range Trees. Range Searching S = set of geometric objects Q = query object Report/Count objects in S that intersect Q Query.
Delaunay Triangulations Presented by Glenn Eguchi Computational Geometry October 11, 2001.
3-dimensional shape cross section. 3-dimensional space.
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.
Area/Sigma Notation Objective: To define area for plane regions with curvilinear boundaries. To use Sigma Notation to find areas.
5 -1 Chapter 5 The Divide-and-Conquer Strategy A simple example finding the maximum of a set S of n numbers.
Télécom 2A – Algo Complexity (1) Time Complexity and the divide and conquer strategy Or : how to measure algorithm run-time And : design efficient algorithms.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
Computational Geometry Piyush Kumar (Lecture 10: Point Location) Welcome to CIS5930.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
CAP4730: Computational Structures in Computer Graphics
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
Arrangements and Duality Motivation: Ray-Tracing Fall 2001, Lecture 9 Presented by Darius Jazayeri 10/4/01.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)
An Introduction to Computational Geometry Joseph S. B. Mitchell Stony Brook University.
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.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
Polygon Triangulation
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Area/Sigma Notation Objective: To define area for plane regions with curvilinear boundaries. To use Sigma Notation to find areas.
Copyright © 2011 Pearson Education, Inc. Conic Sections CHAPTER 13.1Parabolas and Circles 13.2Ellipses and Hyperbolas 13.3Nonlinear Systems of Equations.
CMPS 3130/6130 Computational Geometry Spring 2017
Computational Geometry
Analyzing Conic Sections
An Introduction to Computational Geometry
Query Processing in Databases Dr. M. Gavrilova
CMPS 3130/6130 Computational Geometry Spring 2017
Enumerating Distances Using Spanners of Bounded Degree
Computational Geometry
Presentation transcript:

1 Point Location Strategies Idit Haran

2 Outline Problem Description Other strategies Our strategy - Landmarks Benchmark Working with conic arrangements and some number theory Future work Summary

3 Point Location – Problem Description INPUTOUTPUT Given A map (which divides space of interest into regions) A query point q (specified by coordinates) Find the region of the map containing q Requirement: (segments/conics)  Fast query  Reasonable preprocess time  Good data structure (small space)

4 Other Strategies Strategies implemented in CGAL: Na ï ve Walk along line Random Incremental Algorithm (Trapezoidal) Triangulation Other strategies: Persistent search trees

5 Na ï ve Approach (CGAL) No need for any preprocess, just go over all elements and find the closest Idea No preprocess. Storage space = 0. Preprocess & memory Go over all vertices, and check if q equals a vertex Go over all halfedges and check if q is on edge Go over all halfedges and find the closest edge upwards. O(n) query time Query

6 Walk Along a Line start from a known place in the arrangement and walk from there towards the query point through a straight line Idea No preprocess. Storage space = 0. Preprocess & memory The implementation in CGAL: Start from the unbounded face Walk down to the point in through a vertical line Asymptotically O(n) time In practice: quite good, easy to maintain Query q

7 Random Incremental Algorithm (Trapezoidal) Use hierarchy data structure that allows a logarithmic query time Idea Add the segments one by one randomly. For each segment: Update the trapezoidal map. Update the DAG. O(n·logn) time, O(n) space Preprocess & memory Search for the trapezoid in the DAG O(log n) time, if the segments were added randomly Query

8 Vertical Decomposition Assume a bounding box. Extend the vertical line from each vertex upward and downward, until it touches another segment.

9 Trapezoidal Maps Contains triangles and trapezoids. Each trapezoid or triangle is determined by two vertices and two segments. A refinement of the original subdivision.

10 Trapezoidal Maps Theorem: In a trapezoidal map of n segments, there are at most 6n+4 vertices, and at most 3n+1 faces. Proof: Vertices: 2n – original vertices 4n – 2 extensions for each original vertex. 4 – Vertices of the bounding box. Total: 6n+4 Faces: Similar

11 Trapezoidal Map Data Structure For each Trapezoid store: The vertices that define its right and left sides. The (up to two) neighboring trapezoids on right and left. (Optional) The neighboring trapezoids from above and below. This number might be linear, so we store only the leftmost of these.

12 The DAG Search Structure Q1Q1 P1P1 Q2Q2 P3P3 S3S3 B C S1S1 P2P2 A S3S3 S2S2 DEFGD H Q3Q3 S2S2 S3S3 JK B A C D E F H G J K P1P1 P2P2 P3P3 Q1Q1 Q2Q2 Q3Q3 S1S1 S3S3 S2S2 DAG = Directed Acyclic Graph

13 K Q1Q1 P1P1 Q2Q2 P3P3 S3S3 B C S1S1 P2P2 A S3S3 S2S2 DEFGDH Q3Q3 S2S2 S3S3 J B A C D E F H G J K P1P1 P2P2 P3P3 Q1Q1 Q2Q2 Q3Q3 S1S1 S3S3 S2S2 Using the DAG Search Structure

14 Triangulation Use a working algorithm on triangulation and test it on the arrangement (only segments !) (triangles are much simpler than faces) Idea Triangulate the planar map O(n·logn) time, O(n) space Keep relations between planar map vertices and triangulation Preprocess & memory Find the triangle q is located in The locate is done by walk from an arbitrary vertex. They claim that it takes time O(n) in the worst case, but only O(sqrt(n)) on average if the vertices are distributed uniformly at random. Find the face in the arrangement that contains this triangle Query

15 Persistent Search Trees (Sarnak-Tarjan) Divide the arrangement into slabs, like in sweep, and use logarithmic search Idea Draw a vertical line through each vertex, splitting the plane into vertical slabs. Observations: sets of line segments intersecting - contiguous slabs are similar. Reduces the problem to storing a “ persistent ” sorted set. O(n · log n) time, O(n · log n) space Preprocess & memory Find the slab Find the two segment above and below q O(log n) time. Query AB

16 Other Strategies - Summary PersistentTriangleRICWalkNa ï ve O(n·logn) O(n) O(n·logn) O(n) none Preprocess & memory O(logn)O(sqrt(n)) – O(n) O(logn) < O(n) O(n) Query Good locate time Quite good locate time Good locate timeSimple and reasonable query time Simple Benefits Long preprocess, large memory Long preprocess Complicated data structure, bugs, long preprocess, Very large memory needs Query time not good enough Bad query time Drawbacks More Algorithms on Delaunay Triangulations: The Delaunay Hierarchy, Jump & Walk

17 Point location using Landmarks Special points, “ landmarks ” are stored in a nearest neighbor search structure (e.g., kd-trees). During query time, “ walk ” from the landmarks towards the query point. Idea Choose the landmarks, and locate them in the arrangement. Store the landmarks in a nearest neighbor search structure. Preprocess Given a query point q, find the closest landmark l to the query point q, using the search structure. “ walk ” from l to q. Query q l

18 Choosing the Landmarks Number of landmarks Distribution of the landmarks in the arrangement: Geometric entities of the arrangement: Vertices Edge Midpoints Points inside the faces: Preprocess the arrangement into trapezoids and triangles Independent of the arrangement geometry: Random Grid q l q l

19 Quality of the landmarks – Arrangement Distance (AD) The Arrangement Distance (AD) between two points is the number pf faces in which the straight line segment that connect these points passes. Arrangement Distance ≠ Euclidean Distance p v v p AD = 0AD = 4

20 Nearest Neighbor Search Structure Input: Landmarks Query point q Question: Find nearest landmark l to the query point q Answer: Voronoi? - Again, point location problem !

21 Kd-trees l5l5 l1l1 l9l9 l6l6 l3l3 l 10 l7l7 l4l4 l8l8 l2l2 l1l1 l8l8 1 l2l2 l3l3 l4l4 l5l5 l7l7 l6l6 l9l The kd-tree is a powerful data structure that is based on recursively subdividing a set of points with alternating axis-aligned hyper-planes.

22 Kd-trees - Construction l5l5 l1l1 l9l9 l6l6 l3l3 l 10 l7l7 l4l4 l8l8 l2l2 l1l1 l8l8 1 l2l2 l3l3 l4l4 l5l5 l7l7 l6l6 l9l

l5l5 l1l1 l9l9 l6l6 l3l3 l 10 l7l7 l4l4 l8l8 l2l2 l1l1 l8l8 1 l2l2 l3l3 l4l4 l5l5 l7l7 l6l6 l9l q Kd-trees - Query

24 Using Kd-trees with the landmarks Quick: Approximate nearest neighbor Operations on points only Round all points to double – Inexact computation. Final result is always exact !

25 Landmarks point location – Query Find Nearest Landmark Decide on Startup Face Cross to Next Face Query Point Located Is query point in face ? Yes No Walk

26 Landmarks point location – Query Find Nearest Landmark Decide on Startup Face Cross to Next Face Query Point Located Is query point in face ? Yes No Walk Decide on startup face: From vertex: Check all incident face to the vertex, and find the face in q ’ s direction. From Edge: Choose between the two incident face to the edge. From Face: This is the startup face. q l q l q l

27 Landmarks point location – Query Find Nearest Landmark Decide on Startup Face Cross to Next Face Query Point Located Is query point in face ? Yes No Walk Is query point in face? Count the number of edges on f ’ s boundary that are above q. Odd – q is inside f – found ! Even – need to cross to the next face. q

28 Landmarks point location – Query Find Nearest Landmark Decide on Startup Face Cross to Next Face Query Point Located Is query point in face ? Yes No Walk Cross to next face: Create a segment s from the landmark l to the query point q find the edge e in f that intersects s flip e to get a new face f ’. check if q is in f ’… e f q l f’ s

29 Benchmark Categories: Query & Preprocess time Algorithms: Na ï ve, Walk, Triangle, RIC, 2 variants of landmarks algorithm. Arrangements: random and degenerate. similar results. RandomOnebig

30 Landmarks (random) Landmarks (vertices) RICTriangleWalkNaïveNumber of Original Segments Number of Edges N/A N/A Benchmark: Query Arrangements of random line segments Time in milliseconds

31 Algorithm Specific PreprocessCommon Preprocessing: Constructing the Arrangement Number of Original Segments Number of Edges Landmarks (random) Landmarks (vertices) RICTriangle 0.03< < < < N/A N/A Benchmark: Preprocess Arrangements of random line segments Time in seconds Na ï ve and Walk algorithms do not require any specific preprocessing besides constructing the arrangement

32 % Queries with AD = 0 Query Time [msec] Net Preprocessing Time [sec] Total Preprocessing Time [sec] Number of Random Landmarks , , , , ,000 Landmarks Algorithm Analysis Results on an arrangement of 500 original segments, include ~56,000 edges and ~28,000 vertices Algorithm performance for varying number of random landmarks

33 % Queries with AD = 0 Query Time [msec] Net Preprocessing Time [sec] Total Preprocessing Time [sec] Number of Landmarks Landmarks Type ,000Vertices (V) ,000Edge Midpoints (EM) ,000V + EM ,000Random ,000Uniform Grid Landmarks Algorithm Analysis Algorithm performance vs. the type of landmarks used p v q l

34 Landmarks Algorithm Analysis

35 Conics Differences from segments Bench results Problems invoked, and their solutions Cross to next face The chord method Number type theory

36 Conics – differences from segments More complex curves (every operator on the curves takes longer) Working with irrational number types Basically the same methods work (except triangle)

37 Benchmark: Query Arrangements of random conic arcs Time in seconds Landmarks (random) Landmarks (vertices) RICWalkNaïveNumber of Original Conics Number of Edges

38 Conics - Cross to Next Face Find exact intersection point – a complex operation on conics ! Instead – use a simple method to decide what edge to flip. The idea: check vertical order on the left and right boundaries of the common x-range. l q s e x-range l q e s L q e s L q e s l q e s (a) (b) (c)

39 What ’ s the problem with the vertices in an arrangement of conic arcs ? v Problem 1: vertex may be complex irrational number (algebraic with degree 4) Problem 2: finding the intersection between vp and other curves p v’ v’ Properties:  Rational  On the conic  Close to the v The chord method: given a rationl point r on the conic, we can use the chord method to find v’ r

40 The Chord Method Given: Unit circle equation: x 2 + y 2 = 1 The point (-1,0) is on the circle Find: Rational point v’ close to v Solution: Every line passing through this point is: y = t(x+1) where t is the slope of the line. solve x 2 + (t(x+1)) 2 = 1 (-1,0) y=t(x+1) x 2 +y 2 =1 v

41 One Rational Point Apparently, not all conics with rational (or even integer) coefficients have rational points on them For example, the circle x 2 + y 2 = 3 does not have any rational points on it.

42 Change the equation into homogenic coordinates: A: r x 2 + s y 2 + t xy + u x + v y + w = 0 ⇓ (x→x/z, y→y/z) B: r x 2 + s y 2 + t xy + u xz + v yz + wz 2 = 0 (Rational solution to A ⇔ Integer solution to B) Theory 1: if there is a solution for every congruence modulo p k for every prime p and every k, then there is a solution. Theory 2: Check only p=2 and p ’ s that divide the determinant of the equation coefficients. It is also sufficient to check only for k <= 3 + the largest exponent in the determinant factorization. Does a conic have rational solution? 3 Variables

43 How to find a rational solution (if there is one) Theorem : if a conic equation has an integer solution, then the size of the solution  (3F), where F is the sum of the absolute value of the coefficients.

44 What to do in practice? Change the equation into homogenic coordinates Go over all small p k and check if there is a solution modulo p k. One NO – no solution. All Yes – search for pairs (x,y) so that |x|<3F, |y|<3F check whether z is also an integer. YES – we found a solution. All NO – there is no solution. Complexity: (3F) 2

45 If there are no rational points on the conic? Euclid ’ s algorithm to approximate real number x into rational number r : x = a 0 + 1/x 1, x 1 >1, a 0 - integer x 1 = a 1 + 1/x 2, x 2 >1, a 1 - interger … Finally, r = a 0 + 1/(a 1 + (1/ (a 2 + ….) ) ) = p n /q n. If x is irrational, and the algorithm ends after n stages, then: | x - p n /q n | < 1/q n 2

46 How to find  ?  = the approximation value. should stay “ close ” to the vertex. 1.Find the minimum distance between v and other vertices. or 2.Find the minimum distance to all edges/vertices in the adjacent faces to the vertex.

47 Landmarks – future work Rationalization of the vertices More types of landmarks: Combination of different landmarks types Memory usage of the algorithms Halton sequence Hammersley Points

48 Summary Point location using landmarks – Fast query Efficient preprocess, using inexact computation Low memory Simple to understand and implement Many ways to improvements: different search structure, other choice of points