180 likes | 239 Views
An Introduction to Computational Geometry. Joseph S. B. Mitchell Stony Brook University. Point Location. Point-in-polygon test: Is point q inside simple polygon P ?. Naïve: O(n) per test. CG: O(log n). q. P n- gon. 5 crossings q inside. Point Location. q.
E N D
An Introduction to Computational Geometry Joseph S. B. Mitchell Stony Brook University
Point Location • Point-in-polygon test: Is point q inside simple polygon P ? Naïve: O(n) per test CG: O(log n) q P n-gon 5 crossings q inside
Point Location q Trapezoid under the mouse is highlighted More generally: Search for which face of a planar map contains query point q Example: Map of Manhattan Applet
One Method: Partition the Plane into Slabs Query time : O(log n) binary search in x and then binary search in y direction. Storage space O(n2) n/2 n/2 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Valuable Resources Preprocessing time Memory/storage: how big is the data structure? Query time
Point Location in 1D Given a partition of the x-axis by a set of points {x1 , x2 , …}. Preprocess for location of a query point q: Sort the xi ‘s O(n log n) time, O(n) space, O(log n) query time Can we achieve these same bounds (optimal) in 2D?
An Optimal Method: Kirkpatrick Hierarchical Triangulation • Begin with full triangulation • Remove a “large” set of low-degree ( 8) vertices that are independent (such a set always exists in a planar graph, by Euler) • Retriangulate the resulting “holes” • Repeat until only the big outer triangle remains • Build DAG for searching (no two adjacent) O(n) “large” : Cn only O(log n) iterations
[O’Rourke, page 277] Proof uses Euler’s formula (f-e+v=2) and the fact that each vertex has degree at least 3 in our graph G.
Proof of Theorem 7.10.1 Contradicts ∑ ≤ 6n-12 • Sum of vertex degrees = ∑= 2E • Recall: in a planar n-vertex graph: E≤3n-6 • Thus, ∑ ≤ 6n-12 • Claim: There are ≥n/2 vertices of degree ≤8 • Pf: Assume there are > n/2 vertices of deg ≥9 Then, sum of degrees of these is ≥ 9n/2, and the other vertices have deg ≥3, so the total degree sum, ∑, would satisfy: ∑ ≥ 9n/2+3n/2=6n
Independent Set Algorithm • Input: planar graph G • Output: an independent set I of vertices of low degree (≤ 8) • I ←Ø • Mark vertices of G of degree ≥ 9 • While some nodes are unmarked, do • Choose an unmarked vertex v (lowest index) • Mark v and all neighbors of v • I ←I {v}
Analysis of Algorithm Initially: the unmarked vertices are those with deg≤8. Each time we mark v, and the neighbors of v, the number of unmarked nodes goes down by at most 9 Thus, at least 1/9-th of the m unmarked (deg ≤8) vertices are added to I We know m ≥ n/2 Thus, I ≥ n/18 Thus, the Algorithm always gives an independent set of deg ≤8 vertices of size ≥ n/18
Kirkpatrick Example Full triangulation, T0 Triangles in T0
T0 Independent sets: {2,5} {3,7} {4} {6} T1
T2 T3 Independent sets: {2,5} {3,7} {4} {6} Final DAG hierarchy and search path for query point p T4
Another Example 4 Build Kirkpatrick hierarchy, for extra practice. (note that vertex 2 has “high” degree) 10 5 2 8 9 3 6 1 7
Detecting if a unit disk contains a site: Why locating in Delaunay is not enough
Example 4 cocircular points, but Delaunay diagram is a triangulation