Computational Geometry [csci 3250]

Similar documents
Polygon Triangulation

Polygon Partitioning. Lecture03

The Art Gallery Problem

Computational Geometry [csci 3250]

Computational Geometry

Polygon Triangulation. (slides partially by Daniel Vlasic )

Lecture 3: Art Gallery Problems and Polygon Triangulation

Polygon decomposition. Motivation: Art gallery problem

Polygon Triangulation. (slides partially by Daniel Vlasic )

Planar convex hulls (I) Computational Geometry [csci 3250] Laura Toma Bowdoin College

CS6100: Topics in Design and Analysis of Algorithms

Motivation: Art gallery problem. Polygon decomposition. Art gallery problem: upper bound. Art gallery problem: lower bound

MISCELLANEOUS SHAPES

Triangulation by Ear Clipping

Lecture 11 Combinatorial Planning: In the Plane

Week 2 Polygon Triangulation

AMS 345/CSE 355 Computational Geometry

CS 532: 3D Computer Vision 14 th Set of Notes

The Geometry of Carpentry and Joinery

Geometric Streaming Algorithms with a Sorting Primitive (TR CS )

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College

Projects & Polygon Triangulation

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College

Degree Constrained Triangulation

A Minimalist s Implementation of the 3-d Divide-and-Conquer Convex Hull Algorithm

Visibility Analysis for Video Surveillance

Computational Geometry. Lecture 17

Guard Placement For Wireless Localization

Henneberg construction

Polygon Triangulation

Convex Polygon Generation

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

An Implementation of a Near-Linear Polygon Triangulation Algorithm for General Polygons

Problem: Polygon Triangulation. Trapezoidal Map. Solution via Trapezoidal Map. The trapezoidal map of non-crossing line segments

Voronoi Diagrams and Delaunay Triangulation slides by Andy Mirzaian (a subset of the original slides are used here)

Computational Geometry csci3250. Laura Toma. Bowdoin College

GEOMETRIC SEARCHING PART 1: POINT LOCATION

K-structure, Separating Chain, Gap Tree, and Layered DAG

1/25 Warm Up Find the value of the indicated measure

Art Gallery, Triangulation, and Voronoi Regions

Geometry/Trigonometry Unit 5: Polygon Notes Period:

Intersecting Simple Surfaces. Dr. Scott Schaefer

An angle that has a measure less than a right angle.

A closed plane figure with at least 3 sides The sides intersect only at their endpoints. Polygon ABCDEF

The Geometry of Carpentry and Joinery

Polygon Triangulation

Ma/CS 6b Class 26: Art Galleries and Politicians

Geometry Unit 6 Properties of Quadrilaterals Classifying Polygons Review

Lesson 7.1. Angles of Polygons

Sublinear Geometric Algorithms

GEOMETRY is the study of points in space

On Merging Straight Skeletons

Line segment intersection. Family of intersection problems

Any questions about the material so far? About the exercises?

CMSC 754 Computational Geometry 1

Index COPYRIGHTED MATERIAL. Symbols & Numerics

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

Triangulating mult iply-connected polygons: A simple, yet efficient algorithm.

Polygonal Meshes: Representing 3D Objects

Range searching. with Range Trees

Hamiltonian Triangulations and Circumscribing Polygons of Disjoint Line Segments *

U4 Polygon Notes January 11, 2017 Unit 4: Polygons

Week 3 Polygon Triangulation

The Art Gallery Problem: An Overview and Extension to Chromatic Coloring and Mobile Guards

1. A statement is a set of words and/or symbols that collectively make a claim that can be classified as true or false.

MATH 113 Section 8.2: Two-Dimensional Figures

Algorithms. Daniel G. Aliaga. Computer Science Department Purdue University

Pick s Theorem and Lattice Point Geometry

Algorithms for GIS csci3225

PS Computational Geometry Homework Assignment Sheet I (Due 16-March-2018)

Triangle Geometry Isometric Triangles Lesson 1

Chapter 10 Polygons and Area

Lattice Polygon s and Pick s Theorem From Dana Paquin and Tom Davis 1 Warm-Up to Ponder

CS S Lecture February 13, 2017

3. Voronoi Diagrams. 3.1 Definitions & Basic Properties. Examples :

Orthogonal art galleries with holes: a coloring proof of Aggarwal s Theorem

arxiv: v1 [cs.cg] 8 Jan 2018

Computer Graphics Geometry and Transform

Cutting out polygons with a circular saw

Lecture 16: Voronoi Diagrams and Fortune s Algorithm

Solutions to problem set 1

Art Gallery Theorems and Algorithms

SAMPLING AND THE MOMENT TECHNIQUE. By Sveta Oksen

Parameterization. Michael S. Floater. November 10, 2011

An Overview of Triangulation Algorithms for Simple Polygons

Partitioning Orthogonal Polygons by Extension of All Edges Incident to Reflex Vertices: lower and upper bounds on the number of pieces

Notes in Computational Geometry Voronoi Diagrams

Discrete Mathematics I So Practice Sheet Solutions 1

General Pyramids. General Cone. Right Circular Cone = "Cone"

added to equal quantities, their sum is equal. Same holds for congruence.

Computational Geometry [csci 3250]

[Me] Meisters, G. H., Polygons have ears, American Mathematical Monthly, June/July 1975, pp

Proving Theorems about Lines and Angles

Videos, Constructions, Definitions, Postulates, Theorems, and Properties

Computational Geometry

Lecture 4: Trees and Art Galleries

Introduction to Geometry

Steven Skiena. skiena

1 Appendix to notes 2, on Hyperbolic geometry:

274 Curves on Surfaces, Lecture 5

Transcription:

Computational Geometry [csci 3250] Laura Toma Bowdoin College

Polygon Triangulation

Polygon Triangulation The problem: Triangulate a given polygon. (output a set of diagonals that partition the polygon into triangles).

Polygon Triangulation The problem: Triangulate a given polygon. (output a set of diagonals that partition the polygon into triangles).

Definitions Given a simple polygon P A diagonal is a segment between 2 non-adjacent vertices that lies entirely within the interior of the polygon. A ear with tip vi is a set of 3 consecutive vertices vi-1, vi, vi+1 if vi-1vi+1 is a diagonal. Put differently, vi is an ear tip if the vertex right before it and the vertex right after it are visible to each other

Known Results Theorem: Any simple polygon must have a convex vertex. Theorem: Any simple polygon with n>3 vertices contains (at least) a diagonal. Theorem: Any polygon can be triangulated by adding diagonals. Theorem: Any simple polygon has at least two ears. All triangulations of a polygon of n vertices have n-2 triangles and n-3 diagonals.

Algorithms Is pipj a diagonal of P? Find a diagonal of P Is vi the tip of an ear? Find all ears ==> Triangulate by finding ears

Polygon triangulation: First steps Algorithm 1: Triangulation by identifying ears Idea: Find an ear, output the diagonal, delete the ear tip, repeat. Analysis: checking whether a vertex is ear tip or not: O(n) checking all vertices: O(n 2 ) overall O(n 3 ) Algorithm 2: Triangulation by finding diagonals Idea: Find a diagonal, output it, recurse. A diagonal can be found in O(n) time (using the proof that a diagonal exists) O(n 2 )

Polygon triangulation: First steps Algorithm 3: Triangulation by identifying ears in O(n 2 ) Find an ear, output the diagonal, delete the ear tip, repeat. Avoid recomputing ear status for all vertices every time When you remove a ear tip from the polygon, which vertices might change their ear status?

History of Polygon Triangulation Early algorithms: O(n 4 ), O(n 3 ), O(n 2 ) Several O(n lg n) algorithms known Many papers with improved bounds 1991: Bernard Chazelle (Princeton) gave an O(n) algorithm practical not practical https://www.cs.princeton.edu/~chazelle/pubs/polygon-triang.pdf Ridiculously complicated, not practical O(1) people actually understand it (and I m not one of them) No algorithm is known that is practical enough to run faster than the O( n lg n) algorithms OPEN problem A practical algorithm that s better than O(n lg n).

An O(n lg n) Polygon Triangulation Algorithm Ingredients Consider the special case of triangulating a monotone/unimonotone polygon Convert an arbitrary polygon into monotone/unimonotone polygons

Monotone chains A polygonal chain is x-monotone if any line perpendicular to x-axis intersects it in one point (one connected component).

Monotone chains A polygonal chain is x-monotone if any line perpendicular to x-axis intersects it in one point (one connected component). one point one connected component

Monotone chains Not x-monotone

Monotone chains Claim: Let u and v be the points on the chain with min/max x-coordinate. The vertices on the boundary of an x-monotone chain, going from u to v, are in x-order. u x-monotone v

Monotone chains x-monotone not x-monotone As you travel along this chain, your x- coordinate is staying the same or increasing

Monotone chains A polygonal chain is y-monotone if any line perpendicular to y-axis intersects it in one point (one connected component). y-monotone not y-monotone

Monotone chains A polygonal chain is L-monotone if any line perpendicular to line L intersects it in one point (one connected component). L y-monotone not L-monotone

Monotone polygons A polygon is x-monotone if its boundary can be split into two x-monotone chains.

Monotone polygons A polygon is x-monotone if its boundary can be split into two x-monotone chains. xmin The vertices on each chain are sorted w.r.t. x-axis. xmax

Monotone polygons x-monotone y-monotone

Monotone Mountains A polygon is an x-monotone mountain if it is monotone and one of the two chains is a single segment.

Monotone Mountains A polygon is an x-monotone mountain if it is monotone and one of the two chains is a single segment. xmin Both endpoints have to be convex. xmax

Monotone mountains are easy to triangulate! Class work: come up with an algorithm and analyze it.

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! Yes!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! NO!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! Yes!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! Yes!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! No!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate!

Monotone mountains are easy to triangulate! Analysis: O(n) time

Triangulating Monotone Polygons Similar idea, pick the next vertex in x-order. It can be on upper or lower chain. O(n) time

Towards an O(n lg n) Polygon Triangulation Algorithm? polygon P Partition into monotone polygons??? Triangulate monotone polygons triangulated P polygon P?? Partition into unimonotone polygons Triangulate unimonotone polygons triangulated P??

How can we partition a polygon into (uni)monotone pieces?

Intuition x-monotone not x-monotone What makes a polygon not monotone?

Intuition x-monotone not x-monotone What makes a polygon not monotone?

Intuition Cusp: a reflex vertex v such that the vertices before and after are both smaller or both larger than v (in terms of x-coords). x-monotone not x-monotone What makes a polygon not monotone?

Intuition Cusp: a reflex vertex v such that the vertices before and after are both smaller or both larger than v (in terms of x-coords). x-monotone not x-monotone Theorem: If a polygon has no cusps, then it s monotone. Proof: Intuitively clear, but proof a little tedious. Maybe later..

We ll get rid of cusps using a trapezoidation of P.

Trapezoid partitions Shoot vertical rays If polygon is above vertex, shoot vertical ray up until reaches boundary If f polygon is below vertex, shoot down If polygon is above and below vertex, shoot both up and down

Trapezoid partitions Shoot vertical rays If polygon is above vertex, shoot vertical ray up until reaches boundary If f polygon is below vertex, shoot down If polygon is above and below vertex, shoot both up and down

Trapezoid partitions Properties Each polygon in the partition is a trapezoid, because: It has one or two threads as sides. If it has two, then they must both hit the same edge above, and the same edge below. At most one thread through each vertex => O(n) threads => O(n) trapezoids

Trapezoid partitions Each trapezoid has precisely two vertices of the polygon, one on the left and one on the right. They can be on the top, bottom or middle of the trapezoid.

Trapezoid partitions Each trapezoid has precisely two vertices of the polygon, one on the left and one on the right. They can be on the top, bottom or middle of the trapezoid.

Trapezoid partitions Each trapezoid has precisely two vertices of the polygon, one on the left and one on the right. They can be on the top, bottom or middle of the trapezoid.

Trapezoid partitions Each trapezoid has precisely two vertices of the polygon, one on the left and one on the right. They can be on the top, bottom or middle of the trapezoid.

Diagonals In each trapezoid: if its two vertices are not on the same edge, they define a diagonal.

Diagonals In each trapezoid: if its two vertices are not on the same edge, they define a diagonal.

Diagonals In each trapezoid: if its two vertices are not on the same edge, they define a diagonal.

We can use the trapezoid partition of P to split the cusps

Removing cusps

Removing cusps 1. Identify cusp vertices

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. For each cusp vertex, add diagonal in trapezoid before/after the cusp This creates a partition of P. Claim: The resulting polygons have no cusps and thus are monotone (by theorem).

Removing cusps Another example

Removing cusps 1. Identify cusp vertices

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P

Removing cusps 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. Add obvious diagonal before/after each cusp

Removing cusps This partitions the polygon into monotone pieces.

Partition P into monotone polygons 1. Identify cusp vertices 2. Compute a trapezoid partition of P 3. Add obvious diagonal before/after each cusp x

Towards an O(n lg n) Polygon Triangulation Algorithm polygon P Given a trapezoid partition of P, we can triangulate it in O(n) time.?? Trapezoid partition?? O(n) add cusps diagonals O(n) Triangulate monotone polygons triangulated P

Towards an O(n lg n) Polygon Triangulation Algorithm polygon P Given a trapezoid partition of P, we can triangulate it in O(n) time.?? Trapezoid partition?? O(n) add cusps diagonals O(n) Triangulate monotone polygons triangulated P OR add all diagonals O(n) Triangulate monotone mountains O(n) triangulated P

Partitioning into monotone mountains 1. Compute a trapezoid partition of P 2. Output all diagonals.

Partitioning into monotone mountains 1. Compute a trapezoid partition of P 2. Output all diagonals. Claim: All diagonals partition the polygon into monotone mountains.

Partitioning into monotone mountains 1. Compute a trapezoid partition of P 2. Output all diagonals. Claim: The diagonals partition the polygon into monotone mountains.

Claim: The diagonals partition the polygon into monotone mountains. Proof: Each polygon is monotone One of the chains must be a segment (because if it had another point, that point would generate a diagonal)

polygon P?? Trapezoid partition?? How do we get the trapezoid partition?

Computing the trapezoid partition

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep

Computing the trapezoid partition in O(n lg n) Plane sweep Events: polygon vertices Status structure: edges that intersect current sweep line, in y-order Events: How do we determine the trapezoids?

Computing the trapezoid partition in O(n lg n) Algorithm