Presentation on theme: "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."— Presentation transcript:
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 part of the subdivision lies P. A B C D E 4. Point location P
A natural way to start the search is to divide the plane into vertical stripes and to decide the position of P in two steps: - the stripe, (1) - the facet of the stripe (2). A B C D E P Point location (cont.)
But it turn out that the number of facets in this construction can be O (n 2 ) in terms of the number of edges! Point location (cont.) Example with 2(1 + 2 + 3 +...+ n) + 1 + n = ( n +1) 2 facets! If the vertical lines end at the fist intersection with the edges of the subdivision, the number of trapezoids is N 3 n + 1 (eq. 4.1).
A B C D E In this counting and further, we assume that, unlike the vertices of C, no two vertices of the subdivision have equal y coordinates, i.e. we assume that the edges of the subdivision are in general position. Point location (cont.)
This subdivision has the property that each trapezoid has unique upper bounding edge top ( ), unique lower bounding edge bottom ( ), unique left vertex leftp ( ), and unique right vertex rightp ( ). top ( ) bottom ( ) rightp ( ) leftp ( ) Each trapezoid has also 1-2 left and 1-2 right neighbors, e.g. lln ( ) is its left lower neighbor. Right upper neighbor Point location (cont.)
Finally, in this assignment, each of n input vertices can only once have either of these 3 roles, which proves eq. 4.1. Back to eq. 4.1. The number of trapezoids is L + 1 where L is the number of the vertices leftp ( ), since each trapezoid, with the exception of the leftmost one, has exactly one such vertex. Further, to each vertex leftp ( ) a unique edge may be assigned: bottom ( ), or top ( ), or top ( 1 ), 1 =lln ( ). Point location (cont.) 11
(1) Data structure (DS): For each edge e we save: -the right and the left endpoint of e, the facet whose top is e, and the facet whose bottom is e. For each facet we save: - leftp ( ), rightp ( ), top ( ), bottom ( ), and its neighbors. Point location ( Trapezoidal Map ) Algorithm 8 = Trapezoidal Map (Implementation = Exercise 20 ) The algorithm is incremental on the set of edges. So we may think about the structure as about a set S of edges. Adding edge at a time we update the data structure and the search structure. The edges may have only endpoints in common. They are not sorted.
Point location ( Trapezoidal Map ) (2) Search Structure (SS): Oriented graph without loops, whose - leafs are trapezoids of the Trapezoidal Map, - inner nodes are the edges from the initial set S, or their endpoints. - There is exactly one root. The out degree of inner nodes is 2. - If the inner node is an edge the deciding criterion is above or below*, if this is a point the criterion is left of right. SS is used not only to finally locate the given point, but also to build DS and SS itself inductively! More precisely, - in the step i we first locate the endpoints of the edge s i wrt already constructed SS i-1 after the step i-1, - then we again use SS i-1 to determine the trapezoids intersected by s i. *above will be depicted as „left“, below as „right“
Example1. A B C D E G F p1p1 q1q1 p2p2 q2q2 s1s1 s2s2 q1q1 p1p1 A s1s1 q2q2 G s2s2 B F p2p2 C s2s2 E D
Example2. A B C D E G F p1p1 q1q1 p2p2 q2q2 s1s1 s2s2 q1q1 p1p1 A s1s1 q2q2 G s2s2 B F p2p2 C s2s2 E D = p 3 q3q3 H I s3s3 I H q3q3 s3s3
00 A B C D 00 q i pipi A s i C D B q i pipi s i Example3.
11 22 33 00 s i pipi q i s i pipi q i A1A1 A2A2 B2B2 B1B1 D2D2 C2C2 C1C1 D1D1 E s i pipi q i A BD F C E Example4.1 The glueing process is necessary because the vertical lines intersected with s i need to be shortend to the first intersection!
s i B2B2 B1B1 q i D2D2 D1D1 E s i 11 22 00 33 C1C1 C2C2 A1A1 A2A2 B1B1 B2B2 q i s i D1D1 D2D2 E F A B C q i s i D E Example4.2
Theorem. A planar subdivision with n edges in general position admits an algorithm (1) whose running time has expected O (n log n) time, (2) the storage requires O (n) time, and (3) the location of a given point q takes expected O (log n) time. Proof of (2) : - 3n +1 leafs (trapezoids), out of which k i in step i (k i -1 new). - (k i - 1) inner nodes (easy to check) at each step i. ( Total number of inner nodes is equal to the number of leafs.) - Hence, the size of the search structure is 6n + 2 Point location ( T rapezoidal Map, expected behavior )
Proof of (3) : Let Xi be the number of nodes on the search path to q constructed in step i (in Example 1 (the path to q) X1=X2=3), and let E(X) be the expected value of X. Then: A B C D E G F p1p1 q1q1 p2p2 q2q2 s1s1 s2s2 q p 1 X1 q 1 s 1 p 2 X2 s 2 F - In the step i the path leading to q is increased by at most 3 nodes. - The increase happens only when a trapezoid of q is changed. -The change may only happen if s i is top ( ), bottom ( ), or defines leftp ( ) or rightp ( ), where is the new trapezoid! of q. Point location ( T rapezoidal Map, expected behavior )
Proof of (1): - O (log i) needed to locate the left endpoint of e i - O (k i ) needed to find the facets intersected by e i Hence, (O (log i) + O (E (k i )) ) = O (n log n) + O (n) = O (n log n) Proof of (3) – cont.: -The probability of each of these events is 1/i total = 34 1/i. Now E(X i) = 12/i = O (log n). Point location ( T rapezoidal Map, expected behavior )