Title: Point Location Problem for Polygon and Planar Subdivision'
1Point Location Problem for Polygon and Planar
Subdivision.
- I4B05 ???
- I4B18 ???
- Ref
- Computational Geometry, Chap. 6 Preparata and
Shamos, Chap. 2
2Point Location Problem in Polygon
- Given a polygon P and a point z, determine
whether or not z is internal to P.
3Point Location Problem in Polygon
- The single-shot approach
- Division Wedges for Convex Inclusion
4The single-shot approach
Assume A horizontal line L intersects
polygon P, but L doesnt pass though any vertex
of P.
5The single-shot approach
- Algorithm
- Begin CL 0
- For i 1 until N do if edge ( i ) is not
horizontal then - if( lower extreme of edge ( I )
intersects L to the left of z ) - then L 1 then L L 1
- if( L is odd) then z is internal else z is
external - End.
6The single-shot approach
- Whether a point Z is internal to a simple N-gon P
can be determined in O( N ) time, without
preprocessing. - The result holds for nonconvex polygons as well.
7Division Wedges for Convex Inclusion
- The method relies on the convexity of P.
- Treating Q as the origin of polar coordinates.
- The vertices of a polygon occur in angular order
about any internal point Q.
8Division Wedges for Convex Inclusion
P2
P3
P4
P
P1
Z
Q
P5
P7
P6
9Procedure
- 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 Pi1. - 3.Once Pi and Pi1 are found, then Z is internal
if and only if ( Pi Pi1 Z ) is a left turn .
10Division Wedges for Convex Inclusion
- 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.
11A star-shaped polygon
P3
P2
Z
P4
P1
Q
P5
P
P7
P6
12A star-shaped polygon
- 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.
13Point Location in a planar subdivision
- The slab method
- The chain method
- The triangulation refinement method
14The slab method
- Draw vertical lines through all vertices of the
subdivision, as in figure. This partitions the
plane into vertical slabs.
15The slab method
- All edges intersecting a slab
- Have no endpoint in the slab
- Dont cross each other
16The slab method
- Sort slabs in ascending x-coordinates.
- Store the segments crossing the interval ordered
from top to bottom. - Give a query point z.
- Use binary search to determine the slab
- by x-coordinates.
- Use binary search to determine the face
- by point-line discrimination.
17Worst Case in Storage
18The slab method
- Point-location in an N-vertex planar subdivision
can be effected in O( log N )time using O( N2 )
storages.
19The Chain Method
- Definition
- A chain C ( u1, , up ) is a planar
straight-line graph (PSLG) with vertex set u1,
, up and edge set (ui, ui1) i 1, ,
p-1
U1
U3
U2
U5
U6
U4
U8
U7
20The Monotone Chain
- 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. - The orthogonal projections L(u1) , , L(up)
of the vertices of C on L are ordered as L(u1) ,
, L(up) .
21Where does the query point lie?
U2
U1
P
U4
U3
U5
22A query point lies ?
- The projection of P on L can be located with a
binary search in a unique interval ( L(ui),
L(ui1) ) - Determine on which side of the line containing
uiui1 the query point lies.
P
U1
U2
L(u1)
U4
U3
L(u2)
L(P)
U5
L(u3)
L(u4)
L(u5)
L
23The Chain Method
- Suppose there is a set C C1, , Cr of a
polygon, we can apply the bisection to find the
region query point lies. - PS. C1, , Cr respect to y-axis.
C2
C1
C3
C6
C4
C5
24The Chain Method
- If there are r chains in C and the longest chain
has p vertices, then the search worst-case time
is O( log p log r )
25PSLG Transform into Chains
- 1. Regularize the PSLG.
- 2. Assign weights on the graph using
weight-balancing algorithm. - 3. Construct chains with respect to y-axis by
traversing the graph.
26Definition Regular Graph
- Let G be a PSLG with vertex set v1, ..., vN ,
where the vertices are indexed so that i lt j if
and only if either y(vi) lt y(vj) or, if y(vi)
y(vj), then x(vi) gt x(vj). A vertex vj is said to
be regular if there are integers i lt j lt k such
that ( vi, vj ) and ( vj, vk ) are edges of G. - Graph G is said to be regular if each vj is
regular for 1 lt j lt N. - With the exception of the two extreme vertices v1
and vN.
27Regularize Nonregular Vertices (remove cusps)
- Definition cusp
- Sweep-line to remove cusps
- Connect to the upper end point of the lower
neighbor - The connection does not cross any edge of G.
28Example 1 Remove cusps
29Example 2 Remove cusps
30Remove cusps
- Regularization of an N-vertex PSLG is
accomplished in time O(N log N), due to the
possible initial sorting of vertex ordinates and
to location of N vertices in the status structure
, each at O( log N) cost.
31Weight Assignment of Edges
- All edges satisfy
- 1. Each edge has positive weight
- 2. For each Vj( j ?1, N ),
- Win(Vj) Wout(Vj)
-
Vin( Vi ) IN(v)
Vout( Vi ) OUT(v)
32WEIGHT-BALANCING REGULAR PSLG
- 1. Initialization
- Begin for each edge e do W(e) 1
- 2. First pass
- for( i 2 i lt N-1 i )
- Win(Vi) sum of weight of incoming edges of Vi
-
- if (Win(Vi) gt Vout(Vi))
- d1 leftmost outgoing edge of Vi
- W(d1) Win(Vi) Vout(Vi) 1
-
33- 3. Second pass
- For (i N-1 i gt 2 i--)
- Wout(Vi) sum of weight of outgoing edges of Vi
- if (Wout(Vi) gt Win(Vi))
- d2 leftmost incoming edge of Vi
- W(d2) Wout(Vi) Win(Vi) W(d2)
-
-
34Example 1 1. Initialization
1
1
1
1
1
1
1
352. The first pass
1
X 2
1
1
1
1
1
1
363. The second pass
2
1
1
1
1
1
1
2 X
37Construct chains
2
X 1
X 0
1
X 0
1
0 X
1
X 0
1
0 X
1
X 0
2
1 X
0 X
38PSLG and Monotone Chains
39Example 2 1. Initialization
402. The first pass
X 2
3 X
X 2
413. The second pass
3 X
42Construct chains
Start from top traverse the leftmost possible
branch
2
X 1
X 0
1
0 X
3
2 X
1 X
0 X
1
0 X
1
X 0
0 X
1
1
2
0 X
X1
X0
X 0
1
1
X 0
1
1
X 0
X 0
0 X
1
0 X
1
3
2 X
1 X
0 X
1
X 0
43PSLG and Monotone Chains
44The chain method
- Time complexity O( log2 N )
- Space complexity O( N )
- Preprocessing time ( Regularization ) O( N log N
)