Jarvis March Graham Scan Chan’s Algorithm

Slides:



Advertisements
Similar presentations
Incremental Linear Programming Linear programming involves finding a solution to the constraints, one that maximizes the given linear function of variables.
Advertisements

Computational Geometry - Part II Mohammed Nadeem Ahmed Raghavendra Kyatham.
2/9/06CS 3343 Analysis of Algorithms1 Convex Hull  Given a set of pins on a pinboard  And a rubber band around them  How does the rubber band look when.
Chan’s Algorithm It is Jarvis’s march applied to big blobs of points.
Chan’s algorithm CS504 Presentation.
Planar Convex Hull 2013 / 5 / 9 Group 4 Sungheon Park Jeongho Son CS504 Presentation [CS504 Presentation]
1/13/15CMPS 3130/6130: Computational Geometry1 CMPS 3130/6130: Computational Geometry Spring 2015 Convex Hulls Carola Wenk.
algorithms and data structures
Brute-Force Triangulation
Computing Convex Hulls CLRS 33.3
Convex Hull obstacle start end Convex Hull Convex Hull
CS16: Introduction to Data Structures & Algorithms
Motion Planning CS 6160, Spring 2010 By Gene Peterson 5/4/2010.
C o m p u t i n g C O N V E X H U L L S by Kok Lim Low 10 Nov 1998 COMP Presentation.
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.
The Divide-and-Conquer Strategy
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
CS4413 Divide-and-Conquer
The Divide-and-Conquer Strategy
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 6 Ack : Carola Wenk nad Dr. Thomas Ottmann tutorials.
Advanced Topics in Algorithms and Data Structures Lecture 7.1, page 1 An overview of lecture 7 An optimal parallel algorithm for the 2D convex hull problem,
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.
1 Convex Hull in Two Dimensions Jyun-Ming Chen Refs: deBerg et al. (Chap. 1) O’Rourke (Chap. 3)
Computational Geometry
Lecture 3: Reduce to known problem Convex Hull (section 33.3 of CLRS). Suppose we have a bunch of points in the plane, given by their x and y coordinates.
Polygons and the convex hull Prof. Noah Snavely CS1114
Advanced Algorithm Design and Analysis (Lecture 10) SW5 fall 2004 Simonas Šaltenis E1-215b
Informal Definition : Let S is set of nails sticking out from a board. the convex hull can be visualized as the shape formed by a tight rubber band that.
1 Today’s Material Computational Geometry Problems –Closest Pair Problem –Convex Hull Jarvis’s March, Graham’s scan –Farthest Point Problem.
Algorithms and Data Structures Lecture 13. Agenda: Plane Geometry: algorithms on polygons - Verification if point belongs to a polygon - Convex hull.
5/17/2015 1:32 AMConvex Hull1 obstacle start end.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 3 Chapter 3: 2D Convex Hulls Friday,
Prune-and-search Strategy
5 - 1 § 5 The Divide-and-Conquer Strategy e.g. find the maximum of a set S of n numbers.
Convex Hull Computation ● Applications of Convex Hull Computation ● Definitions ● Basic Math Functions ● Algorithms Algorithm Speed Discovered By Brute.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 2 Chapter 2: Polygon Partitioning.
Polygons and the convex hull Prof. Noah Snavely CS1114
Design and Analysis of Algorithms - Chapter 41 Divide and Conquer The most well known algorithm design strategy: 1. Divide instance of problem into two.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 2 Chapter 2: Polygon Partitioning.
Computational Geometry
Computational Geometry Convex Hulls Robust Geometric Primitives Degeneracy and Stability Nick Pilkington.
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.
1 Computational Geometry Instructor: yedeshi
Computational Geometry (35/33) Line Segments and cross-product Segment intersection and Sweep Line Convex Hull and Graham’s Scan, Jarvis’s march Divide-and-Conquer.
© The McGraw-Hill Companies, Inc., Chapter 6 Prune-and-Search Strategy.
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.
Computational Geometry 2D Convex Hulls Joseph S. B. Mitchell Stony Brook University Chapter 2: Devadoss-O’Rourke.
Fundamental Data Structures and Algorithms Klaus Sutner April 27, 2004 Computational Geometry.
Fundamental Data Structures and Algorithms Margaret Reid-Miller 27 April 2004 Computational Geometry.
1 Prune-and-Search Method 2012/10/30. A simple example: Binary search sorted sequence : (search 9) step 1  step 2  step 3  Binary search.
Convex Hull. University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day.
Computational Geometry 2D Convex Hulls
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.
COMPUTATIONAL GEOMETRY AND MATRIX MULTIPLICATION Mohammed Zeeshan Farooqui Minhaj Uddin.
Convex Hull 2012/10/23. Convex vs. Concave A polygon P is convex if for every pair of points x and y in P, the line xy is also in P; otherwise, it is.
CS6234 Advanced Algorithms - Convex hull. Terminologies – ◦ Convex hull of a set Q of points is the smallest convex polygon P for which each point in.
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.
Simplex “walk on the vertices of the feasible region” v = current vertex if  neighbor v’ of v with better objective then move to v’
Robert Pless, CS 546: Computational Geometry Lecture #3 Last time Several convex hull algorithms. Lower bound of O(n log n) –O(n log h) for output sensitive.
Convex hulls in 3D Maciej Kot. Finding convex hull Given a set of points, find a convex hull that contains all of them and is minimal.
Convex Hulls Guo Qi, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
MA/CSSE 473 Day 16 Answers to your questions Divide and Conquer
Convex Hull.
Algorithm design techniques Dr. M. Gavrilova
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computational Geometry Capter:1-2.1
Convex Sets & Concave Sets
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
Introduction to Algorithms
Presentation transcript:

Jarvis March Graham Scan Chan’s Algorithm Convex Hulls (2D) Jarvis March Graham Scan Chan’s Algorithm

What is a convex hull? Wikipedia: “the minimal convex set containing X, where X is a set of points in a real vector space V” In 2D: Convex polygon of smallest area containing all given points In 3D: Convex polyhedron of smallest volume containing all given points

Output-sensitive algorithms Any algorithm with a runtime dependent not only on the input size, but on the output size as well Occasionally pop up in problems where you can compute parts of the output one by one

Jarvis march Start at the leftmost point in the set (if there are multiple, take the closest to the bottom) For all other points, compute the angle measured ccw with down being 0o Take point with smallest angle Repeat, except for further steps, measure angles ccw with the line segment from current to previously selected point being 0o

Jarvis march

Can we do better? Jarvis performs reasonably well if output size is small Calculate angles for every point each time it progresses to a new point, and it progressed to a new point once for every point in the output Runtime O(nh), where n = # of points, h = # of output points. If k is large (read: O(lg n)), Jarvis is slow, can be as bad as O(n2)

Graham scan Take starting point to be bottom-most point (if tied, take left-most) Sort all points by angle with right (+x) being 0o Iterate over points in order If the next point forms a “left turn” with the previous two, add it to the list and continue If “right turn”, remove the previous point until the angle becomes a left turn

Graham scan

Can we do even better? Graham scan Jarvis march O(n lg n) O(nh) O(n lg h) ?

Yup. The “ultimate convex hull algorithm” published by Kirkpatrick and Seidel in 1986 achieves O(n lg h) Uses reversal of divide-and-conquer, referred to as “marriage-before-conquest” by authors Requires median-finding in O(n) Chan’s algorithm, published in 1996, also achieves O(n lg h), but more simple As a lazy CS major, I’ll use this

Chan’s Algorithm Uses both Graham scan and Jarvis march as subroutines Partitions points into smaller chunks, then derives an overall convex hull by exploiting the smaller precomputed hulls

Chan’s Algorithm Suppose we know h, the size of the output We can partition (arbitrarily) n points into 1+n/h subsets, each with h or h-1 points Use Graham scan on each of subsets; must be done 1 + n/h times, and each takes O(h lg h), so overall runtime = (1+n/h)O(h lg h) = O(n lg h) Finish computing convex hull from parts…

Chan’s Algorithm

Chan’s Algorithm Problem: In general, we don’t know the size of the convex hull before we compute, so h is unknown; thus, this algorithm will not work Instead, iterate over the algorithm with different guesses for h to converge to the answer

Chan’s Algorithm For step t, let the guess for h be m = min(22t, n) If hull is not completed in m steps, abort Thus, each step takes O(n lg m) = O(n∙2t) Starting t at 0, we are guaranteed to find the solution by t = Thus, total runtime is

Chan’s Algorithm Looks complicated But, we know Thus, So we have a working O(n lg h) algorithm, yay

Other optimizations Discard points found to be inside smaller convex hulls prior to merge step on each iteration of algorithm (if a point lies in any convex polygon, it cannot be in convex hull) Alternatives to 22t