Create Presentation
Download Presentation

Download Presentation
## Point Location Problem in Computational Geometry

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Point Location Problem in Computational Geometry**I4B01 張繼文 Ref: Computational Geometry, Preparata and Shamos, Chap. 2**Topics**Point Location Problem for • Polygon • Planar Subdivision**Point in Polygon**Single-shot approach Division wedges for the convex inclusion**Problem (polygon inclusion)**• Given a simple polygon P and a point Z, is Z in P?**P**Z L The single-shot approach Assume that L intersects P and that L does not pass any vertex of P. • IN: odd number of crossings • OUT: even number of crossings • the result holds for concave polygons too**Degenerate Cases**P 1,2 3 4 5 Z X X X L • If just one vertex of an edge belongs to L, then it must be counted if it is the vertex with larger ordinate, and ignored otherwise • If both vertices of an edge belong to L, this edge must be ignored**Theorem**• Whether a point Z is internal to a simple N-gon P can be determined in O( N ) time, without preprocessing.**Division Wedges for Convex Inclusion**• The method relies on the convexity of P. • The vertices of a polygon occur in angular order about any internal point, Q. • Treating Q as the origin of polar coordinates.**P2**P3 Z P P1 P4 Q P5 P8 P6 P7**Procedure**CONVEX INCLUSION 1. Given a query point Z, determine by binary search the wedge in which it lies. 2. Determine that point Z lies between the rays defined by Pi and Pi+1**Theorem**• The inclusion question for a convex N-gon can be answered in O( log N ) time, given O( N ) space and O( N ) preprocessing time.**Theorem**• The kernel Q can be founded in O( N ) time. • The inclusion question for an N-vertex star-shaped polygon can be answered in O( log N ) time and O( N ) storage, after O( N ) preprocessing time.**Point Location in a planar subdivision**The slab method The chain method The triangulation refinement method**Divide the plane into easily manageable sections**Divide the graph into slabs. Draw a vertical line through every vertex of the graph The slab method**The slab method**All edges intersecting a slab • Have no endpoint in the slab • Don’t cross each other**Slab Method (cont)**• Sort vertices in ascending x order. • For each interval ( Vi, Vi+1 ), store the segments crossing the interval ordered from top to bottom. • For a query point • Usebinary search to determine the slab 2.Use binary search to determine the face**Worst Case in Storage**segment : O( N ) Total space : 2 2 2 4 6 8 10 10 8 6 4 2 O( N ) slab : O( N )**Theorem**• Point-location in an N-vertex planar subdivision can be effected in O( log N )time using O( N2 ) storages.**Definition :**A chain C = ( u1, … , up ) is a planar straight-line graph with vertex set { u1, … , up } and edge set { (ui, ui+1) : i = 1, …, p-1 } U1 U3 U2 U5 U6 U4 U8 U7 The Chain Method**Definition :**A chain C = ( u1, …, up ) is said to be monotone with respect to a straight line L if a line orthogonal to L intersects C in exactly one point. U1 L U2 U3 U4 U5 The Monotone Chain**Where does the query point lie?**U1 U2 P U3 U4 U5**The projection of P on L can be located with a binary search**in a unique interval ( L(ui), L(ui+1) ) Determine on which side of the line containing uiui+1 the query point lies. U1 L U2 P L(U1) L(U2) U3 U4 L(P) L(U3) U5 L(U4) L(U5) A query point lies ?**Suppose there is a set C = { C1, …, Cr } of a polygon, we**can apply the bisection to find the region query point lies. C1 C4 C2 C6 C2 C3 C6 C5 C4 C1 C3 C5 The Chain Method**The Chain Method (cont)**• If there are rchains in C and the longest chain has pvertices, then the search worst-case time is O( log p * log r )**Steps to Construct the Chains …**• First, regularize the PSLG • Second, assign weights on the graph using weight-balancing algorithm • Third, construct chains by traversing the graph**Definitions**(for chains monotone w.r.t. y) • A vertex vj is said to be regular if there are vertices y(vi) < y(vj) < y(vk) such that ( vi, vj ) and ( vi, vk ) are edges of G. 2. Graph G is said to be regular if each yi is regular for 1 < j < N**Definition: cusp**2-pass sweep-line to remove cusps Connect to the upper end point of the lower neighbor e1 V e2 Regularize Nonregular Vertices (remove cusps)**Weight Assignment of Edges**• All edges satisfy : 1.Each edge has positive weight 2.For each Vj( j ≠1, N ), Win(Vi) = Wout(Vj) PS. Vin( Vi ) = | IN(v) | Vout( Vi ) = | OUT(v) |**WEIGHT-BALANCING REGULAR PSLG**1.Initialization Begin for each edge e do W(e) = 1 2. First pass for( i = 2; i <= N-1; i++ ) { Win(Vi)= sum of weight of incoming edges of Vi if (Win(Vi) > Vout(Vi)) { d1 = leftmost outgoing edge of Vi W(d1) = Win(Vi) – Vout(Vi) + 1 } }**WEIGHT-BALANCING REGULAR PSLG (cont)**3. Second pass For (i = N-1; i >= 2; i--){ Wout(Vi) = sum of weight of outgoing edges of Vi if (Wout(Vi) > Win(Vi)) { d2 = leftmost incoming edge of Vi W(d2) = Wout(Vi) – Win(Vi) + W(d2) } }**1**1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Example: Initialization**1**1 1 1 1 1 1 1 1 1 1 1 1=1 4>2 1<3 1 1 1=1 2=2 3>2 2>1 1 1 Example: 1st pass X 2 3 X X 2 if (Win(Vi) > Vout(Vi)) { d1 = leftmost outgoing edge(Vi) W(d1) = Win(Vi) – Vout(Vi) + 1 }**1**2 4=4 1=1 3>1 3 1 1 2 1 1 1 1 1 1 1 1 2=2 1=1 2=2 3=3 1 1 Example: 2nd pass 3 X if (Wout(Vi) > Win(Vi)) { d2 = leftmost incoming edge (Vi) W(d2) = Wout(Vi) – Win(Vi) + W(d2) }**1**2 3 1 1 2 1 1 1 1 1 1 1 1 3 1 Example: final result