Title: Geometric Computing and Visualization 8
1Geometric Computing and Visualization 8
2Point Location Problem
- Given a polygon P and a query z, is it z?P?
- Given a planar subdivision P and a query z, is it
z?P? - The difficulty of the task will essentially
depend upon the nature of the space and its
partition.
3Query Mode
- Two modes of queries
- One shot mode query Whether a point q is
internal to a simple n-gon P can be determined in
optimal O(n) time, without preprocessing. - Repetitive mode queries If we preprocess the
data structure, the query may be done in o(n)
time.
4Location of a Point in a Polygon 3
- Given a polygon P and a query z, is q internal to
P? - P is convex polygon
- P is star-shaped polygon P is star-shaped if
there exists a pt q?P st ? points r, r is visible
from q. (Question How do we determine if a
polygon is star-shaped?) - P is general polygon
- Kernel of a simple polygon
5Location of a Point in a Polygon 2
- The inclusion question for an n-vertex
star-shaped polygon can be answered in - Q(n) O(log n)
- S(n) O(n)
6Location of a Point in a Polygon 1
- Convex ? Star-shaped ? General
- What can we say for general case?
7Planar-straight-line graph 3
- Planar-straight-line graph(PSLG) G(V,E) is a
PSLG if each edge is a straight-line segment no
edges intersect except possibly at the end pts. - A planar graph can always be embedded in the
plane so that its edges are mapped to
straight-line segments.
EO(V) FO(V)
Eulers formula V-EF2
of edges E 3(V-1)-B, of bounded faces
F2(V-1)-B
8Planar-straight-line graph 2
- Representation
- Adjacent list (all vertices link to their
adjacent vertices, and all regions link to their
adjacent edges in counterclockwise order) - Doubly-connected edge list (all edges record 1.
Two end point, 2. Two adjacent regions, 3. Two
previous edges in each region in counterclockwise
order.)
9Planar-straight-line graph 1
v7
v8
e4
v9
v6
f1
v1
e2
f4
f3
e1
e3
v10
v2
v5
V11
f2
e5
v3
v4
10Location of a point in a planar subdivision
- Slab method
- S(n) O(n2)
- Q(n) O(log n)
- Chain method
- S(n) O(n)
- Q(n) O(log2n) ? O(log n)
- Triangulation refinement method
- S(n) O(n)
- Q(n) O(log n)
11Slab method
- Slab method achieves efficient searching by
decomposing the original subdivision into
trapezoids. - S(n)O(n2), Q(n)O(log n)
- Goal S(n)O(n), Q(n)O(log n)
12Chain method 18
- Chain method decomposes the subdivision into
monotone polygons.
13Chain method 17
- Definition chain
- A chain C (u1, , up) is a PSLG with vertex
set u1, , up and edge set (ui, ui1)
i1,p-1
14Chain method 16
- Given PSLG G. Suppose that in G we find a chain C
of one of the following types either (1) C is
cycle (2) both u1 and up of C belong to the
boundary of the unbounded region. - In both cases C partitions the subdivision
into two portions. - How to decide on which side of C a query point z
lies called discrimination of z against C? - To discriminate against an arbitrary chain is
basically the same problem as to test for
inclusion in a general polygon. Thus, one should
look for a restricted class of chains. -
15Chain method 15
- Definition monotone
- A chain C (u1, , up) is said to be monotone
w.r.t. a straight line l if a line orthogonal to
l intersects C in exactly one point. - Given a monotone chain C, the orthogonal
projections l(u1), , l(up) of the vertices of
C on l are ordered. -
l(u5)
16Chain method 14
- Given monotone chain C a query point z
- the projection l(z) of z on l can be located by
binary search in a unique interval (l(ui),
l(ui1)). - An O(1) test determines on which side of the line
uiui1 the query point z lies. - ? The discrimination of z against a p-vertex
monotone chain is effected in O(log p) time
17Chain method 13
- Definition monotone complete set of chains of G
- Given is a PSLG G. A set of chains C C1, ,
Cr monotone w.r.t the same line l with the
properties - Property1 The union of the members of C contains
G - Property2 For any two chains Ci and Cj of C,
the vertices of Ci which are not vertices of Cj
lie on the same side of Cj. - is referred to as a monotone complete set of
chains of G - Note that Property2 means that the chains of a
complete set are ordered.
18Chain method 12
- For a monotone complete set C of chains of PSLG
G we can easily locate a point between two
consecutive chains and the region in O(log p?log
r) by binary search, where r is the of chains
in C, and p is the of vertices in the longest
chain.
19Chain method 11
- But a crucial question is Given PSLG G, does it
admit a monotone complete set of chains? How do
we find it ? In general, the answer is NO. - A Regular PSLG admits of a monotone complete set
of chains. - An arbitrary PSLG can be transformed into a
regular PSLG.
20Chain method 10
- Definition regular PSLG
- Given PSLG G with vertex set v1, , vn, where
the vertices are indexed so that i lt j iff either
y(vi) lt y(vj) or, if y(vi)y(vj), then x(vi) gt
x(vj). - A vertex vj is regular if there are integers
iltjltk such that (vi, vj) and (vj, vk) are edges
of G. - Graph G is said to be regular if each vj is
regular for 1ltjltn (i.e. with the exception of the
two extreme vertices v1 and vn)
21Chain method 9
- A regular PSLG admits of a monotone complete set
of chains - Claim1 Show that a regular graph admits of a
complete set of chains monotone w.r.t the y-axis.
- Claim2 Show edge weight can be chosen so that
- Each edge has a positive weight
- For each vj (j?1,n), WIN(vj)WOUT(vj)
22Chain method 8
- Claim1 Show that a regular graph admits of a
complete set of chains monotone w.r.t the y-axis.
- Proof
- To prove that there is a set CC1, , Cr of
chains monotone w.r.t y-axis, we only need to
show that, for any vj(1ltj?n), we can construct a
y-monotone chain from v1 to vj. - trivial for j2. Assume the statement is true for
kltj. - Since vj is regular, there is some iltj such that
(vi , vj) is an edge of G. But, by inductive
hypothesis, there is a chain C from v1 to vi
monotone w.r.t the y-axis. The concatenation of C
and (vi , vj) is a y-monotone chain.
23Chain method 7
- Claim2 Show that edge weight can be chosen so
that - (1) Each edge has positive weight. Condition (1)
ensures that each edge belongs to at least one
chain (Property1) - (2) For each vj (j?1,n), WIN(vj)WOUT(vj).
Condition (2) guarantees that WIN(vj) chains pass
through vj and they can be chosen so that they do
not cross (Property2)
24Chain method 6
- Proof
- Let W(e), the weight of e, be the of
chains to which e belongs. - Let WIN(v) ?e?IN(V) W(e)
- Let WOUT(v) ?e?OUT(V) W(e)
- The realization of WINWOUT is a rather
classical flow problem, and can be achieved by
two passes over G. - Assign W(e)1 for all e.
- In the first pass from v1 to vn we achieve
WIN ? WOUT for non-extreme vj. - In the second pass from vn to v1 we achieve
WIN ? WOUT for non-extreme vj.
25Chain method 5
- Procedure Weight-Balancing In Regular PSLG
- for each edge e do W(e)1 //Initialization
- for i 2 until n-1 do //first pass
- WOUT(vi)sum of weights of outgoing edges
of vi - WIN(vi)sum of weights of incoming edges
of vi - d1 leftmost incoming edge of vi
- if (WOUT(vi) gt WIN(vi) )
- then W(d1) WOUT(vi) - WIN(vi) W(d1)
- for i n-1 until 2 do //second pass
- WOUT(vi)sum of weights of outgoing edges
of vi - WIN(vi)sum of weights of incoming edges
of vi - d2 leftmost outgoing edge of vi
- if (WIN(vi) gt WOUT(vi) )
- then W(d2) WIN(vi) - WOUT(vi) W(d2)
26Chain method 4
27Chain method 3
- Theorem A n-vertex PSLG can be regularized in
time O(n log n) and space O(n) - Proof Regularization of an n-vertex PSLG is
accomplished in time O(n log n) by plane sweep
method
28Chain method 2
(b)
(a)
(c)
Complete set of monotone chains (a) is searched
according to the hierarchy expressed by a binary
tree (b). Bypass pointers are shown as broken
lines (c).
29Chain method 1
- Chain method
- (S(n), Q(n))(O(n2), O(log2n)).
- Chain method Bypass pointer technique
- (S(n), Q(n))(O(n), O(log2n)).
30Triangulation Refinement Method 9
- Input triangulated PSLG (Any PSLG can be
converted into a triangulation in O(nlogn) time) - Step 0 Inscribe the triangulation by a big
triangle and obtain a new triangulation G.
31Triangulation Refinement Method 8
- Construct a sequence of triangulations S1, S2, ,
Sh(n), where S1 G and Si is obtained from Si-1
as follows - Step 1 Remove a set of independent (i.e.
nonadjacent) non boundary vertices of Si-1 and
their incident edges. - Step 2 Re-triangulate the polygons arising from
the removal of vertices and edges. - Repeat steps 1 2 until Sh(n) is a triangle, the
inscribing triangle.
32Triangulation Refinement Method 7
33Triangulation Refinement Method 6
34Triangulation Refinement Method 5
- Relation between triangles of Si-1 and
- those of Si. Rk?Si,Rj?Si-1.
- A directed edge from Rk to Rj if
- Rj is eliminated from Sj-1 in Step1.
- Rk is created in Si in Step2.
- Rj ? Rk ? ?.
35Triangulation Refinement Method 4
- Once T is available, we perform point location in
Sh(n),,S1 in that order - Procedure Point-Location
- if (z?Triangle(root))
- then z belongs to unbounded region
- else v root
- while (?(v)??) //?(v) a list of
descendants of a node v - for each u??(v) do
- if (z?Triangle(u)) then vu
- print v
36Triangulation Refinement Method 3
- The choice of the set of triangulation vertices
to be removed in constructing Si from Si-1 is
crucial to the performance of the technique. - Suppose we are able to choose this set so that
the following properties hold Let Ni denote the
of vertices of Si - Property1 Ni ?iNi-1 with ?i ? ? lt 1 for i 1,
2, , h(n). - Property2 Each triangle Rj?Si intersects at most
H triangles in Si-1 ,and vice versa.
37Triangulation Refinement Method 2
- Property1 implies h(n) ? ?log1/?n? O(logn)
- ? Q(n) O(log n)
- Properties 12 would jointly imply O(n) storage
- Property1 implies O(n) nodes
- Property2 implies O(n) pointers
- ? S(n) O(n)
38Triangulation Refinement Method 1
- How to remove vertices so that both properties
hold? - Remove a set of nonadjacent vertices of degree
less than k. - Proof
- (1) Since removal of a vertex of degree k gives
rise to polygon with k edges, each of the
replaced triangle in Si intersects at most k-2
new triangles in Si-1. - (2) Euler formula vf-e2
- vn, f2n-5
- ? e3n-7
- ? The total vertex degrees lt 6n
- This implies that there are at least n/2
vertices of degree less than 12. - Let k 12
- Let m denote the of vertices removed.
-
- ? ? 1 1/24 lt 0.959 lt 1
-