problem definition problem definition cg lecture 5 cg
play

Problem Definition Problem Definition CG Lecture 5 CG Lecture 5 - PDF document

Problem Definition Problem Definition CG Lecture 5 CG Lecture 5 Point Location Point Location Preprocess a planar map S. Given a query point q , report the face of S containing q. S 1. Problem definition and motivation A Goal : O (


  1. Problem Definition Problem Definition CG Lecture 5 CG Lecture 5 Point Location Point Location • Preprocess a planar map S. Given a query point q , report the face of S containing q. S 1. Problem definition and motivation A • Goal : O ( n )-size data structure 2. Point in polygon queries revisited B q that enables O (log n ) query time. 3. The slab method C E F 4. The monotone chain method • Application : Region containing G 5. The trapezoidal map method acquired GPS coordinates. D • Subdivision properties • Trivial Solution : O ( n ) query time, • Random incremental construction where n is the complexity of the map. • Expected complexity analysis ( Question : Why is the query time 6. The triangulation refinement method O ( n )?) 1 2 Point in polygon queries revisited Preprocessing monotone polygons Point in polygon queries revisited Preprocessing monotone polygons • Compute trapezoidal decomposition in O ( n ) time. • Problem : preprocess a polygon to quickly answer • Binary search for x -coordinate. whether an input point is inside or outside. • Point is either in, above, or below trapezoid. • Special cases: • Convex polygons • Star shaped polygons • Both processes in O ( n ) time and storage, query time O (log n ). • What about monotone polygons? 3 4 The slab method The slab method Example of the slab method Example of the slab method • Draw vertical lines through all the vertices of the subdivision. • Store the x -coordinates of the vertices in an ordered binary tree. • Within each slab, sort the segments separately along y. • Query time: O (log n ). Quick! • Problem : Too delicate Partition is a refinement of original subdivision Partition is a refinement of original subdivision subdivision, of size Θ ( n 2 ) in the worst case. 5 6 1

  2. The monotone chain method The monotone chain method Discriminating against chains Discriminating against chains • Complete each chain with horizontal segments to • Motivation: keep simple query algorithm of slab infinity. method while decreasing storage to O ( n ). • Binary search for x -coordinate, and discriminate. • The idea: • A binary search is based on the ability to discriminate our query against the data. • Construct a subdivision that allows discrimination of the query point against it. • A point is discriminated against a monotone chain of p vertices in O ( p ) time. • Construct a monotone complete set of chains . 7 8 Monotone complete set of chains Point location in monotone chains Monotone complete set of chains Point location in monotone chains • Let G be a planer subdivision given by a planar • Apply the bisection principle (binary search) to S : straight line graph (PSLG). • Search primitive is a point-chain discrimination: • Let S = { C 1 , C 2 ,…, C r } be a set of chains which are • If point lies above current chain, search rest of monotone with respect to the same line L . chains above current, otherwise search chains • We call S a monotone complete set of chains for G below. if the following properties hold: • Each discrimination costs O (log p ) if p is the • Property 1 : the union of members of S contains G . length of longest chain. • Property 2 : For any two chains C i and C j of S , the • If there are r chains, then total cost for search is vertices of C i which are not vertices of C j lie on O (log r *log p ). the same side of C j . • Worst case is O (log 2 n ). 9 10 Regular graphs Regular graphs Example: regular graphs Example: regular graphs • Question : can we find a monotone complete set of chains for any planar graph G ? • Answer : no, only for regular graphs. • Definition : Let { v 1 ,…, v n } be the vertices of G , sorted such that i < j iff either v iy < v jy or v iy = v jy and v ix > v jx . A vertex v j is regular if there are integers i < j < k such that ( v i , v j ) and ( v j , v k ) are edges of G . Graph G is regular if each v j is regular, 1 < j < n . • Theorem 1 : a regular graph admits a complete set of chains monotone with respect to the y -direction. 11 12 2

  3. Proof of theorem, part I Proof of theorem, part I Proof of theorem, part II Proof of theorem, part II • Imagine edge ( v i ,v j ) is directed from v i to v j if i < j . • To complete proof, the set of chains must meet the following conditions: • Define In( v j ) and Out( v j ) to be the set of incoming and outgoing edges, respectively. 1. Each edge has positive weight. 2. For each v j (j ≠ 1,n): W in ( v j ) = W out ( v j ). • Lemma : for any v j ( j > 1) we can construct a y - monotone chain from v 1 to v j . • Condition 1 ensures property 1. • Proof : by induction on j . • Condition 2 ensures we can choose the chain so • Define the weight of edge e , W ( e ), to be number of that they do not cross at v j (property 2). chains to which e belongs. • Weight-Balancing-Regular-Graph algorithm: • Define incoming and outgoing weights of vertex v, classical flow problem, solved by two passes on W in (v) and W out (v), to be sum of incoming and G (forward and backward passes). outgoing edge weights. • Forward pass makes outgoing flow equal to incoming, backward pass does the opposite. 13 14 Weight balancing example Total order on chains Weight balancing example Total order on chains 1 C 1 1 1 2 1 C 4 C 4 1 3 1 1 2 C 2 C 6 1 C C 2 6 1 1 C 2 1 2 1 1 C 1 C 3 C C C 5 C 1 C 3 1 3 5 3 C 4 4 C 5 5 1 1 1 3 C 6 6 15 16 Regularizing a planar map graph Regularizing a planar map graph Algorithm complexity Algorithm complexity • Sweepline from top to bottom. • In the worst case, the graph results in n /2 chains, each with n /2 vertices. • Events: vertices of graph. • Query in this graph is O (log 2 n ). • Status: balanced tree on edges intersecting sweepline, plus pointer to helper vertex for each • Storage seems to be O( n 2 )! interval in tree (vertex with lowest y -coordinate • Edges shared by several chains have one above interval). representative in search tree, which is the ancestor • Sweep maintains status structure, identifies non- of all other edges. regular vertices, and connects them to helper • Store chains using ‘bypass pointers’. vertex of interval. • Theorem : Point location in n-vertex planar • Two passes, adding upward and downward edges. subdivision can be effected in O (log 2 n ) time using • Complexity: O ( n ) space and O ( n log n ) time. O ( n ) storage and O( n log n ) preprocessing time. 17 18 3

  4. The trapezoidal map The trapezoidal map Properties Properties • Also known as a vertical decomposition. • Construct a bounding box. • Assume general position: unique x -coordinates. • Extend upward and downward the vertical line • Contains triangles and trapezoids. from each vertex until it • Each trapezoid or triangle is determined: touches another segment. • By two vertices that define vertical sides, and • This works also for non- • By two segments that define nonvertical sides. crossing line segments . • A refinement of the original subdivision. 19 20 Notation Another trapezoidal map Notation Another trapezoidal map • Every trapezoid (triangle) ∆ is defined by � top ( ∆ ): a segment. � bottom ( ∆ ): a segment. � leftp ( ∆ ): a segment endpoint (right or left). � rightp ( ∆ ): a segment endpoint (right or left). • Five cases for left (right) sides of trapezoid. 21 22 ( ∆ ∆ ) Five cases for left leftp ) Complexity Five cases for left leftp ( Complexity • Theorem (linear complexity) : A trapezoidal map of n segments contains at most 6 n +4 vertices and at most 3 n +1 faces. • Proof: Vertices: 2 n + 2(2 n) + 4 = 6 n + 4 ↑ ↑ ↑ ↑ ↑ ↑ original extensions box original extensions box • Case number five involves the bounding rectangle Faces: Count leftp ( ∆ ). R , where leftp is the lower left corner of R . 2 n + n + 1 = 3 n + 1 ↑ ↑ ↑ ↑ ↑ ↑ left e.p left e.p. right . right e.p e.p. box . box 23 24 4

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