Computational Geometry

25
Computational Geometry Piyush Kumar (Lecture 10: Point Location) Welcome to CIS5930

description

Computational Geometry. Piyush Kumar (Lecture 10: Point Location). Welcome to CIS5930. Planar Point Location. Given a polygonal subdivision of the plane (a PSLG) , Preprocess to answer which face a query point lies in. Assume Input has n vertices. Step 1. Triangulate. Step 2. - PowerPoint PPT Presentation

Transcript of Computational Geometry

Page 1: Computational Geometry

Computational Geometry

Piyush Kumar(Lecture 10: Point Location)

Welcome to CIS5930

Page 2: Computational Geometry

Planar Point Location

Given a polygonal subdivision of the plane (a PSLG) , Preprocess to answer which face a query point lies in.

Assume Input has n vertices.

Page 3: Computational Geometry

Step 1

Triangulate

Page 4: Computational Geometry

Step 2

Put the input in a large triangle and triangulate.

Page 5: Computational Geometry

Timing

How much time did you spend yet? Any ideas on how to locate a given point in such a subdivision? Notice that each face is a triangle now, including the face containing the point at infinity.

Page 6: Computational Geometry

By the way

Kirkpatrick’s subdivision hierarchy method for performing point location in planar graphs is also applicable In higher dimensions Amenable to parallelization Uses? Many, Collision detection in 3D? Beware: The algorithm has large constants.

Page 7: Computational Geometry

Subdivision Hierarchy

Start with triangulated PSLG T0

Produce a sequence of triangulations T0, T1, T2, … Tk where k=O(log n) such that Tk contains a single triangle

Each triangle in Ti+1 overlaps only a constant number of triangles in Ti.

Page 8: Computational Geometry

Subdivision hierarchy

Courtesy Goodrich,Ramaiyer.

T0

T5

Page 9: Computational Geometry

Search Structure: Layered DAG

T0

T3

Page 10: Computational Geometry

Observations

1. The degree of each node is O(1)

2. A fraction of the nodes are removed at each step. Hence the total depth of the DAG is O(log n).

Page 11: Computational Geometry

Obsevation 1

Constant degree Observation When we delete a node with degree

d, there is a hole of size d vertices which we can re-triangulate (with d-2 triangles). Each of the new triangles can overlap only d triangles in the previous triangulation.

TrivialExample:

Page 12: Computational Geometry

Observation 2

Independent Set : No two vertices that are deleted are adjacent to each other (the vertices to be deleted form an independent set in the current graph Ti.

White nodes are the one to be deleted next.

Page 13: Computational Geometry

Observation 2

Independent set removal: Is easy. These vertices create independent holes that can be triangulated independently of each other. Note that the size of these holes is O(1).

Maximum size hole created in this example is 4.

Page 14: Computational Geometry

Independent set

We need to make sure that we have large independent set of vertices with bounded (O(1)) degree in a triangulated planar graph. We want to remove a fraction of the vertices at each step. Hence the total number of layers in the DAG will be O(log n).

Page 15: Computational Geometry

Kirkpatrick’s Method

1. Find a maximal independent set in the PSLG such that the degree of the vertices is bounded by O(1).

2. Remove vertices of the independent set from the PSLG and re-triangulate (the holes)

3. Repeat the process until only the outer face remains.

Maximal Ind. Set : A set of independent vertices of a graph G suchthat no new vertex can be added to this set keeping the independence property

Page 16: Computational Geometry

John Iacono’s Demo

Page 17: Computational Geometry

Search for Maximal independent set

Lemma: Given a planar graph with n vertices, there is an independent set consisting of vertices of degree at most 8, with at least n/18 vertices. This independent set can be constructed in O(n) time.

See page 106 of Dr. Mount’s Lecture notes

Page 18: Computational Geometry

Average degree of a vertex

Page 19: Computational Geometry

Average degree of a vertex

Hence, average degree of a vertex < 6.

Page 20: Computational Geometry

At least n/2 vertices of degree <= 8

Proof by contradiction : Let there be more than n/2 vertices of

degree 9 or greater. The other vertices must have degree > 3 (Assuming n > 3).

Hence average degree now would be ( 9n/2 + 3n/2 ) / n = 6.

This is a contradiction since average degree should be < 6.

Page 21: Computational Geometry

Search Algorithm for Maximal independent set

Mark all nodes with degree >= 9 Note: At least n/2 unmarked nodes.

While there exists an unmarked node Choose unmarked vertex v Add v to independent set Mark v and all its neighbors.

oNote: At most 9 vertices marked.

How many times can we run this loop before we run out of unmarked vertices?

(n/2)/9 = n/18

Page 22: Computational Geometry

Search Algorithm for Maximal independent set

Note that in each iteration of the loop we add one vertex in our independent set. So we get at least a n/18 size independent set with degree of vertices <= 8 in it. (Proves our main lemma). Why does this run in O(n) time?

Page 23: Computational Geometry

Height of the DAG?

At each successive level, the number of vertices falls by a factor of (17/18)n. Hence the total height of the DAG is k = log18/17n = O(log n)

What about total space taken by the data structure? O(n)

Why? In each level you reduce the size of the data by a constant fraction

Page 24: Computational Geometry

Size of the data structure

Size proportional to total number of triangles Number of triangles in each layer proportional to the number of vertices. Sum of number of vertices

Page 25: Computational Geometry

Summary

Space required by DAG = O(n)Query Time: O(log n)Preprocessing time: O(n)