Polygon Triangulation

Slides:



Advertisements
Similar presentations
Two Segments Intersect?
Advertisements

Polygon Triangulation
UNC Chapel Hill Lin/Foskey/Manocha Steps in DP: Step 1 Think what decision is the “last piece in the puzzle” –Where to place the outermost parentheses.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Brute-Force Triangulation
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
One of the most important problems is Computational Geometry is to find an efficient way to decide, given a subdivision of E n and a point P, in which.
UNC Chapel Hill M. C. Lin Polygon Triangulation Chapter 3 of the Textbook Driving Applications –Guarding an Art Gallery –3D Morphing.
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann Triangulation (Naive)
POLYGON TRIANGULATION POLYGON TRIANGULATION THE ART GALERY PROBLEM SİNEM GETİR COMPUTER GRAPHIC SEMINAR FEBRUARY 4, 2009.
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
I. The Problem of Molding Does a given object have a mold from which it can be removed? object not removable mold 1 object removable Assumptions The object.
1 Voronoi Diagrams. 2 Voronoi Diagram Input: A set of points locations (sites) in the plane.Input: A set of points locations (sites) in the plane. Output:
The Divide-and-Conquer Strategy
Ruslana Mys Delaunay Triangulation Delaunay Triangulation (DT)  Introduction  Delaunay-Voronoi based method  Algorithms to compute the convex hull 
By Groysman Maxim. Let S be a set of sites in the plane. Each point in the plane is influenced by each point of S. We would like to decompose the plane.
Convex Hulls in 3-space Jason C. Yang.
Feb Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering.
ADA: 16. CG Topics1 Objective o an examination of four important CG topics o just a taster of a very large research area Algorithm Design and Analysis.
Zoo-Keeper’s Problem An O(nlogn) algorithm for the zoo-keeper’s problem Sergei Bespamyatnikh Computational Geometry 24 (2003), pp th CGC Workshop.
Voronoi Diagram Presenter: GI1 11號 蔡逸凡
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 Lecture 2 Polygon Partitioning Thursday,
Computational Geometry -- Voronoi Diagram
17. Computational Geometry Chapter 7 Voronoi Diagrams.
Steps in DP: Step 1 Think what decision is the “last piece in the puzzle” –Where to place the outermost parentheses in a matrix chain multiplication (A.
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann 1 Polygon Triangulation Motivation: Guarding art galleries Art gallery theorem.
Computational Geometry Seminar Lecture 1
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann Polygon Triangulation Motivation: Guarding art galleries Art gallery theorem.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 Lecture 2 Chapter 2: Polygon Partitioning.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Polygon Triangulation Computational Geometry, WS 2007/08 Lecture 9 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 2 Chapter 2: Polygon Partitioning.
Polygon Triangulation Computational Geometry, WS 2006/07 Lecture 8, Part 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
Art Gallery Theorem Computational Geometry, WS 2006/07 Lecture 8, Part 1 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 2 Chapter 2: Polygon Partitioning.
The Art Gallery Problem
Brute-Force Triangulation
Computational Geometry Piyush Kumar (Lecture 4: Planar Graphs, Polygons and Art Gallery) Welcome to CIS5930.
The Art Gallery Problem
9/7/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries Carola Wenk.
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Triangulating a monotone polygon
Line Arrangement Chapter 6. Line Arrangement Problem: Given a set L of n lines in the plane, compute their arrangement which is a planar subdivision.
C o m p u t i n g C O N V E X H U L L S. Presentation Outline 2D Convex Hulls –Definitions and Properties –Approaches: Brute Force Gift Wrapping QuickHull.
1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
Computational Geometry Polygon Triangulation and The Art Gallery Problem Joachim Gudmundsson NICTA, Sydney.
Arrangements and Duality Motivation: Ray-Tracing Fall 2001, Lecture 9 Presented by Darius Jazayeri 10/4/01.
1/29/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries Carola Wenk.
Contest Algorithms January 2016 Triangulation & the Art Gallery Problem Contest Algorithms1.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
Computational Geometry
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Computational Geometry
Query Processing in Databases Dr. M. Gavrilova
Planarity Testing.
The Art Gallery Problem
Computational Geometry Capter:1-2.1
The Art Gallery Problem
Polygon Triangulation
I. The Problem of Molding
Computational Geometry
Presentation transcript:

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 Simple polygon: a polygon that does not intersect itself. Num. of camera depends on the complexity of polygon, which means that it depends on n.

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 Why maximal set: colinear vertex 3개가 있을 경우, “triangle”을 만족해도 삼각형의 edge에 vertex가 박혀있는 경우가 있다. 그런 경우 방지용.

Triangulation Thm 3.1 Induction on n 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 ……

Triangulation Pick a vertex v and neighboring vertices w and u. Draw 𝑤𝑢 . Case 1: vwu does not contain any vertices Then 𝑤𝑢 is a diagonal; P consists of vwu and the rest is triangulated into n – 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 its endpoint is farther than v’ ↯ Case 2: rest is the same; vv’ separates polygon into two part; whose sum of number of triangles after triangulation is n – 2

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 from a 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 monotone pieces Convex split부터가 triangulation에 기반하므로 cyclic reference

Monotone Polygon A simple polygon is called monotonic with respect to l if for any line l’ perpendicular to l, the intersection of the polygon with l’ is connected. If we walk from a topmost to a bottommost vertex along one side boundary chain, then we always move downwards or horizontally, never upwards.

Monotone Polygon Split the polygon by getting rid of turn vertex Walk through either left or right chain from topmost to downmost vertex Our walking direction changes on turn vertex (either downward to upward or vice versa)

Monotone Polygon Regular vertex Start vertex End vertex Split 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 Split vertex interior angle > π Merge vertex v4 v6 v1 v9 v7 v2 v8 v14 v10 v12 v15 For vertices who resides on same y coord, we make the definition of “above” and “below” to be ordered by x coord as well, like what happens when P is slightly turned clockwise. Why “split” and “merge”? We’re going to use sweep line algorithm – sweep line is “splitted” and “merged” at those places. v11 v13

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 Choose l s.t. leftmost component is a segment Let pq be that segment. If we traverse upward from q, and meet l at some point r s.t. p!=r, then there should be a highest vertex located in path from q to r which is a split vertex If p = r, go downward and lowest vertex is a merge vertex.

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

Monotone Polygon Let 𝑣 1 , 𝑣 2 , …, 𝑣 𝑛 be a counterclockwise enumeration of the vertices, and 𝑒 1 , …, 𝑒 𝑛 be a enumeration of the edges along 𝑣 1 ,…, 𝑣 𝑛 starting from 𝑣 1 𝑣 2 Sweep line goes from topmost vertex to bottommost vertex Event points: every vertices No more addition/removal on event queue We can just sort vertices on y coord in O(nlogn) and use it Add diagonals to split / merge vertices along sweep As stated above, points with same y coord is sorted in such “above”/”below” condition

Plane Sweep Handling a split vertex vi Find edge located on left and right of vi – ej and ek Choose the lowest vertex between 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 ej lies inside P

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

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. We also assume that initial input was also doubly connected edge list.

Event Points Start vertex When v is above its neighbors interior angle < π e5

Event Points End vertex When v is below its neighbors interior angle < π v6 e8 이전 예제에서는 helper가 merge vertex인 경우가 없어 예제를 만들었습니다 v9

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

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

Event Points Regular vertex When v is none of following types v4 e5 v6 Case 1. Left vertex

Event Points Regular vertex When v is none of following types v12 v16 Case 2. Right vertex

Monotone Polygon Pretty standard line sweep algorithm As I told above, you can just sort the list of vertices instead of using PriorityQ

Monotone Polygon Lemma 3.5 Algorithm MakeMonotone adds 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

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 horizontal segment that connects ej to either vm or vi – contradicting that ej lies immediately 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 𝑣 𝑚 𝑣 𝑖 ej: left edge, ek: right edge

Analysis Priority queue construction: O(n) Total n events: 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 Thm 3.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

Example v5

Example v3 e5

Example e3 e5 v4

Example e5 v6

Example v7 e6

Example v1 e7

Example v9 e7 e1

Example e7 e1 v2 e9

Example e7 e9 v8

Example e9 v14

Example e9 v15 e14

Example e9 v10

Example e10 v12

Example e10 v11

Example v13

Example

So Far… Our ultimate goal is to solve the polygon triangulation, in order to solve the art gallery problem And for that, we’ve monotonized the polygon to ease the problem Done in O(nlogn) Now it’s time to triangulate each monotone polygons! Done in O(n)

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

Stack Stack stores vertices that have been visited but not yet connected with a diagonal 𝑣 1 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, ∠ 𝑣 𝑗 𝑣 𝑗+1 𝑣 𝑗+2 ≥𝜋 for 1 ≤ j ≤ i - 2

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

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

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

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

Pseudocode

Example Sorting on decreasing y-coordinate Stack Empty Diagonal u1 u2

Example Initialization push u1 and u2 onto stack v1 v2

Example u3 : case 2 push u3 v1 v2 u3

Example u4 : case 2 push u4 v1 v2 v3 u4

Example u5 : case 1 pop v1, v2, v3, v4 push v4, u5 add diagonal 𝑢 5 𝑣 2 , 𝑢 5 𝑣 3 , 𝑢 5 𝑣 4 v1 v2 v3 v4 u5 v1 v2

Example u6 : case 2 u6v2v1 < π add diagonal 𝑢 6 𝑣 1 pop v2 push u6 V1, v2, u6이 꺽엿으니까

Example u7 : case 2 u7v2v1 > π push u7 v1 v2 u7 V1, v2, u6이 꺽엿으니까

Example u8 : case 2 u8v3v2 > π push u8 v1 v2 V1, v2, u6이 꺽엿으니까 v3

Example u9 : case 2 u9v4v3 < π add 𝑢9𝑣3 , pop v4 u9v3v2 < π push u9 v1 v2 v3 u9 v1 v2 v3 v4 u9 v1 v2 v3 V1, v2, u6이 꺽엿으니까

Example u10 : case 3 add 𝑢 10 𝑣 2 exit v1 v2 v3 V1, v2, u6이 꺽엿으니까

Analysis Thm 3.7 A strictly y-monotone polygon with n vertices can be triangulated in linear time Proof Step 1 takes linear time Step 2 takes constant time For loop is executed n-3 times One execution may take linear time At most two vertices are pushed at every execution total number of pushes : 2n – 4 Number of pops cannot exceed the number of pushes One execution may take linear time -> pop하고 push하는 한번의 for문이 동작하는 과정을 의미 2m-4 : 처음 2개를 push한 것까지 포함

For Planar Subdivision Thm 3.8 A simple polygon with n vertices can be triangulated in O(nlogn) time with an algorithm that uses O(n) storage Thm 3.9 A planar subdivision with n vertices in total can be triangulated in O(nlogn) time with an algorithm that uses O(n) storage 증명하기.. 각각 증명 과정 너놓고 3페이지로 쪼개기도 가능. 3.7 책의 내용 3.8 85 Polygon cutting theorem Decompose a polygon into monotone pieces -> o(nlogn) time, o(n) space 3.9 345 split subdivision into monotone pices (Trapezoid??)

3-coloring Recall 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. Thus n-2 cameras needed- any better solution? Place camera on a vertex v: every triangle that shares v will be covered! Lower bound: 𝑛/3 How to get this bound? v

3-coloring Do 3-coloring on triangulation - assign three colors B/G/W No neighboring two vertices have same color In triangle, all three vertices have different color! Choose a color, then put a camera on each vertex with that color (e.g. Black) The fewest number of vertices is no more than 𝑛/3 Do we have 3-colorings?

3-coloring We can visit each triangle in DFS order on the dual graph In simple polygon, notice that the dual graph is a tree Then we can always make a valid assignment of 3-coloring on every triangle

Art Gallery Theorem Is 𝒏/𝟑 tight? Yes. No single camera can see two prongs at a time! Thm 3.2 For a simple polygon with n vertices, 𝑛/3 cameras are occasionally necessary and always sufficient to have every point in the polygon visible from at least one of the cameras.

Art Gallery Theorem 3-coloring takes one DFS which is done in O(n) We claim that the triangulation of a simple polygon takes O(nlogn) time If it is true, then… Thm 3.3 Let P be a simple polygon with n vertices. A set of 𝑛/3 camera positions in P such that any point inside P is visible from at least one of the cameras can be computed in O(nlogn)time. O(nlogn) is not tight, though the optimal method (O(n)) is complex as hell and practically slower.

Reference M. Garey, D. Johnson, F. Preparata and R, Tarjan, Triangulating a simple polygon, Inf. Process. Lett. 7, 175-179 (1978). B. Chazelle. A theorem on polygon cutting with applications. In Proc. 23rd Annu. IEEE Sympos. Found. Comput. Sci., pages 339–349, 1982. R. Seidel. A simple and fast incremental randomized algorithm for computing trapezoidal decompositions and for triangulating polygons. Comput. Geom. Theory Appl., 1:51–64, 1991.  Reference 부분에서, 책에서 O(n) optimal 알고리즘의 존재여부를 말했었는데 (Chazelle [92, 94]), 그런게 있지만 대신 대신 드럽게 복잡하고 실행속도도 실용적으로 느려터졌다 정도 잠깐 언급하고 넘어가시면 좋을 것 같습니다. (스크립트 구술도 괜찮습니다)