Presentation is loading. Please wait.

Presentation is loading. Please wait.

Feb 20111 Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering.

Similar presentations


Presentation on theme: "Feb 20111 Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering."— Presentation transcript:

1 Feb 20111 Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering

2 Feb 20112 Definitions

3 Feb 20113 There are no holes in a simple polygon. Simple polygon Nonsimple polygons

4 Feb 20114 The Art Gallery Problem How many stationary guards are needed to guard a room? Guards are located at fixed points and have 2π range of visibility. A guard cannot see through walls. A set of guards covers a polygon if every point of the polygon is visible to some guard. Problem: Find the max over all n-vertex polygons of the min number of guards needed to cover the polygons.

5 Feb 20115 This 12-vertex polygon needs 4 guards to cover it This 12-vertex polygon needs 3 guards to cover it.

6 Feb 20116

7 7

8 8

9 9 First Proof of sufficiency is due to Chvátal in 1975 (very complex). We’ll present a simple, four-step proof by Fisk from 1978. Necessity follows from the prong’s example. 1.Triangulation of polygon. 2.3-coloring of triangulation graph. 3.Placing guards at a single color guarantees cover. 4.“Pigeon-hole principle”: placing n objects in k holes, one at least contains no more than └ n/k ┘ objects.

10 Feb 201110 Diagonals and Triangulation A diagonal of a polygon is a line segment connecting two visible vertices. Triangulation: the partition of a polygon by maximal non crossing diagonals into triangles (not unique!).

11 Feb 201111 n=14 Interesting, both triangulations have same number of diagonals! Notice that number of diagonals equals n-3.

12 Feb 201112 3-Coloring G(V,E) is a graph defined on a triangulated polygon P. E consists of P’s edges and the triangulation diagonals, while V consists of P’s vertices. k-coloring is an assignment of k colors to the vertices of V such that no adjacent vertices have same color. We’ll show later that a triangulation graph is 3-colorable.

13 Feb 201113 5 4 5 6 3 5 The coloring of a triangulation graph is unique! Assigning color to first vertex enforces the rest color assignments.

14 Feb 201114 Guards Placement It is sufficient to place guards at one color only (say red). This follows since every triangle must have 3 distinct colors at its corners, hence one must be red. Therefore every triangle is covered. But the triangles cover the entire polygon P. Pigeon-hole principle: There must be one color whose number of assigned vertices doesn’t exceed └ n/3 ┘.

15 Feb 201115 Triangulation Theory Need to prove that every polygon can be triangulated. Though intuitive, proof is not trivial. Lemma: Every polygon must have at least one strictly convex vertex. Proof: Let the vertices be counterclockwise ordered. Traversing the boundary, a convex vertex corresponds to a left turn. v L

16 Feb 201116 Pick the lowest vertex (pick the rightmost If there are few). L is a line passing through v. The edge following v must lie above L. ■ Lemma: Every polygon of n≥4 vertices has a diagonal. Proof: There exists a strictly convex vertex v. Let a and b be vertices adjacent to v. If [a,b] is a diagonal we are done. So assume it is either exterior or intersecting with the boundary of P.

17 Feb 201117 v a b L x d c ■

18 Feb 201118 Theorem: Every n-vertex polygon P can be triangulated. Proof: By induction on n. If n=3 P is a triangle. Let n≥4. By lemma, P has a diagonal d which divides P into two polygons P 1 and P 2, having n 1 <n and n 2 <n vertices, resp. P 1 and P 2 can be triangulated by induction hypothesis. ■ d

19 Feb 201119 Question: Are all triangulations have the same number of diagonals and triangles? Lemma: Every triangulation of an n-vertex polygon P has n-3 diagonals and n-2 triangles. Proof: By induction on n. For n=3 the claims are trivially true. For n≥4, divide P by a diagonal d into P 1 and P 2, having n 1 <n and n 2 <n vertices, resp. n 1 +n 2 = n+2 since the end vertices of d are duplicated.

20 Feb 201120 It follows from the induction hypothesis that the claims hold for n 1 -vertex and n 2 -vertex polygons. The total number of diagonals (n 1 -3)+(n 2 -3)+1=n-3, where +1 stands for counting d. The number of resulting triangles is (n 1 -2)+(n 2 -2)=n-2.■ Corollary: The sum of internal angles in an n-vertex polygon is (n-2)π. Proof: Polygon is covered by n-2 triangles, whose corners are placed at polygon’s vertices.

21 Feb 201121 Triangulation Dual An arc exists between two vertices iff the corresponding triangles are adjacent. A vertex is placed in every triangle.

22 Feb 201122 Lemma: The dual T of a triangulation of a simple polygon P is a tree whose vertex degree is 3 at most. Proof: Degree claim follows immediately from the fact that a triangle has three sides at most to share. Assume in contrary that T is not a tree. It then must have a closed cycle C, completely contained in P. C must enclose a vertex of P, which is the end point of a diagonal crossing C.

23 Feb 201123 P must therefore have a hole, thus contradicting its simplicity. ■ C Border vertices Completely in P

24 Feb 201124 Vertices of degree 1 are leaves of T. Vertices of degree 2 lie on T’s paths. Vertices of degree 3 are branches. When rooted at a vertex of degree 1 or 2, T is a binary. Definition: Three successive vertices a, b, c of a polygon form an ear if ac is a diagonal, while ab and bc are not. Theorem: A polygon with n≥4 has two nonoverlapping ears at least. Proof: A leaf of the dual tree T implies an ear. T has n-2 ≥2 vertices, at least 2 of which are leaves. ■

25 Feb 201125 3-Coloring Theorem Theorem: The triangulation graph of a simple n-vertex polygon P is 3-colorable. Proof: By induction on n. P has an ear. Ear removal obtains an (n-1)-vertex polygon, which by induction hypothesis is 3-colorable. The end vertices of the ear’s base (diagonal) are adjacent vertices of P and thus have two distinct colors. The tip of the ear is then colored with the third color. ■

26 Feb 201126 We are done!

27 Feb 201127 Area of Polygons

28 Feb 201128 Area of polygons can be found by triangulation and calculation of triangles areas. We’d like to obtain a closed-form formula, independent of triangulation.

29 Feb 201129 A(P)’s expression depends on triangulation. We’ll consider first quadrilaterals and show its area is independent of triangulation.

30 Feb 201130 Diagonal related terms are canceled out!

31 Feb 201131 What happens for non-convex quadrilateral ? v2v2 v3v3 v1v1 v0v0

32 Feb 201132 We’d like to obtain the area of a general simple polygon in terms of its vertices only.

33 Feb 201133 p P is a polygon and p an arbitrary point (internal or external). p’s vertices are cyclically ordered counterclockwise. We can traverse the edges along the border and consider the triangles viewed from p. The areas of rectangles counterclockwise oriented are added while the clockwise ones are subtracted. This is integration along the border (Green’s Theorem).

34 Feb 201134

35 Feb 201135 ■

36 Feb 201136 Triangulation Complexity

37 Feb 201137 Run time is reduced to O(n 2 ) (Lennes, 1911) as follows. Pick the leftmost vertex v of P and connect its two neighbors u and w. Checking whether uw is a diagonal takes O(n). If it is, the rest is (n-1)-vertex polygon. If uw is not a diagonal, get x, the farthest vertex from uw inside Δuvw. This takes O(n) time. vx is a diagonal dividing P into P 1 and P 2, having n total number of vertices. Recursive application of the above procedure consumes total O(n 2 ) time. Can we do better?

38 Feb 201138 There is a type of polygons whose triangulation takes linear time, called monotone. Definition: P is monotone w.r.t to a line l if P intersects with any line l’ perpendicular to l in a single segment, a point or it doesn’t intersect. l l’ monotone l’ not monotone

39 Feb 201139 P We’ll partition P into y-monotone pieces. start vertex end vertex merge vertex split vertex regular vertex On horizontal edge the left vertex is considered above the right one.

40 Feb 201140 Lemma: A polygon is y-monotone if it has neither split vertices nor merge vertices. Proof: If P is not monotone, there must exist a line l intersecting P in more than a single segment. Let [p,q] be its leftmost sub segment. Follow the boundary of P starting at q, where P is on the left. At some point r we must cross l. If r ≠ p then the highest vertex must be a split one. P split vertex

41 Feb 201141 If r = p we follow the boundary from q in opposite direction. At some point r’ we must cross l. r’ ≠ p as otherwise it contradicts that P is not monotone. This implies that the lowest encountered vertex must be a merge one. ■ P merge vertex

42 Feb 201142 P Getting Rid of Split and Merge Vertices Sort P’s vertices from top to bottom. It takes O(nlogn) time. Apply scan line from top to bottom to encounter vertices. Diagonals are introduced at split and merge vertices.

43 Feb 201143 P Scan line intersection with P’s boundary is stored in a left to right ordered balanced binary tree. Insertion into and deletion from a tree takes O(logn) time. Neighbor query takes O(1) time. Total time consumed by scanning is O(nlogn) time.

44 Feb 201144 At a split point we get the nearest left and right edges in O(1) time. The last upper vertex is also stored (can be the top end of right or left edge). This data suffices to decide on diagonal in O(1) time. P It takes O(nlogn) time to split P into monotone polygons. Merge vertices are handled similarly.

45 Feb 201145

46 Feb 201146

47 Feb 201147 ■ Theorem: An n-vertex simple polygon can be partitioned into y-monotone polygons in O(nlogn) time and O(n) storage.

48 Feb 201148 P 1 3 2 4 5 6 7 8 9 1011 Triangulating y-Monotone Polygon (Sketch)

49 Feb 201149 Theorem: Strictly y-monotone n-vertex polygon can be triangulated in linear time. Theorem: (Gary et. al. 1978) A simple n-vertex polygon can be triangulated in O(nlogn) time and O(n) storage. The problem has been studied extensively between 1978 and 1991, when in 1991 Chazelle presented an O(n) time complexity algorithm.


Download ppt "Feb 20111 Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering."

Similar presentations


Ads by Google