1 / 49

Polygon Triangulation

Polygon Triangulation. Shmuel Wimer Bar Ilan Univ., School of Engineering. Definitions. Simple polygon. Nonsimple polygons. There are no holes in a simple polygon. The Art Gallery Problem. How many stationary guards are needed to guard a room?.

earl
Download Presentation

Polygon Triangulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Definitions

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

  4. 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. This 12-vertex polygon needs 3 guards to cover it. This 12-vertex polygon needs 4 guards to cover it

  6. Necessity follows from the prong’s example. 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. • Triangulation of polygon. • 3-coloring of triangulation graph. • Placing guards at a single color guarantees cover. • “Pigeon-hole principle”: placing n objects in k holes, one at least contains no more than └n/k┘ objects.

  7. 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!).

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

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

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

  11. 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┘.

  12. Proof: Let the vertices be counterclockwise ordered. Traversing the boundary, a convex vertex corresponds to a left turn. L v 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.

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

  14. a b x c d L v ■

  15. d Theorem:Every n-vertex polygon P can be triangulated. Proof: By induction on n. If n=3P is a triangle. Let n≥4. By lemma, P has a diagonal d which divides P into two polygons P1 and P2, having n1<n and n2<n vertices, resp. P1 and P2can be triangulated by induction hypothesis. ■

  16. 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 P1 and P2, having n1<n and n2<n vertices, resp. n1+n2 = n+2 since the end vertices of d are duplicated.

  17. It follows from the induction hypothesis that the claims hold for n1-vertex and n2-vertex polygons. The total number of diagonals (n1-3)+(n2-3)+1=n-3, where +1 stands for counting d. The number of resulting triangles is (n1-2)+(n2-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.

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

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

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

  21. 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. ■

  22. 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. ■

  23. We are done!

  24. Area of Polygons

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

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

  27. Diagonal related terms are canceled out!

  28. v2 What happens for non-convex quadrilateral ? v3 v1 v0

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

  30. 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. p The areas of rectangles counterclockwise oriented are added while the clockwise ones are subtracted. This is integration along the border (Green’s Theorem).

  31. Triangulation Complexity

  32. Run time is reduced to O(n2) (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 P1and P2, having n total number of vertices. Recursive application of the above procedure consumes total O(n2) time. Can we do better?

  33. l’ l’ l’ l’ l’ l’ l’ l’ l not monotone monotone 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.

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

  35. split vertex P 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.

  36. P merge vertex 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. ■

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

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

  39. P 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. Merge vertices are handled similarly. It takes O(nlogn) time to split P into monotone polygons.

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

  41. 1 2 3 4 5 6 7 8 9 11 10 P Triangulating y-Monotone Polygon (Sketch)

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

More Related