8/29/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk.

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
1/13/15CMPS 3130/6130: Computational Geometry1 CMPS 3130/6130: Computational Geometry Spring 2015 Convex Hulls Carola Wenk.
5/5/20151 Analysis of Algorithms Lecture 6&7: Master theorem and substitution method.
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
Computing Convex Hulls CLRS 33.3
Comp 122, Spring 2004 Divide and Conquer (Merge Sort)
Divide-and-Conquer The most-well known algorithm design strategy:
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 5 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
1 Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances.
CS4413 Divide-and-Conquer
September 12, Algorithms and Data Structures Lecture III Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Divide-and-Conquer Recursive in structure –Divide the problem into several smaller sub-problems that are similar to the original but smaller in size –Conquer.
Theory of Algorithms: Divide and Conquer
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 6 Ack : Carola Wenk nad Dr. Thomas Ottmann tutorials.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 5.
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.
Computational Geometry
5/17/2015 1:32 AMConvex Hull1 obstacle start end.
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
The master method The master method applies to recurrences of the form T(n) = a T(n/b) + f (n), where a  1, b > 1, and f is asymptotically positive.
Chapter 4 Divide-and-Conquer Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 3 Chapter 3: 2D Convex Hulls Friday,
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
CS3381 Des & Anal of Alg ( SemA) City Univ of HK / Dept of CS / Helena Wong 4. Recurrences - 1 Recurrences.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions Analysis of.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
9/7/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries Carola Wenk.
Divide-and-Conquer 7 2  9 4   2   4   7
Analyzing Recursive Algorithms A recursive algorithm can often be described by a recurrence equation that describes the overall runtime on a problem of.
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.
MA/CSSE 473 Day 17 Divide-and-conquer Convex Hull Strassen's Algorithm: Matrix Multiplication.
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 5 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Project 2 due … Project 2 due … Project 2 Project 2.
10/25/20151 CS 3343: Analysis of Algorithms Lecture 6&7: Master theorem and substitution method.
CMPS 3120: Computational Geometry Spring 2013
Recurrences David Kauchak cs161 Summer Administrative Algorithms graded on efficiency! Be specific about the run times (e.g. log bases) Reminder:
Convex Hull. University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
Divide-and-Conquer UNC Chapel HillZ. Guo. Divide-and-Conquer It’s a technique instead of an algorithm Recursive in structure – Divide the problem into.
Lecture 5 Today, how to solve recurrences We learned “guess and proved by induction” We also learned “substitution” method Today, we learn the “master.
CS 312: Algorithm Analysis Lecture #8: Non-Homogeneous Recurrence Relations This work is licensed under a Creative Commons Attribution-Share Alike 3.0.
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.
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.
Lecture # 6 1 Advance Analysis of Algorithms. Divide-and-Conquer Divide the problem into a number of subproblems Similar sub-problems of smaller size.
Introduction to Algorithms: Divide-n-Conquer Algorithms
Lecture 3: Parallel Algorithm Design
Chapter 4 Divide-and-Conquer
Chapter 4 Divide-and-Conquer
Convex Hull.
Algorithm design techniques Dr. M. Gavrilova
CSCE 411 Design and Analysis of Algorithms
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Convex Sets & Concave Sets
Divide-and-Conquer 7 2  9 4   2   4   7
CMPS 3130/6130: Computational Geometry Spring 2017
CSE 2010: Algorithms and Data Structures
Divide-and-Conquer The most-well known algorithm design strategy:
Trevor Brown CS 341: Algorithms Trevor Brown
CMPS 3120: Computational Geometry Spring 2013
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
Introduction to Algorithms
Divide-and-Conquer 7 2  9 4   2   4   7
Presentation transcript:

8/29/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk

8/29/06CS 6463: AT Computational Geometry2 Convex Hull Problem  Given a set of pins on a pinboard and a rubber band around them. How does the rubber band look when it snaps tight?  The convex hull of a point set is one of the simplest shape approximations for a set of points.

8/29/06CS 6463: AT Computational Geometry3 Convexity  A set C  R 2 is convex if for all two points p,q  C the line segment pq is fully contained in C. convex non-convex

8/29/06CS 6463: AT Computational Geometry4 Convex Hull  The convex hull CH(P) of a point set P  R 2 is the smallest convex set C  P. In other words CH(P) =  C. C  P C convex P

8/29/06CS 6463: AT Computational Geometry5 Convex Hull  Observation: CH(P) is the unique convex polygon whose vertices are points of P and which contains all points of P  We represent the convex hull as the sequence of points on the convex hull polygon (the boundary of the convex hull), in counter-clockwise order.

8/29/06CS 6463: AT Computational Geometry6 A First Try Algorithm SLOW_CH(P): /* CH(P) = Intersection of all half-planes that are defined by the directed line through ordered pairs of points in P and that have all remaining points of P on their left */ Input: Point set P  R 2 Output: A list L of vertices describing the CH(P) in counter-clockwise order E:=  for all (p,q)  P  P with p≠q // ordered pair valid := true for all r  P, r≠p and r≠q if r lies to the left of directed line through p and q // takes constant time valid := false if valid then E:=E  pq // directed edge Construct from E sorted list L of vertices of CH(P) in counter-clockwise order Runtime: O(n 3 ), where n = |P| How to test that a point lies to the left?

8/29/06CS 6463: AT Computational Geometry7 Orientation Test / Halfplane Test p q r r q p positive orientation (counter-clockwise) r lies to the left of pq negative orientation (clockwise) r lies to the right of pq r q p zero orientation r lies on the line pq Orient(p,q,r) = det Can be computed in constant time 1 p x p y 1 q x q y 1 r x r y,where p = (p x,p y )

8/29/06CS 6463: AT Computational Geometry8 Convex Hull: Divide & Conquer  Preprocessing: sort the points by x- coordinate  Divide the set of points into two sets A and B:  A contains the left  n/2  points,  B contains the right  n/2  points  Recursively compute the convex hull of A  Recursively compute the convex hull of B  Merge the two convex hulls A B

8/29/06CS 6463: AT Computational Geometry9 Merging  Find upper and lower tangent  With those tangents the convex hull of A  B can be computed from the convex hulls of A and the convex hull of B in O(n) linear time A B

8/29/06CS 6463: AT Computational Geometry10 check with orientation test right turn left turn Finding the lower tangent a = rightmost point of A b = leftmost point of B while T=ab not lower tangent to both convex hulls of A and B do{ while T not lower tangent to convex hull of A do{ a=a-1 } while T not lower tangent to convex hull of B do{ b=b+1 } } A B 0 a= =b 5 6 7

8/29/06CS 6463: AT Computational Geometry11 Convex Hull: Runtime  Preprocessing: sort the points by x- coordinate  Divide the set of points into two sets A and B:  A contains the left  n/2  points,  B contains the right  n/2  points  Recursively compute the convex hull of A  Recursively compute the convex hull of B  Merge the two convex hulls O(n log n) just once O(1) T(n/2) O(n)

8/29/06CS 6463: AT Computational Geometry12 Convex Hull: Runtime  Runtime Recurrence: T(n) = 2 T(n/2) + cn  Solves to T(n) =  (n log n)

8/29/06CS 6463: AT Computational Geometry13 Recurrence (Just like merge sort recurrence) 1.Divide: Divide set of points in half. 2.Conquer: Recursively compute convex hulls of 2 halves. 3.Combine: Linear-time merge. T(n) = 2 T(n/2) + O(n) # subproblems subproblem size work dividing and combining

8/29/06CS 6463: AT Computational Geometry14 Recurrence (cont’d) T(n) =  (1) if n = 1; 2T(n/2) +  (n) if n > 1. How do we solve T(n)? I.e., how do we find out if it is O(n) or O(n 2 ) or …?

8/29/06CS 6463: AT Computational Geometry15 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant.

8/29/06CS 6463: AT Computational Geometry16 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. T(n)T(n)

8/29/06CS 6463: AT Computational Geometry17 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. T(n/2) dn

8/29/06CS 6463: AT Computational Geometry18 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn T(n/4) dn/2

8/29/06CS 6463: AT Computational Geometry19 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) …

8/29/06CS 6463: AT Computational Geometry20 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n

8/29/06CS 6463: AT Computational Geometry21 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n dn

8/29/06CS 6463: AT Computational Geometry22 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n dn

8/29/06CS 6463: AT Computational Geometry23 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n dn …

8/29/06CS 6463: AT Computational Geometry24 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n dn #leaves = n (n)(n) …

8/29/06CS 6463: AT Computational Geometry25 Recursion tree Solve T(n) = 2T(n/2) + dn, where d > 0 is constant. dn dn/4 dn/2  (1) … h = log n dn #leaves = n (n)(n) Total  (n log n) …

8/29/06CS 6463: AT Computational Geometry26 The divide-and-conquer design paradigm 1.Divide the problem (instance) into subproblems. a subproblems, each of size n/b 2.Conquer the subproblems by solving them recursively. 3.Combine subproblem solutions. Runtime is f(n)

8/29/06CS 6463: AT Computational Geometry27 Master theorem T(n) = a T(n/b) + f (n) C ASE 1: f (n) = O(n log b a –  )  T(n) =  (n log b a ). C ASE 2: f (n) =  (n log b a log k n)  T(n) =  (n log b a log k+1 n). C ASE 3: f (n) =  (n log b a +  ) and a f (n/b)  c f (n)  T(n) =  ( f (n))., where a  1, b > 1, and f is asymptotically positive. Convex hull: a = 2, b = 2  n log b a = n  CASE 2 (k = 0)  T(n) =  (n log n).