1 / 67

Polygon Triangulation

Polygon Triangulation. 전진우 손명 배. Art Gallery Problem. Want to cover all areas Assume that the art gallery is a simple polygon Does not intersect itself How many cameras do we need? Where do we put it? Getting an exact solution is NP-hard We just want to get a lower bound. Triangulation.

van
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 전진우 손명배

  2. Art Gallery Problem • Want to cover all areas • Assume that the art galleryis a simple polygon Does not intersect itself • How many cameras do we need? • Where do we put it? • Getting an exact solution is NP-hard We just want to get a lower bound

  3. Triangulation • Easy to guard • Draw diagonals An open line segment that connects two vertices of P and lies in the interior of P • A decomposition of a polygon into triangles by a maximal set of non-intersecting diagonals is called a triangulation of the polygon

  4. Triangulation • Thm 3.1 Every simple polygon admits a triangulation, and any triangulation of a simple polygon with n vertices consists of exactly n−2 triangles. • Induction on n • n = 3: Trivial • n > 3: Assume that the theorem is true for all m<n ……

  5. Triangulation • Pick a vertex v and neighboringvertices w and u. Draw • Case 1: vwu does not contain anyvertices Then is a diagonal; P consists of vwuand the rest is triangulated inton – 3 triangles. • Case 2: vwu contains some vertices Let v’ be the farthest point from .Then is a diagonal. Why?If intersects any edges, one of itsendpoint is farther than v’ ↯

  6. Triangulation Methods • Recursive triangulation algorithm • Based on the argument stated previously • Draw a line segment and find the diagonal • O(n2) at worst • Split into convex pieces and triangulate • Easy to triangulate - just draw diagonals froma single vertex • Hard to split the polygon into convex pieces • Split into monotone pieces and triangulate • A little bit harder to triangulate, but O(n) anyway • Takes O(nlogn) to split the polygon into monotonepieces

  7. Monotone Polygon • A simple polygon is called monotonicwith respect to l if for any line l’perpendicular to l, the intersectionof the polygon with l’ is connected. • If we walk from a topmost to abottommost vertex along one sideboundary chain, then we alwaysmove downwards or horizontally,never upwards.

  8. Monotone Polygon • Split the polygon by getting rid of turn vertex • Walk through either left orright chain from topmostto downmost vertex • Our walking direction changeson turn vertex (either downward to upwardor vice versa)

  9. Monotone Polygon v5 v3 • Regular vertex When v is none of following types • Start vertex When v is above its neighbors interior angle < π • End vertex When v is below its neighbors interior angle < π • Split vertex When v is above its neighbors interior angle > π • Merge vertex When v is below its neighbors interior angle >π v4 v6 v1 v9 v7 v2 v8 v14 v10 v12 v15 v11 v13

  10. Monotone Polygon • Lemma 3.4 A polygon is y-monotone if it has no split vertices or merge vertices. Suppose P is not monotone. Then there’s a horizontal line l that intersects P in more than one connected components. ∴ Either a split vertex or a merge vertex exists

  11. Monotone Polygon • How to get rid of split vertex and merge vertex? Add diagonal upward @ split vertex / downward @ merge vertex • Use plane sweep method!

  12. Monotone Polygon • Sweep line goes from topmost vertex to bottommost vertex • Event points: every vertices No more addition/removal on event queueWe can just sort vertices on y coord in O(nlogn) and use it • Add diagonals to split / merge vertices along sweep

  13. Plane Sweep • Handling a split vertex vi • Find edge located on left andright of vi – ej and ek • Choose the lowest vertexbetween ej and ek • We call it the helper of ej • Draw a diagonal to the helper • Formal defintion: helper(ej) is the lowest vertex above sweep line s.t.the horizontal segment connecting the vertex to ejlies inside P

  14. Plane Sweep • Handling a merge vertex vi Draw a diagonal toward some vertexvm which is lower than the sweep line?? • vmis a vertex whose left edge (ej)has its helper vi When we meet vm, draw a diagonal It is done when

  15. Plane Sweep • We need to know the left edge (ej) of vertex and its helper. Only left edges are needed; store the edges whose interior toward P is right side. • Save the list of left edges intersecting with sweep line • Use dynamic binary search tree T • Save a helper for each edges • Output should be the divided subpolygons with doubly connected edge list.

  16. Event Points v5 • Start vertex When v is above its neighbors interior angle < π e5

  17. Event Points • End vertex When v is below its neighbors interior angle < π v6 e8 v9

  18. Event Points • Split vertex When v is above its neighbors interior angle > π v9 v8 v14 e9 e14 v11 v13

  19. Event Points • Merge vertex When v is below its neighbors interior angle >π v7 v9 v2 e7 v8 e9

  20. Event Points • Regular vertex When v is none of following types v4 e5 v6 e6

  21. Event Points • Regular vertex When v is none of following types v12 v16 e12

  22. Monotone Polygon • Pretty standard line sweep algorithm

  23. Monotone Polygon • Lemma 3.5 Algorithm MakeMonotoneadds a set of non-intersecting diagonals that partitions P into monotone subpolygons. • It is easy to see that P is partitioned in a way that no split/merge vertices exists ∴By Lemma 3.4, it is monotone • But, are diagonals valid? Each of them should not intersect with another or edges • We’ll prove that for HandleSplitVertex Rest are similar

  24. Monotone Polygon • Consider a segment added by HandleSplitVertex() • Let Q be the quadrilateral bounded by ej, ek, vi, vm There are no vertices in Q; otherwise vm couldn’t be the helper of ej • Any “edge” that intersects should go through horizontalsegment that connects ej to eithervm or vi – contradicting that ej liesimmediately to the left for them. • For previously added diagonals,their endpoints should be over vi,and over Q (as no vertices are in Q) It can’t intersect

  25. Analysis • Priority queue construction: O(n) By sort: O(nlogn) • Total n events: • At most one insertion / deletion on T – O(logn) • At most two diagonal insertion on D – O(1) • Space complexity: O(n) • At most n (|V|) items on Q • At most n (|E|) items on T • Thm3.6 A simple polygon with n vertices can be partitioned into y-monotone polygons in O(nlogn) time with an algorithm that uses O(n) storage

  26. Example v5

  27. Example v3 e5

  28. Example e3 e5 v4

  29. Example e5 v6

  30. Example v7 e6

  31. Example v1 e7

  32. Example v9 e1 e7

  33. Example e1 e7 v2 e9

  34. Example e7 e9 v8

  35. Example e9 v14

  36. Example e9 v15 e14

  37. Example e9 v10

  38. Example e10 v12

  39. Example e10 v11

  40. Example v13

  41. Example

  42. So Far… • Our ultimate goal is to solve thepolygon triangulation, in orderto solve the art gallery problem • And for that, we’ve monotonizedthe polygon to ease the problem Done in O(nlogn) • Now it’s time to triangulateeach monotone polygons! Done in O(n)

  43. Outline of Triangulation • Let polygon P be a y-monotone with n vertices • We always go down when we walk on the left or right boundary chain of P • Stack contains vertices that have been encountered but may still need more diagonals • Add diagonals with vertices in stack whenever this is possible

  44. Stack • Stack stores vertices that have been visited but not yet connected with a diagonal • is the bottom and is the top of the stack • Stack must meet the two invariant conditions • The vertices on the stack lie on the same chain on the boundary of P • If i ≥ 3, for 1 ≤ j ≤ i - 2

  45. Initialization • Sort N vertices of monotone polygon P in order by decreasing y coordinate • If two vertices have the same y-coordinate, then the leftmost one is handled first • 𝑢1, 𝑢2, …, 𝑢𝑁be the sorted sequence of vertices y(𝑢1)>y(𝑢2)>…>y(𝑢𝑁) • Edge 𝑢𝑖 𝑢𝑗is an edge of monotone polygon P

  46. Cases • Case 1 : u is adjacent to v1 but not vi :

  47. Cases • Case 2 : u is adjacent to vi but not v1

  48. Cases • Case 3 : u is adjacent to both v1 and vi

  49. Pseudocode

  50. Example • Sorting on decreasing y-coordinate • Stack Empty • Diagonal Empty u1 u2 u3 u4 u5 u6 u7 u8 u9 u10

More Related