cse 4101/5101

23
EECS 4101/5101 Prof. Andy Mirzaian

Upload: giolla

Post on 24-Feb-2016

68 views

Category:

Documents


1 download

DESCRIPTION

CSE 4101/5101. Prof. Andy Mirzaian. Polygon Triangulation. References:. [M. de Berge et al ’00] chapter 3 [Preparata-Shamos’85] chapter 6 [O’Rourke’98] chapter 1. Applications : Graphics: Ray Shooting Robotics: Geodesic Shortest Paths inside polygon, visibility - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSE 4101/5101

EECS 4101/5101

Prof. Andy Mirzaian

Page 2: CSE 4101/5101

References: • [M. de Berge et al ’00] chapter 3• [Preparata-Shamos’85] chapter 6• [O’Rourke’98] chapter 1

Applications: Graphics: Ray Shooting Robotics: Geodesic Shortest Paths inside polygon, visibility GIS: Planar Point Location GIS: Elevation estimate on polyhedral terrain GIS: Piece-wise linear interpolation of bi-variate function f(x,y). . . .

2

Page 3: CSE 4101/5101

Polygon TriangulationGuarding and Art Gallery

3

Page 4: CSE 4101/5101

Art Gallery Problem [Victor Klee 1973]

How many camera guards do we need to guard a given gallery and how do we decide where to place them?

• It’s NP-hard to determine the MINIMUM number of camera guards for an arbitrary given simple polygon [Aggarwal 1984].

• Let P be an n-vertex simple polygon.

• If P is convex, then a single guard anywhere inside P is sufficient.

• n guards for P are always sufficient; one guard at each vertex. [This does not work for 3D polytopes!]

• Can we use less than n guards? Yes. Use Triangulation of P.

4

Page 5: CSE 4101/5101

A simple polygon P

5

Page 6: CSE 4101/5101

A triangulation of P

6

Page 7: CSE 4101/5101

Dual Tree of the Triangulation

7

Page 8: CSE 4101/5101

Diagonal of a simple polygon P: Any line-segment between two non-adjacent vertices of P that is completely inside P.

yesno

Proof: Let x be any convex vertex of the polygon (e.g., an extreme vertex, say, the lowest-leftmost).

(case a) yz is a diagonal (case b) xw is a diagonal

x

y

z

x

y

z

w

max[Shaded triangle does not contain any vertex of the polygon]

LEMMA 1 Any simple n-gon with n>3 admits at least one diagonal. Such a diagonal can be found in O(n) time.

8

Page 9: CSE 4101/5101

Proof: By induction on n.

Basis (n=3): Obvious.

Ind. Step (n>3): By previous Lemma, a diagonal d of P exists and can be found inO(n) time, and divides P into simple polygons P1 & P2 with, say, n1 & n2 vertices, where d is an edge of both. Note, n = n1+n2 -2.

Triangulations T1 & T2 of P1 & P2 can be obtained recursively.Now set T = T1T2 with d as an extra diagonal.

Total computation time: Time(n) = Time(n1) + Time(n2) + O(n) = O(n2).

By induction hypothesis: T1 has n1–3 diagonals and n1–2 triangles, T2 has n2–3 diagonals and n2–2 triangles,These imply: T has n–3 diagonals and n–2 triangles.

P1P2

P

d

THEOREM 2 Any simple n-gon P admits at least one Triangulation. Such a triangulation T can be computed in O(n2) time. Any such triangulation has n-3 diagonals, and n-2 triangles.

9

Page 10: CSE 4101/5101

Sufficiency:1. T = a triangulation of the n-gon.2. 3-colour vertices of T (so that the vertices of each triangle get 3 different colours).

This can be done (implicitly) by a DFS traversal on the dual tree of T.3. Choose a colour least often used (break ties arbitrarily).4. Place a guard at the vertices of the chosen colour. (Each triangle has a guard.)

G

R=4 B=3 G=4

R

R

R

RB

B

B

G

G

G

THEOREM 3 [Chvătal 1975, Fisk 1978] n/3 guards are always sufficient and sometimes necessary to

guard any simple n-gon.

Proof: Necessity:

10

Page 11: CSE 4101/5101

Geodesic Shortest Paths inside polygon

11

Page 12: CSE 4101/5101

Geodesic Shortest Paths inside polygon

A shortest path: Walk along the path of the dual tree from triangle of A to B.

A

B

12

Page 13: CSE 4101/5101

Geodesic Shortest Paths inside polygon

Single-source shortest paths: Do a DFS on dual tree of the triangulationand maintain the visibility funnel for the frontier diagonal.

source

13

Page 14: CSE 4101/5101

Geodesic Shortest Paths inside polygon

Single-source shortest paths

source

14

Page 15: CSE 4101/5101

Geodesic Shortest Paths inside polygon

Single-source shortest paths

source

15

Page 16: CSE 4101/5101

Simple Polygon Triangulation Algorithms

• O(n2) time See Theorem 2. Also by “ear removal”, Lennes 1911.

• O(n log n) Garey-Johnson-Preparata-Tarjan (plane sweep) 1978.

• O(n log log n) Tarjan-van Wyk (balanced-cut & Jordan-sort) 1986-88.

• O(n log* n) randomized Clarkson-Tarjan-van Wyk 1989.

• O(n) Chazelle 1991. [Complicated. Can it be simplified?]

• O(n) randomized Amato-Goodrich-Ramos 2000. [1]

16

Page 17: CSE 4101/5101

Proof: Triangulate P. Dual graph is not a tree.Use h of the diagonals to connect the holes and the outer boundary of P. Double-up these h diagonals to open up narrow corridors.We now have a simple polygon with n+2h vertices. Now apply Theorem 3.

If you do a DFS of the non-tree dual graph, you get a DFS tree, plus h back-edges.

How can you deal with these back-edges that would correspond to opening corridors?

THEOREM 4 [Art Gallery Theorem for polygons with holes] A polygon P with h polygonal holes and n vertices (including vertices of the holes)can be guarded with (n+2h)/3 guards.

17

Page 18: CSE 4101/5101

Exercises

18

Page 19: CSE 4101/5101

1. Give a simple linear time algorithm to triangulate any given star polygon.Assume a kernel point of the polygon is available.

2. Guarding the walls: Construct a simple polygon P and a placement of guards such that the guards see every point of the boundary of P, but there is at least one point interior to P not seen by any guard.

3. Visibility: Consider an arbitrary simple polygon P. Two points a and b in P (i.e., in the interior or boundary of P) are visible from each other if the line-segment ab does not intersect the exterior of P.(a)  Prove or disprove: Let v be any point in P such that every vertex of P is visible from v. Then every point in P is also visible from v. (b) Prove or disprove: Let v and w be any pair of points in P such that every vertex of P is visible from v or w. Then every point in P is also visible from v or w.

4. Suppose that a simple polygon P with n vertices is given, together with a set of diagonals that partition P into convex quadrilaterals. How many point guards are sufficient to guard the interior of P? Why doesn't this contradict the Art Gallery Theorem 3?

5. Balanced Split: Let P be any simple polygon with n vertices. A diagonal d of P is said to be a balanced diagonal, if it splits P into two simple polygons, each with at most 2n/3 + 1 vertices.(a) Show that any simple polygon has a balanced diagonal.(b) Show the bound 2n/3 + 1 is tight, i.e., for every n>2, there are simple n-gons that have no diagonal that splits the polygon with both sides containing less than 2n/3 + 1 vertices each. (c) Give an O(n log n) time algorithm to find a balanced diagonal of P. [Hint: Use the dual graph of a triangulation. This has applications in divide-&-conquer algorithms.]19

Page 20: CSE 4101/5101

6. Polygon Area: Prove the following fact about the algebraic area of a simple polygon as stated in Lecture Slide 10:

).pp,pp,originOwhere(

)yy(x)yxyx()p,p,O()P(2

n011n

n

1i1i1ii

n

1ii1i1ii

n

1i1ii

A

7. Polygon Triangulation by Horn Cutting: We are given a simple n-gon P = [ p0 , p1, ..., pn-1]. We want to find a triangulation T(P) of P by a horn-cutting method. A horn of P is any vertex pi of P, such that (the interior of) P contains (the interior of) triangle (p i-1 , pi , pi+1) formed by pi and its two neighboring vertices pi-1 and pi+1 (index arithmetic is done mod n). We can cut this horn by removing vertex pi from the sequence of polygon vertices, resulting in a sub-polygon P' with n-1 vertices. The line-segment (p i-1 pi+1) now becomes an edge of the new polygon P'. We say we have cut the horn pi (or the horn-triangle (pi-1 , pi , pi+1) ) from the simple polygon P.(a) Argue that the sub-polygon P' that results from cutting a horn of P is itself a simple polygon (i.e., it has a non-self-crossing boundary).(b) Prove that any simple polygon P with n > 3 vertices has at least two horn vertices that are non-adjacent.(c) Algorithmically show how in O(n) time we can test whether a given vertex p i is a horn of P.(d) Design and analyze an O(n2) time algorithm to compute a triangulation T(P) of simple polygon P by an iterative horn-cutting process. 20

Page 21: CSE 4101/5101

8. Diagonal Flip in Polygon Triangulation: Let P be a simple polygon with n vertices and T a triangulation of P. Consider a diagonal D=(a,b), incident to two triangles (a,b,c) and (a,b,d) in T. The union of these two triangles is the quadrangle (a,c,b,d). If this quadrangle is convex, then we can flip D to obtain the new diagonal D’=(c,d). This creates a new triangulation T’ where the two triangles (a,b,c) and (a,b,d) are replaced by the two new triangles (c,d,a) and (c,d,b). (See the figure below.). Note that flipping is reversible, i.e., you can go from T’ back to T by flipping D’.Let T and T’ be two arbitrary triangulations of P. We say T is flip-connected to T’, if there is a sequence of zero or more diagonal flips that transforms T to T’. Let the flip-distance, denoted FD(T,T’), be the minimum number of flips required to transform T to T’. FD(T,T’) = if T and T’ are not flip-connected. Flip-connectivity is an equivalence relation on the set of triangulations of P. So, it partitions the set into equivalence classes. (Can there be more than one equivalence class?)(a) Show that if P is a convex polygon, then T,T’, FD(T,T’) = O(n).(b) What if P is a simple polygon? Can there be a pair T, T’ such that FD(T,T’) =? Why or why not? If not, then derive a tight asymptotic upper-bound on FD(T,T’) over all triangulation pairs T and T’ of P.

D dc

b

a

D’dc

b

a

flip D

21

Page 22: CSE 4101/5101

9. Geodesic in a Simple Polygon: The following problem has a number of applications including robot path planning.We are given a simple n-gon P and a triangulation T of P. The triangulation is given by its list of triangles, and their incidence relationship, where two triangles are incident iff they share a common diagonal. We are also given two points a and b inside P. The problem is to find the shortest path from a to b inside P. Such a path is called the geodesic between a and b inside P (see the figure below). Design and analyze an O(n)-time algorithm to solve this problem. [Hint: after locating the triangles that contain a and b, "walk" along the triangles from a to b (which way?), while maintaining the two shortest paths from a to the two ends of the next diagonal on the walk. These two shortest paths form a funnel that encloses a prefix of the final geodesic. Carefully analyze how you update the funnel as you advance from one diagonal to the next on your "walk".]

ab

22

Page 23: CSE 4101/5101

END

23