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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

CS Divide and Conquer/Recurrence Relations1 Divide and Conquer.
Lecture 3: Parallel Algorithm Design
Chan’s Algorithm It is Jarvis’s march applied to big blobs of points.
Jarvis March Graham Scan Chan’s Algorithm
Chan’s algorithm CS504 Presentation.
Planar Convex Hull 2013 / 5 / 9 Group 4 Sungheon Park Jeongho Son CS504 Presentation [CS504 Presentation]
Theory of Computing Lecture 3 MAS 714 Hartmut Klauck.
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
Advanced Algorithms Piyush Kumar (Lecture 12: Parallel Algorithms) Welcome to COT5405 Courtesy Baker 05.
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
CS16: Introduction to Data Structures & Algorithms
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.
Quick Sort, Shell Sort, Counting Sort, Radix Sort AND Bucket Sort
9/12/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries II Carola Wenk.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
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
8/29/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk.
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.
Advanced Algorithm Design and Analysis (Lecture 10) SW5 fall 2004 Simonas Šaltenis E1-215b
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.
What does that mean? To get the taste we will just look only at some sample problems... [Adapted from S.Suri]
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 3 Chapter 3: 2D Convex Hulls Friday,
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
Computational Geometry Overview from Cormen, et al. Chapter 33
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, 2001 Lecture 2 Chapter 2: Polygon Partitioning.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
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.
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.
Sorting: Implementation Fundamental Data Structures and Algorithms Klaus Sutner February 24, 2004.
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.
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.
February 17, 2005Lecture 6: Point Location Point Location (most slides by Sergi Elizalde and David Pritchard)
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Convex Hulls Guo Qi, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
What is the runtime of the best possible (comparison based) sorting algorithm? 1.O(log n) 2.O(n) 3.O(n log n) 4.O(n 2 ) 5.None of the above.
Lecture 3: Parallel Algorithm Design
Convex Hull.
Algorithm design techniques Dr. M. Gavrilova
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computational Geometry Capter:1-2.1
Convex Sets & Concave Sets
CMPS 3130/6130: Computational Geometry Spring 2017
CMPS 3120: Computational Geometry Spring 2013
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:

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. Today: –Chan’s Algorithm: An optimal O(n log h) algorithm.

Robert Pless, CS 546: Computational Geometry Lecture #3 More specific reprise Jarvis March: O(n h) Grahams Scan: O(n log n) –Sort: O(n log n) –Create the Hull: O(n)

Robert Pless, CS 546: Computational Geometry Lecture #3 Chan’s Algorithm Not such a complicated algorithm. Somewhat sophisticated analysis. Came out 10 years after the first optimal algorithm –Much simpler than the first optimal algorithm.

Robert Pless, CS 546: Computational Geometry Lecture #3 Algorithm Idea 1, Break the point set into groups. –Run one algorithm on each group –Run different algorithm to put them together. Idea 2, Pretend we know “h” –At first, pretend you know the best size in which to break up the group. Cute trick exists to fix the fact that you don’t know the size.

Robert Pless, CS 546: Computational Geometry Lecture #3 Algorithm Break the point set into (n/m) groups of size m –Within each group, we’ll use Graham’s scan. (n/m) groups, O(m log m) for each O(n/m m log m) time. Then do Jarvis march on the “n/m” hulls. Usually O(nh). But with (n/m) hulls of size m, time is (n/m * h*log(m)), (as well see on the next slide). O(nh/m log m) time. If (m = h), life is good! = n/h h log h = n log h = nh/h log h = n log h

Robert Pless, CS 546: Computational Geometry Lecture #3 Arbitrarily partition the points. Graham’s scan on each group.

Robert Pless, CS 546: Computational Geometry Lecture #3 Jarvis March Around groups. Choose the smallest angle, then continue.

Robert Pless, CS 546: Computational Geometry Lecture #3 Lie # 1: This isn’t done by sweeping line up. Key part of last routine is the problem: Given a convex polygon P, and a point outside that polygon q, find the tangent of that polygon: P q

Robert Pless, CS 546: Computational Geometry Lecture #3 q P “clockwise tangent and counterclockwise tangent” HW problem 1. Given a point q, and and polygon given by an ordered array of n vertices going ccw around the polygon, find the ccw tangent of the polygon with respect to the point q in O(log n) time. Hint, this can be done similar to a binary search, using orientation tests. Hint #2, it will feel more complicated than a binary search.

Robert Pless, CS 546: Computational Geometry Lecture #3 Graham’s scan Jarvis march on the “n/m” hulls. Idea, lets try m = 3, 4, 5, 6, 7, until we get to h? …spending way too much time trying values of h, too worried about going “over”? Life is only good if (m = h?). If jarvis march doesn’t stop after m steps, quit and try next value of m. O ( n m m l ogm ) O ( n m hl ogm ) P h m = 3 O ( n m m l ogm ) + O ( n m m ¤ l ogm ) = P h m = 3 O ( n l ogm ) = O ( n ( l og ( 3 ) + l og ( 4 ) + ::: l og ( h )) = O ( n ( l og ( h! )) ¼ O ( n ( hl og h )) ¼ O ( n hl og h )

Robert Pless, CS 546: Computational Geometry Lecture #3 Idea, lets try m = 4, 16, 256, 65536,… until we get to h? = O ( n ( l og ( ) + l og ( ) + l og ( ) + ::: l og ( 2 2 l og ( l og ( h )) ))) = O ( n ( ::: 2 l og ( l og ( h )) )) = O ( n ( 2 l og h )) = O ( n l og h )

Robert Pless, CS 546: Computational Geometry Lecture #3 Part II Theorem: If n points are sampled from a uniform distribution in a square, then there are O(log n) points on the convex hull. Uniform distribution in a square means that for each point, its (x,y) coordinates are each chosen with a constant probability density function (as opposed to, for example, a Gaussian distribution).

Robert Pless, CS 546: Computational Geometry Lecture #3 First, break hull into 4 parts, top-right, top-left, bottom-right, bottom-left. Use top, bottom, left and right points to break. Now, we will bound the number of points on the top right hull. Hard? Instead, let’s bound a larger number: the number of “un-dominated points”. A point is dominated if there is any point both above and to the right of it. No “dominated” point is on the upper right convex hull (it is left of two lines :from right-most point to the dominating point and from the dominating point to the top most point.) So # of dominating points >= # of convex hull points.

Robert Pless, CS 546: Computational Geometry Lecture #3 How many dominating points? Sort the points by descending x- coordinate. (Not an algorithm, just organizing things for a proof). Let p i = (x i,y i ), then if i>j, x i <x j. p i is dominating if it has larger y- coordinate than p 1 …p i-1. The y-coordinates are random, so the chance that p i >p 1 …p i-1 is 1/i. So the expected number of dominating points is:  i=1..n (1/i) = (1/1 + ½ + 1/3 + ¼ + 1/5 + 1/n) = log(n)

Robert Pless, CS 546: Computational Geometry Lecture #3 Summary Jarvis March: O(nh) Grahams’ Scan: O(n log n) –Random points in a square: h is about log n, –So O(nh) = O(n log n). Merge Hull/ Quick Hull: O(n log n) Bound (under comparison model) is O(n log h), by reduction to sorting.