Triangulating a monotone polygon

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science for Some.
Advertisements

Two Segments Intersect?
Polygon Triangulation
Computational Geometry
Divide and Conquer. Subject Series-Parallel Digraphs Planarity testing.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
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.
Convex Hull obstacle start end Convex Hull Convex Hull
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.
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.
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 Sets & Concave Sets A planar region R is called convex if and only if for any pair of points p, q in R, the line segment pq lies completely in R.
Feb Polygon Triangulation Shmuel Wimer Bar Ilan Univ., School of Engineering.
1 Today’s Material Computational Geometry Problems –Closest Pair Problem –Convex Hull Jarvis’s March, Graham’s scan –Farthest Point Problem.
Intersections. Intersection Problem 3 Intersection Detection: Given two geometric objects, do they intersect? Intersection detection (test) is frequently.
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
6/2/ :35 AMIncremental Convex Hull1 q w u e zt.
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann 1 l-Monotone Convex polygons are easy to triangulate. Unfortunately the partition.
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann 1 Polygon Triangulation Motivation: Guarding art galleries Art gallery theorem.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
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.
Polygon Triangulation Computational Geometry, WS 2007/08 Lecture 9 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Voronoi Diagrams.
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.
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
CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.
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.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
1 / 41 Convex Hulls in 3-space Jason C. Yang. 2 / 41 Problem Statement Given P: set of n points in 3-space Return: –Convex hull of P: CH (P) –Smallest.
1/29/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries Carola Wenk.
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
A planar region R is called convex if and only if for any pair of points p, q in R, the line segment pq lies completely in R. Otherwise, it is called concave.
Contest Algorithms January 2016 Triangulation & the Art Gallery Problem Contest Algorithms1.
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Polygon Triangulation
Computational Geometry
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Introduction to Spatial Computing CSE 555
Computer Graphics Filling.
Introduction to Polygons
Query Processing in Databases Dr. M. Gavrilova
Lecture 12 Algorithm Analysis
More Graph Algorithms.
The Art Gallery Problem
The Art Gallery Problem
Polygon Triangulation
Convex Sets & Concave Sets
I. The Problem of Molding
Minimum Spanning Tree.
Lecture 12 Algorithm Analysis
Presentation transcript:

Triangulating a monotone polygon

y-monotone polygon: left and right chains Left chain We will also assume that the polygon is strictly y-monotone, i.e. it is y-monotone and has no horizontal edges. Additionally, you may assume that no two vertices have the same y-coordinate

1 Idea of the algorithm: 2 3 We handle vertices in order of decreasing y-coordinates and add diagonals going up whenever possible 4 5 6 7 8 9 10 11 12 13 14

Invariant of the algorithm 1 Invariant of the algorithm 2 3 The part above the sweep line that has not been triangulated yet has the form of a “funnel”: 4 5 6 Reflex vertices one side of the boundary consists of a part of a single edge of the polygon; vertices on the other side of the boundary (except for the highest vertex) are reflex vertices, i.e. the interior angle at these vertices is at least 180o 7 8 funnel 9 10 11 12 13 14

Invariant of the algorithm 1 Invariant of the algorithm 2 3 4 5 6 7 8 9 10 11 12 13 14

Strategy Handle vertices from top to bottom Use stack S to store vertices The lowest vertex encountered so far is on the top of the stack Add diagonals (going up) from the active vertex to other vertices on the stack as long as it is possible, and remove (pop) the vertices to which the diagonals are drawn, from the stack, except the last one Push the active vertex onto the stack S Note: at every moment, vertices on the stack are reflex vertices

1 Stack S 2 3 13 12 11 10 9 8 7 6 5 4 3 2 1 4 5 6 7 8 9 10 11 12 13 14

If next vertex is on the opposite chain to the vertices on the stack…

If next vertex is on the same chain as the vertices on the stack… Case 1 Case 2

Algorithm TriangulateMonotonePolygon(P) Input. A strictly y-monotone polygon P stored in a doubly-connected edge list D Output. A triangulation of P stored in the doubly-connected edge list D Merge the vertices on the left chain and the vertices on the right chain of P into one sequence (priority queue), sorted on decreasing y-coordinate. Let u1 , …, un denote the sorted sequence. Initialize an empty stack S, and push u1 and u2 onto it

For i = 3 to n – 1 Do If ui and the vertex on top of S are on different chains Then pop all vertices from S insert into D a diagonal from ui to each popped vertex, except the last one push ui-1 and ui onto S

Else (i.e. when they are on the same chain) Pop one vertex from S Pop the other vertices from S as long as the diagonals from ui to them are inside P Insert these diagonals into D Push the last vertex that has been popped back onto S Push ui onto S End If End For Add diagonals from un to all stack vertices except the first and the last one.

Running Time Theorem 3.7 A y-monotone polygon with n vertices can be triangulated in linear time, i.e. in O(n) time Taking into account that a simple polygon can be split into monotone pieces in O(n log n) time, we obtain the following theorem: Theorem 3.8 A simple polygon with n vertices can be triangulated O(n log n) time

(n-3) executions of the For loop For i = 3 to n – 1 Do If ui and the vertex on top of S are on different chains Then pop all vertices from S insert into D a diagonal from ui to each popped vertex, except the last one push ui-1 and ui onto S Several vertices are popped 2 vertices are pushed onto stack

Else (i.e. when they are on the same chain) Pop one vertex from S Pop the other vertices from S as long as the diagonals from ui to them are inside P Insert these diagonals into D Push the last vertex that has been popped back onto S Push ui onto S End If End For Add diagonals from un to all stack vertices except the first and the last one. Several vertices are popped 2 vertex are pushed onto stack

Running time Thus, for each execution of the For loop: At most 2 vertices are pushed Several vertices are popped Thus the total number of pushes is 2(n-3) = O(n) But the number of popped vertices cannot exceed the number of pushed vertices, so the number of pops is also O(n) Therefore the total number of operations is O(n), as required