Download presentation
Presentation is loading. Please wait.
Published byAdele Newton Modified over 9 years ago
1
UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 Lecture 2 Polygon Partitioning Thursday, 2/4/10 based on textbooks Computational Geometry in C by Joseph O’Rourke and Computational Geometry by de Berg et al.
2
O’Rourke Chapter 2 & de Berg et al. Chapter 3 Polygon Partitioning useful for triangulations and many other applications!
3
Some Approaches to Polygon Triangulation O(n 2 ): O’Rourke Ch. 1: Ear removal O(n 2 ): O’Rourke Ch. 1: Ear removal O(nlgn): O(nlgn): Using monotonicity: (see next slide for definition) Using monotonicity: (see next slide for definition) Partition polygon into monotone pieces, then quickly triangulate monotone pieces: Partition polygon into monotone pieces, then quickly triangulate monotone pieces: deBerg et al.: deBerg et al.: O(nlgn): Create y-monotone pieces using diagonals (p.49-55) (CGAL) O(nlgn): Create y-monotone pieces using diagonals (p.49-55) (CGAL) O(n): To triangulate a single y-monotone piece (p.55-58) O(n): To triangulate a single y-monotone piece (p.55-58) O’Rourke Chapter 2, Approach 1: O’Rourke Chapter 2, Approach 1: O(nlgn): Create y-monotone pieces using plane sweep to trapezoidalize (p. 47-50) O(nlgn): Create y-monotone pieces using plane sweep to trapezoidalize (p. 47-50) O(n): To triangulate a single y-monotone piece (as in deBerg et al.) O(n): To triangulate a single y-monotone piece (as in deBerg et al.) O’Rourke Chapter 2, Approach 2: O’Rourke Chapter 2, Approach 2: O(nlgn): Create monotone mountains using plane sweep to trapezoidalize O(nlgn): Create monotone mountains using plane sweep to trapezoidalize Trapezoidalize (p. 47-50) Trapezoidalize (p. 47-50) Add diagonals to convert trapezoidalization into set of monotone mountains. Add diagonals to convert trapezoidalization into set of monotone mountains. O(n): To triangulate a single monotone mountain (p. 52-53) O(n): To triangulate a single monotone mountain (p. 52-53) O(nlg*n) Expected time: Seidel Randomized Triangulation O(nlg*n) Expected time: Seidel Randomized Triangulation Trapezoidalize, monotone mountain, triangulate pieces Trapezoidalize, monotone mountain, triangulate pieces Constrained Delaunay triangulation (CGAL) (Delaunay triangulation to be studied later…) Constrained Delaunay triangulation (CGAL) (Delaunay triangulation to be studied later…) O(n): Chazelle (see paper) O(n): Chazelle (see paper) Recall from Cormen et al.:
4
Monotone Partitioning A chain is monotone with respect to a line L if every line orthogonal to L intersects the chain in at most 1 point A chain is monotone with respect to a line L if every line orthogonal to L intersects the chain in at most 1 point P is monotone with respect to a line L if boundary of P can be split into 2 polygonal chains A and B such that each chain is monotone with respect to L P is monotone with respect to a line L if boundary of P can be split into 2 polygonal chains A and B such that each chain is monotone with respect to L Monotonicity implies sorted order with respect to L Monotonicity implies sorted order with respect to L Polygon is monotone if it is monotone in neighborhood of every vertex Polygon is monotone if it is monotone in neighborhood of every vertex Absence of interior cusps guarantees y-monotonicity Absence of interior cusps guarantees y-monotonicity Monotone polygon can be (greedily) triangulated in O(n) time Monotone polygon can be (greedily) triangulated in O(n) time deBerg et al. (see next 2 slides) deBerg et al. (see next 2 slides)
5
Triangulating a Monotone Polygon in Linear Time (de Berg et al.) Doubly-connected edge list: see p. 29-32 of de Berg et al. 3 collections of records: vertices, faces, half-edges.
6
Triangulating a Monotone Polygon in Linear Time (de Berg et al.) 2 cases when next vertex is on same side as reflex vertices on stack
7
Partitioning a Polygon into Monotone Pieces in O(nlgn) Time (de Berg et al.) Using downward sweep, insert diagonals to eliminate “turn” vertices: -“start” (convex downwards) -“split” (reflex downwards) - “end” (convex upwards) -“merge” (reflex upwards) Add diagonal upward from each split vertex & diagonal downward from each merge vertex.
8
Partitioning a Polygon into Monotone Pieces in O(nlgn) Time (de Berg et al.) Using downward sweep, insert diagonals to eliminate “turn” vertices: -“start” (convex downwards) -“split” (reflex downwards) - “end” (convex upwards) -“merge” (reflex upwards) Add diagonal upward from each split vertex v i. Add diagonal downward from each merge vertex v i. Implemented in CGAL: function y_monotone_partition_2
9
Trapezoidalization (O’Rourke) Partition into trapezoidsPartition into trapezoids Horizontal line through each vertexHorizontal line through each vertex Diagonal of each interior cusp with each “supporting” vertex yields monotone partitionDiagonal of each interior cusp with each “supporting” vertex yields monotone partition To trapezoidalize, vertically sweep horizontal line LTo trapezoidalize, vertically sweep horizontal line L presort vertices by y (O(nlogn) time)presort vertices by y (O(nlogn) time) maintain sorted list of edges intersecting Lmaintain sorted list of edges intersecting L lg n lookup/insert/delete time (e.g. ht-balanced tree)lg n lookup/insert/delete time (e.g. ht-balanced tree) for each vertexfor each vertex find edge left and right along sweep linefind edge left and right along sweep line Algorithm: POLYGON TRIANGULATION: MONOTONE PARTITION Sort vertices by y coordinate Perform plane sweep to construct trapezoidalization Partition into monotone polygons by connecting from interior cusps Triangulate each monotone polygon in O(n) time O(n lg n)
10
Partition into Monotone Mountains ( O’Rourke ) Alternative:Alternative: Trapezoidalize (as before, time in O(nlgn))Trapezoidalize (as before, time in O(nlgn)) Partition into monotone mountainsPartition into monotone mountains One monotone chain is a single segmentOne monotone chain is a single segment Every strictly convex vertex is an ear tip (except maybe base endpoints)Every strictly convex vertex is an ear tip (except maybe base endpoints) Connect each pair of trapezoid-supporting vertices that don’t lie on same (left/right) side of their trapezoidConnect each pair of trapezoid-supporting vertices that don’t lie on same (left/right) side of their trapezoid Triangulate mountainsTriangulate mountains Total time in O(nlgn) (as before)Total time in O(nlgn) (as before) Algorithm: TRIANGULATION of MONOTONE MOUNTAIN Identify base edge (find extreme points) Initialize internal angles at each nonbase vertex Link nonbase strictly convex vertices into a circular list while list nonempty do For convex vertex b, remove triangle abc Output diagonal ac Update angles and list O(n)
11
Towards Linear-Time Triangulation…(O’Rourke) YearComplexityAuthors
12
Linear-Time Triangulation (O’Rourke) Chazelle’s Algorithm (High-Level Sketch)Chazelle’s Algorithm (High-Level Sketch) Computes visibility mapComputes visibility map horizontal chords left and right from each vertexhorizontal chords left and right from each vertex Algorithm is like MergeSort (divide-and-conquer)Algorithm is like MergeSort (divide-and-conquer) Partition polygon of n vertices into n/2 vertex chainsPartition polygon of n vertices into n/2 vertex chains Merge visibility maps of subchains to get one for chainMerge visibility maps of subchains to get one for chain Improve this by dividing process into 2 phases:Improve this by dividing process into 2 phases: 1) Coarse approximations of visibility maps for linear- time merge1) Coarse approximations of visibility maps for linear- time merge 2) Refine coarse map into detailed map in linear time2) Refine coarse map into detailed map in linear time see Chazelle’s paper for details
13
Seidel’s Randomized Triangulation (O’Rourke) Simple, practical algorithm Simple, practical algorithm Randomized: Coin-flip for some decisions Randomized: Coin-flip for some decisions Build trapezoidalization quickly Build trapezoidalization quickly O(log n) expected cost for locating point in segment query structure O(log n) expected cost for locating point in segment query structure Coin-flip to decide which segment to add next Coin-flip to decide which segment to add next log*n phases, each adding subset of segments in random order to query structure log*n phases, each adding subset of segments in random order to query structure Trapezoidalize -> Monotone Mountain -> Triangulate See Section 7.11.4 for details Recall from Cormen et al.:
14
Convex Partitioning (O’Rourke) Competing Goals: Competing Goals: minimize number of convex pieces minimize number of convex pieces minimize partitioning time minimize partitioning time Add (Steiner) points or just use diagonals and not add points? Add (Steiner) points or just use diagonals and not add points? Adding segments with Steiner points. r = number of reflex vertices Adding only diagonals.
15
Convex Partitioning (O’Rourke) Theorem (Chazelle): Let be the fewest number of convex pieces into which a polygon may be partitioned. For a polygon of r reflex vertices: Lower bound: Must eliminate all reflex vertices. Single segment resolves at most* 2 reflex angles. Upper bound: Bisect each reflex angle.
16
Convex Partitioning (O’Rourke) Hertel & Melhorn’s Algorithm: Hertel & Melhorn’s Algorithm: Essential diagonal d for vertex v if removing d creates nonconvex piece at v. Essential diagonal d for vertex v if removing d creates nonconvex piece at v. Start with any triangulation. Start with any triangulation. Iteratively remove inessential diagonals. Iteratively remove inessential diagonals. Can be done in O(n) time! Can be done in O(n) time! By Lemma 2.5.2, number of essential diagonals By Lemma 2.5.2, number of essential diagonals Number of convex pieces: Number of convex pieces: Recall: Recall: Lemma 2.5.2: There can be at most 2 diagonals essential for any reflex vertex.
17
Algorithms for Optimal Convex Partitioning of a Polygon (O’Rourke) Optimal convex partition using diagonals Optimal convex partition using diagonals Greene (1983): O(n 4 ) time with dynamic programming Greene (1983): O(n 4 ) time with dynamic programming Keil (1985): O(n 3 logn) time with dynamic programming Keil (1985): O(n 3 logn) time with dynamic programming Optimal convex partition using arbitrary segments Optimal convex partition using arbitrary segments Chazelle (1980) : O(n 3 ) time Chazelle (1980) : O(n 3 ) time
18
CGAL Convex Polygon Partitioning Y-Monotone partition: Y-Monotone partition: de Berg et al.: O(nlgn) time (see earlier slides) de Berg et al.: O(nlgn) time (see earlier slides) Optimal convex partition using diagonals Optimal convex partition using diagonals Greene (1983): O(n 4 ) time with dynamic programming Greene (1983): O(n 4 ) time with dynamic programming Approximate convex partition removing inessential diagonals Approximate convex partition removing inessential diagonals Starts with triangulation: Starts with triangulation: 2D constrained triangulation 2D constrained triangulation Run time depends on number of triangulation edges intersected by each polygon edge Run time depends on number of triangulation edges intersected by each polygon edge Hertel/ Melhorn: O(n) time after triangulation (see earlier slide) Hertel/ Melhorn: O(n) time after triangulation (see earlier slide) Approximate convex partition using sweep-line Approximate convex partition using sweep-line Greene (1983): O(nlgn) Greene (1983): O(nlgn) Starts with y-monotone partition (de Berg et al.) Starts with y-monotone partition (de Berg et al.)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.