Introduction to Spatial Computing CSE 555

Slides:



Advertisements
Similar presentations
Polygon Triangulation
Advertisements

Computational Geometry
ADA: 15. Basic Math1 Objective o a reminder about dot product and cross product, and their use for analyzing line segments (e.g. do two segments.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
電腦視覺 Computer and Robot Vision I
Brute-Force Triangulation
Computational Geometry II Brian Chen Rice University Computer Science.
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
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)
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.
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.
Classes of Polygons Planar polygons Non-planar polygons Simple
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.
Advanced Computer Graphics Spring 2014
Spatial Information Systems (SIS)
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
3. Delaunay triangulation
By Dor Lahav. Overview Straight Skeletons Convex Polygons Constrained Voronoi diagrams and Delauney triangulations.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
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.
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.
1 University of Denver Department of Mathematics Department of Computer Science.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 2 Chapter 2: Polygon Partitioning.
Brute-Force Triangulation
Delaunay Triangulations Presented by Glenn Eguchi Computational Geometry October 11, 2001.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
9/7/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries Carola Wenk.
Triangulating a monotone polygon
Convex Hull. What is the Convex Hull? Imagine a set of points on a board with a nail hammered into each point. Now stretch a rubber band over all the.
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.
Spatial Databases: Digital Terrain Model Spring, 2015 Ki-Joune Li.
Polygons A Polygon is a closed plane figure formed by 3 or more segments Each segment intersects exactly 2 other segments only at their endpoints. No.
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
L8 - Delaunay triangulation L8 – Delaunay triangulation NGEN06(TEK230) – Algorithms in Geographical Information Systems.
1 11. Polygons Polygons 2D polygons ( 다각형 ) –Polygon sides are all straight lines lying in the same plane 3D polyhedra ( 다면체 )  chap. 12 –Polyhedra.
Spatial Indexing Techniques Introduction to Spatial Computing CSE 5ISC Some slides adapted from Spatial Databases: A Tour by Shashi Shekhar Prentice Hall.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
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.
Triangles "Philosophy is written in this grand book--I mean the universe--which stands continually open to our gaze, but it cannot be understood unless.
Polygon Triangulation
CMPS 3130/6130 Computational Geometry Spring 2017
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Computer Graphics Filling.
Introduction to Polygons
Types of Polygons Polygon- a flat closed figure made of straight line segments Circle the figures that are polygons. Cross out the figures 
that are.
Convex Hull.
Query Processing in Databases Dr. M. Gavrilova
Grids Geometry Computational Geometry
Principles of GIS Geocomputation – Part II Shaowen Wang
Localizing the Delaunay Triangulation and its Parallel Implementation
The Art Gallery Problem
The Art Gallery Problem
Polygon Triangulation
Convex Sets & Concave Sets
I. The Problem of Molding
CHAPTER 33 Computational Geometry
Spatial Databases: Digital Terrain Model
Computational Geometry
Spatial Databases: Digital Terrain Model
Presentation transcript:

Introduction to Spatial Computing CSE 555 Algorithms for Spatial Data Some slides adapted from Worboys and Duckham (2004) GIS: A Computing Perspective, Second Edition, CRC Press

Few Common Geometric Algorithms

Distance and Angle between points Length of a line segment can be computed as the distance between successive pairs of points The bearing, , of q from p is given by the unique solution in the interval [0,360] of the simultaneous equations:

Distance from point to Line Distance from a point to a line implies minimum distance For a straight line segment, distance computation depends on whether p is in middle(l) or end(l) For a polyline, distance to each line segment must be calculated A polygon calculation is as for polyline (distance to boundary of polygon)

Area of a polygon (1/2) Let P be a simple polygon (no boundary self-intersections) with vertex vectors: (x1, y1), (x2, y2), ..., (xn, yn) where (x1, y1) = (xn, yn) Then the area is: In the case of a triangle pqr

Area of a polygon (2/2) Area may be positive or negative In fact, area(pqr) = -area(qpr) If p is to the left of qr then the area is positive, if p is to the right of qr then the area is negative

Centroid of a polygon The centroid of a polygon (or center of gravity) of a (simple) polygonal object (P = (x1, y1), (x2, y2), ..., (xn, yn) where (x1, y1) = (xn, yn)) is the point at which it would balance if it were cut out of a sheet of material of uniform density:

Point in a polygon Determining whether a point is inside a polygon is one of the most fundamental operations in a spatial database Semi-line algorithm: checks for odd or even numbers of intersections of a semi-line with polygon Winding algorithm: sums bearings from point to polygon vertices. The point is inside if a full turn (360 or -360) is observed. Vertices should be visited in order (clockwise or anti-clockwise). Need to follow the boundary in order. In other words no re-tracing of the same boundary edge is allowed.

Collinearity and Point on a segment Boolean operation colinear(a,b,c) determine whether points a, b and c lie on the same straight line Colinear(a,b,c) = true if and only if side (a,b,c) =0 Operation point_on_segment(p,l) returns the Boolean value true if p ∈ l (line segment l having end-points q and r) Determine whether p, q, r are collinear If yes, then p ∈ l if and only if p ∈ (minimum bounding box) MMB (l)

Segment Intersection Two line segments ab and cd can only intersect if a and b are on opposite sides of cd and c and d are on opposite sides of ab Therefore two line segments intersect if the following inequalities hold

Polygon Triangulation

Motivating Need through Tessellations Tessellations: a partition of the plane as the union of a set of disjoint areal objects Regular polygon: a polygon with all edges the same length and all internal angles equal Vertex figure: the polygon formed by joining in order the mid points of all edges incident with the vertex Regular tessellation: a tessellation of a surface for which all the participating polygons and vertex figures are regular and equal Square grid is most commonly used regular tessellation Provides the raster representation of spatial data

Irregular Tessellated representations Irregular tessellation: a tessellation for which the participating polygons are not all regular and equal TIN (triangulated irregular networks) is the most commonly used irregular tessellations The irregularity of a TIN allows the resolution to vary over the surface, capturing finer details where required. TINs are often derived from the elevation data of a rasterized digital elevation model (DEM). An advantage of using a TIN over a raster DEM is that the points of a TIN are distributed variably based on an algorithm. We can decide which points are most necessary to an accurate representation of the terrain.

Sample Triangulated Irregular Networks http://www.snipview.com/q/Triangulated_irregular_network http://warnercnr.colostate.edu/~rboone

Interpolating the height using Triangulation Point x is inside or on the boundary of the triangle abc, x = a + b + c Where  ,  , and  are scalar coefficients that can be uniquely determined, such that:  +  +  = 1 The height hx can now be found by using hx = ha + hb + hc

Delaunay Triangulation Delaunay triangulation: constituent triangles in a Delaunay triangulations are “as nearly equilateral as possible” Each circumcircle of a constituent triangle does not include any other triangulation point within it Proximal polygon: A region Rp around a point p with the property that every location in Rp is nearer to p than to any other point Voronoi diagram: the dual of a Delaunay triangulations The set of proximal polygons constitutes a Voronoi diagram

Properties of Delaunay Triangulation Given an initial point set P for which no sets of three points are collinear (to avoid degenerate cases) The Delaunay triangulation is unique The external edges of the triangulation from the convex hull of P (i.e., the smallest convex set containing P) The circumcircles of the triangles contain no members of P in their interior The triangles in a Delaunay triangulation are best-possible with respect to regularity (closest to equilateral)

Polygon Triangulation (Optional Material)

Triangulation of Polygons – Y monotones A simple polygon is y-monotone if any horizontal line intersects it in a connected set (or not at all) If not a y-monotone then partition a polygon into y-monotone polygons (covered later) Triangulate each y-monotone polygon P2 P3 P4 P5 P6 P7 P8 P9

Triangulation of Polygons – Y monotones Input: (a) A point set P of an Y-monotone. (b) Left and right chains of P merge the vertices of the left and right chains of P into y-sorted order p 1 ,…, p n . Put the points p 1 and p 2 into an empty stack S. For i←3 𝑡𝑜 𝑛−1 3.1 If p i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else pop S 3.2.1 pop S 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If p i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P2 P1 P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P2 P1 P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝒑 𝒊 and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P2 P1 P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push 𝒑 𝐢−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push 𝒑 𝐢−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P3 P2 P7 P8 i=3 Processing P3 P9

Triangulation of Polygons – Y monotones 3. For 𝒊←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P3 P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.2 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.3 push last popped vertex back onto S. 3.2.4 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P3 P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P3 P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from p i , and add a diagonal between p i and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push p i onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P2 P7 P8 i=4 Processing P4 P9

Triangulation of Polygons – Y monotones 3. For 𝐢←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P2 P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between p i and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P2 P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝒑 𝒊 and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P2 P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝒑 𝒊 and each popped vertex except the last. 3.1.2 push p i−1 and p i onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝒑 𝐢−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝒑 𝐢−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P5 P4 P7 P8 i=5 Processing P5 P9

Triangulation of Polygons – Y monotones 3. For 𝐢←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P5 P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P5 P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P5 P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P6 P7 P8 i=6 Processing P6 P9

Triangulation of Polygons – Y monotones 3. For 𝐢←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P4 P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝒑 𝒊 , and add a diagonal between 𝒑 𝒊 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝒑 𝒊 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P6 P7 P8 i=7 Processing P7 P9

Triangulation of Polygons – Y monotones 3. For 𝐢←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P6 P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P6 P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝒑 𝒊 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P6 P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝒑 𝒊 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝒑 𝒊−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝒑 𝐢 𝐚𝐧𝐝 𝐭𝐨𝐩 𝐒 are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝒑 𝒊−𝟏 and 𝒑 𝒊 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P8 P7 P7 P8 i=8 Processing P8 P9

Triangulation of Polygons – Y monotones 3. For 𝐢←𝟑 𝒕𝒐 𝒏−𝟏 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex p n to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P8 P7 P7 P8 i=9 Processing P9 P9

Triangulation of Polygons – Y monotones 3. For i←3 𝑡𝑜 𝑛−1 3.1 If 𝑝 i and top S are on different chains 3.1.1 Pop all vertices from S and add a diagonal between 𝑝 𝑖 and each popped vertex except the last. 3.1.2 push 𝑝 𝑖−1 and 𝑝 𝑖 onto S 3.2 Else 3.2.1 Pop(s) 3.2.1 pop the other vertices from S while they are visible from 𝑝 𝑖 , and add a diagonal between 𝑝 𝑖 and each popped vertex. 3.2.2 push last popped vertex back onto S. 3.2.3 push 𝑝 𝑖 onto S. 4. Add diagonals from the last vertex 𝒑 𝒏 to all stack vertices except first and last P2 P3 P4 P5 P6 Stack S P8 P7 P7 P8 i=4 Processing P9 P9

Creating Y monotones Start Vertex

Creating Y monotones Start Vertex Regular Vertex

Creating Y monotones Start Vertex Regular Vertex

Creating Y monotones Start Vertex Regular Vertex Merge Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex Split Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex Split Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex Split Vertex End Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex Split Vertex End Vertex

Creating Y monotones Start Vertex Merge Vertex Regular Vertex Split Vertex End Vertex

Creating Y monotones To partition P into a y-montones, we need to get rid of spilt (Purple) and merge (Red) nodes

Creating Y monotones To partition P into y-montones, we need to get rid of spilt (Purple) and merge (Red) nodes Downward diagonals from merge nodes Upward diagonals from split nodes

Creating Y monotones To partition P into y-montones, we need to get rid of spilt (Purple) and merge (Red) nodes Downward diagonals from merge nodes Upward diagonals from split nodes 2. Where do edges go?

Creating Y monotones Helpers: Let helper(ej) be the lowest vertex above the sweep-line such that the horizontal segment connecting the vertex to ej lies inside P ej Helper(ej)

Creating Y monotones Removing Merge Nodes: For a merge node (vj), Let ej be the edge immediately to the left of it. vj becomes the helper once we reach it Whenever helper(ej) is replaced by some. vertex vm, add a diagonal from vm to vj. vj ej

Creating Y monotones Removing Merge Nodes: For a merge node (vj), Let ej be the edge immediately to the left of it. vj becomes the helper once we reach it Whenever helper(ej) is replaced by some. vertex vm, add a diagonal from vm to vj. If it is never replaced then we can connect it to lower end point of ej vj ej vm

Creating Y monotones Removing Split Nodes: For a split vertex (vj), Let ej be the edge immediately to the left of it. Add a diagonal from vj to helper(ej) ej Helper(ej)

Where would this be connected? Creating Y monotones Removing Split Nodes: For a split vertex (vj), Let ej be the edge immediately to the left of it. Add a diagonal from vj to helper(ej) ej Helper(ej) Where would this be connected?