point location
play

Point Location Lekcija 8 Sergio Cabello - PowerPoint PPT Presentation

Point Location Lekcija 8 Sergio Cabello sergio.cabello@fmf.uni-lj.si FMF Univerza v Ljubljani Edited from slides by Antoine Vigneron Sergio Cabello RC Point Location Outline a fundamental problem: point location solved using


  1. Point Location Lekcija 8 Sergio Cabello sergio.cabello@fmf.uni-lj.si FMF Univerza v Ljubljani Edited from slides by Antoine Vigneron Sergio Cabello RC – Point Location

  2. Outline ◮ a fundamental problem: point location ◮ solved using • trapezoidal map • RIC Sergio Cabello RC – Point Location

  3. Problem statement ◮ given (a DCEL of) a Plane Straight Line Graph (PSLG) G , preprocess G to answer the following queries efficiently: • input: a query point q • output: the face of G that contains q ◮ remarks: one dimension in the plane sorting trapezoidal map searching point location quicksort RIC random BST history graph Sergio Cabello RC – Point Location

  4. Results ◮ expected query time: O (log n ) ◮ expected preprocessing time: O ( n log n ) ◮ expected space usage: O ( n ) ◮ can we do better? • deterministic algorithm with same time and space bounds • we will see it next time (board) • optimal in a suitable model of computation Sergio Cabello RC – Point Location

  5. Trapezoidal map ◮ start with a PSLG G ◮ the trapezoidal map T ( G ) is obtained by drawing vertical edges downward and upward from each vertex T ( G ) G ◮ we draw a bounding box around G so that there is no infinite face, hence all faces of T ( G ) trapezoids (or triangles) Sergio Cabello RC – Point Location

  6. General position assumptions ◮ the PSLG G is a set S of non–intersecting line segments ◮ no two endpoints have same x –coordinate S T ( S ) ◮ for a general DCEL, simulate splitting at each vertex Sergio Cabello RC – Point Location

  7. Consequences ◮ each trapezoid ∆ of T ( S ) depends on • a bottom segment bottom (∆) • a top segment top (∆) • a left endpoint left (∆) • a right endpoint right (∆) top (∆) top (∆ ′ ) right (∆ ′ ) right (∆) left (∆) ∆ ∆ ′ left (∆ ′ ) bottom (∆) bottom (∆ ′ ) Sergio Cabello RC – Point Location

  8. Neighbors ◮ two trapezoids are neighbors if and only if they share a vertical edge ◮ by our general position assumption, a trapezoid has at most 4 neighbors Sergio Cabello RC – Point Location

  9. Data structure ◮ Augment a DCEL with extra information ◮ or simpler: just store adjacency relations from previous two slides • the endpoints of the segments in S are represented by their coordinates • the segments in S are represented by their left and right endpoints • each trapezoid ∆ of T ( S ) has pointers to ⋆ bottom (∆), top (∆) ⋆ left (∆), right (∆) ⋆ its (at most) 4 neighbors Sergio Cabello RC – Point Location

  10. Trapezoidal map ◮ T ( G ) has • O ( n ) vertices • O ( n ) edges • O ( n ) faces (=trapezoids) ◮ we use T ( G ) for point location ◮ point location in a trapezoidal map • construct trapezoidal map by RIC • use history graph to perform point location Sergio Cabello RC – Point Location

  11. Point location in a PSLG G ◮ first compute T ( G ) and associated search structure by RIC ◮ then augment with pointers from each face of T ( G ) to the face in G that contains it • use the edges bottom (∆) to identify the face of G that contains it ◮ perform point location in T ( G ) ◮ find the corresponding face in G Sergio Cabello RC – Point Location

  12. RIC trapezoidal maps Sergio Cabello RC – Point Location

  13. Preliminaries ◮ compute a random permutation ( s 1 , s 2 , . . . s n ) of S ◮ we denote S i = { s 1 , s 2 . . . s i } for all i ≤ n ◮ initialize the data structure: DCEL or adjacency relations for the bounding box ◮ each trapezoid ∆ stores a conflict list: list of segments whose left endpoint is in ∆ • initially, only one conflict list (for the interior face of the bounding box) that gathers all the segments in S • keep a pointer from each s ∈ S to its conflicting trapezoid, which is the interior face of the bounding box Sergio Cabello RC – Point Location

  14. Conflict lists: example s 4 s 1 s 3 s 6 s 5 ∆ ′ s 2 ∆ s 7 s 8 ∆ ′′ ◮ L (∆) = { s 5 , s 8 } ◮ L (∆ ′ ) = { s 6 } ◮ L (∆ ′′ ) = { s 7 } Sergio Cabello RC – Point Location

  15. Idea ◮ at step i we maintain: • a representation of T ( S i ) • for each trapezoid ∆ of T ( S i ) ⋆ a conflict list L (∆) of pointers to all the segments in S \ S i whose left endpoint is in ∆ • for each s ∈ S \ S i ⋆ a pointer to the trapezoid ∆ of T ( S i ) that contains its left endpoint ◮ then we insert s i +1 and update this data structure Sergio Cabello RC – Point Location

  16. Inserting s i ◮ s i may cross several trapezoids of T ( S i − 1 ) ◮ each trapezoid is split into at most 4 trapezoids ◮ some trapezoids have to be merged s i Sergio Cabello RC – Point Location

  17. Inserting s i ◮ s i may cross several trapezoids of T ( S i − 1 ) ◮ each trapezoid is split into at most 4 trapezoids ◮ some trapezoids have to be merged s i Sergio Cabello RC – Point Location

  18. Inserting s i ◮ s i may cross several trapezoids of T ( S i − 1 ) ◮ each trapezoid is split into at most 4 trapezoids ◮ some trapezoids have to be merged s i Sergio Cabello RC – Point Location

  19. Zone of s i ◮ The zone of s i in T ( S i − 1 ) is the union of all the cells that intersect s i . s i ◮ It is the union of all the trapezoids of T ( S i − 1 ) that are destroyed when we insert s i Sergio Cabello RC – Point Location

  20. Zone of s i ◮ It is the union of all the trapezoids in T ( S i ) that depend on s i . s i ◮ It is the union of all the trapezoids created when we insert s i Sergio Cabello RC – Point Location

  21. Updating the trapezoidal map ◮ we know which trapezoid in T ( S i − 1 ) contains the left endpoint of s i : this is the trapezoid that conflicts with s i ◮ we proceed from left to right and update the trapezoidal map ◮ everything is done within the zone of s i ◮ we sweep from left to right ◮ only two trapezoids intersect the sweep line at any time ◮ let k i be the number of trapezoids in T ( S i ) that depend on s i ◮ there are at most k i events ◮ so the update can be done in O ( k i ) time Sergio Cabello RC – Point Location

  22. Updating the conflict information ◮ we also need to update the conflict lists ◮ non–inserted left endpoints move from destroyed trapezoids to newly created trapezoids ◮ each destroyed trapezoid is contained in the union of 4 new trapezoids ◮ so update can be done in time O ( X i ), where X i is the number of left endpoints of non–inserted segments in the zone of s i ◮ X i is also the number of left endpoints in the trapezoids of T ( S i ) that depend on s i Sergio Cabello RC – Point Location

  23. Estimation of E [ k i ] ◮ trapezoid ∆ ∈ T ( S i ) is a newly created trapezoid iff it depends on s i ◮ ∀ s ∈ S i let • δ (∆ , s ) = 1 if ∆ depends on s • δ (∆ , s ) = 0 otherwise ◮ the number of trapezoids that depend on s is � δ (∆ , s ) ∆ ∈T ( S i ) Sergio Cabello RC – Point Location

  24. Estimation of E [ k i ] ◮ we use backward analysis ◮ we assume that S i is fixed ◮ then s i can be any segment in S i with probability 1 / i ◮ then   E [ k i ] = 1 � � δ (∆ , s )   i s ∈ S i ∆ ∈T ( S i ) ◮ we reverse the order of summation:   E [ k i ] = 1 � � δ (∆ , s )  i s ∈ S i ∆ ∈T ( S i ) Sergio Cabello RC – Point Location

  25. Estimation of E [ k i ] ◮ What is: � δ (∆ , s ) s ∈ S i ◮ this is the number of segments that ∆ depends on ◮ so it is at most 4 ◮ therefore E [ k i ] ≤ 1 � 4 i ∆ ∈T ( S i ) ◮ there are O ( i ) trapezoids in T ( S i ) so E [ k i ] = 1 i O ( i ) = O (1) Sergio Cabello RC – Point Location

  26. Estimation of X i ◮ we also need to estimate X i : number of non–inserted left endpoints in zone of s i ◮ backward analysis: S i is fixed ◮ let s ∈ S \ S i ◮ let ∆ s be the trapezoid in T ( S i ) that contains the left endpoint of segment s ◮ What is the probability that ∆ s is newly created? • this is the probability that s i is one of the (at most 4) segments ∆ s depends on • so it is at most 4 / i ◮ so E [ X i ] ≤ 4( n − i ) i Sergio Cabello RC – Point Location

  27. Analysis ◮ let T ( n ) be the construction time ◮ then by linearity of expectation � n � � E [ T ( n )] = O E [ k i ] + E [ X i ] i =1 ◮ so � n � � n � 1 + n 1 � � E [ T ( n )] = O = O = O ( n log n ) n i i i =1 i =1 ◮ this is an expected time on worst case input Sergio Cabello RC – Point Location

  28. Point location data structure Sergio Cabello RC – Point Location

  29. Preliminaries ◮ the history graph records the history of the RIC ◮ Similar as we did for modified Quicksort: • Quicksort ⇒ history graph ⇒ searching ◮ here: • RIC ⇒ history graph ⇒ point location ◮ for Quicksort, history graph was a tree • here it is a DAG: Directed Acyclic Graph ◮ expected preprocessing time: O ( n log n ) ◮ expected space usage: O ( n ) ◮ expected query time: O (log n ) Sergio Cabello RC – Point Location

  30. Example (1) B s 1 B ′ A ′ A ′ A B B ′ A (The root corresponds to the bounding box) Trapezoidal map History graph Sergio Cabello RC – Point Location

  31. Example (2) B s 1 B ′ A ′ A B A ′ B ′ A A ′ and B ′ are deleted from the trapezoidal map s 2 but remain in the history graph Trapezoidal map History graph Sergio Cabello RC – Point Location

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend