Presentation is loading. Please wait.

Presentation is loading. Please wait.

EECS 4101/5101 Prof. Andy Mirzaian. References: [M. de Berge et al ’00] chapter 3 [Preparata-Shamos’85] chapter 6 [O’Rourke’98] chapter 1 [M. de Berge.

Similar presentations


Presentation on theme: "EECS 4101/5101 Prof. Andy Mirzaian. References: [M. de Berge et al ’00] chapter 3 [Preparata-Shamos’85] chapter 6 [O’Rourke’98] chapter 1 [M. de Berge."— Presentation transcript:

1 EECS 4101/5101 Prof. Andy Mirzaian

2 References: [M. de Berge et al ’00] chapter 3 [Preparata-Shamos’85] chapter 6 [O’Rourke’98] chapter 1 [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). ... 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

3 Polygon Triangulation Guarding and Art Gallery 3

4 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. 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

5 A simple polygon P 5

6 A triangulation of P 6

7 Dual Tree of the Triangulation 7

8 Diagonal of a simple polygon P: Any line-segment between two non-adjacent vertices of P that is completely inside P. yes no 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

9 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 in O(n) time, and divides P into simple polygons P 1 & P 2 with, say, n 1 & n 2 vertices, where d is an edge of both. Note, n = n 1 +n Triangulations T 1 & T 2 of P 1 & P 2 can be obtained recursively. Now set T = T 1  T 2 with d as an extra diagonal. Total computation time: Time(n) = Time(n 1 ) + Time(n 2 ) + O(n) = O(n 2 ). By induction hypothesis: T 1 has n 1 –3 diagonals and n 1 –2 triangles, T 2 has n 2 –3 diagonals and n 2 –2 triangles, These imply: T has n–3 diagonals and n–2 triangles. P1P1 P2P2 P d THEOREM 2 Any simple n-gon P admits at least one Triangulation. Such a triangulation T can be computed in O(n 2 ) time. Any such triangulation has n-3 diagonals, and n-2 triangles. 9

10 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 R B 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

11 Geodesic Shortest Paths inside polygon 11

12 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

13 Geodesic Shortest Paths inside polygon Single-source shortest paths: Do a DFS on dual tree of the triangulation and maintain the visibility funnel for the frontier diagonal. source 13

14 Geodesic Shortest Paths inside polygon Single-source shortest paths source 14

15 Geodesic Shortest Paths inside polygon Single-source shortest paths source 15

16 Simple Polygon Triangulation Algorithms O(n 2 ) timeSee Theorem 2. Also by “ear removal”, Lennes O(n log n)Garey-Johnson-Preparata-Tarjan (plane sweep) O(n log log n)Tarjan-van Wyk (balanced-cut & Jordan-sort) O(n log* n) randomizedClarkson-Tarjan-van Wyk O(n)Chazelle [Complicated. Can it be simplified?] O(n) randomizedAmato-Goodrich-Ramos [1]1 O(n 2 ) timeSee Theorem 2. Also by “ear removal”, Lennes O(n log n)Garey-Johnson-Preparata-Tarjan (plane sweep) O(n log log n)Tarjan-van Wyk (balanced-cut & Jordan-sort) O(n log* n) randomizedClarkson-Tarjan-van Wyk O(n)Chazelle [Complicated. Can it be simplified?] O(n) randomizedAmato-Goodrich-Ramos [1]1 16

17 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? 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

18 Exercises 18

19 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

20 6.Polygon Area: Prove the following fact about the algebraic area of a simple polygon as stated in Lecture Slide 10: 7.Polygon Triangulation by Horn Cutting: We are given a simple n-gon P = [ p 0, p 1,..., p n-1 ]. We want to find a triangulation T(P) of P by a horn-cutting method. A horn of P is any vertex p i of P, such that (the interior of) P contains (the interior of) triangle (p i-1, p i, p i+1 ) formed by p i and its two neighboring vertices p i-1 and p i+1 (index arithmetic is done mod n). We can cut this horn by removing vertex p i from the sequence of polygon vertices, resulting in a sub-polygon P' with n-1 vertices. The line-segment (p i-1 p i+1 ) now becomes an edge of the new polygon P'. We say we have cut the horn p i (or the horn-triangle (p i-1, p i, p i+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(n 2 ) time algorithm to compute a triangulation T(P) of simple polygon P by an iterative horn-cutting process. 20

21 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 d c b a D’ d c b a flip D 21

22 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".] a b 22

23 END 23


Download ppt "EECS 4101/5101 Prof. Andy Mirzaian. References: [M. de Berge et al ’00] chapter 3 [Preparata-Shamos’85] chapter 6 [O’Rourke’98] chapter 1 [M. de Berge."

Similar presentations


Ads by Google