Computational Geometry 2D Convex Hulls

Slides:



Advertisements
Similar presentations
Geometry Introduction
Advertisements

Jarvis March Graham Scan Chan’s Algorithm
1/13/15CMPS 3130/6130: Computational Geometry1 CMPS 3130/6130: Computational Geometry Spring 2015 Convex Hulls Carola Wenk.
Brute-Force Triangulation
Computing Convex Hulls CLRS 33.3
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.
Geometric Algorithms João Comba. Example: Convex Hull convex Non-convex.
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
Ruslana Mys Delaunay Triangulation Delaunay Triangulation (DT)  Introduction  Delaunay-Voronoi based method  Algorithms to compute the convex hull 
Convex Hulls in 3-space Jason C. Yang.
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.
Polygons and the convex hull Prof. Noah Snavely CS1114
Advanced Algorithm Design and Analysis (Lecture 10) SW5 fall 2004 Simonas Šaltenis E1-215b
Computational Geometry for the Tablet PC
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.
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]
ADA: 16. CG Topics1 Objective o an examination of four important CG topics o just a taster of a very large research area Algorithm Design and Analysis.
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 Lecture 2 Polygon Partitioning Thursday,
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 Graduate Algorithms Prof. Karen Daniels Spring, 2005 Computational Geometry Overview from Cormen, et al. Chapter 33.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 3 Chapter 3: 2D Convex Hulls Friday,
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Chapter 4: 3D Convex Hulls Friday, 2/9/07.
Computational Geometry Overview from Cormen, et al. Chapter 33
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Tuesday, 5/7/02 Computational Geometry Chapter 33.
Convex Hull Computation ● Applications of Convex Hull Computation ● Definitions ● Basic Math Functions ● Algorithms Algorithm Speed Discovered By Brute.
UMass Lowell Computer Science Graduate Algorithms Prof. Karen Daniels Spring, 2009 Computational Geometry Overview from Cormen, et al. Chapter 33.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 Chapter 4: 3D Convex Hulls Monday, 2/23/04.
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.
Computational Geometry
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
Computational Geometry Convex Hulls Robust Geometric Primitives Degeneracy and Stability Nick Pilkington.
Triangulating a monotone polygon
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.
An Introduction to Computational Geometry: Polyhedra Joseph S. B. Mitchell Stony Brook University Chapter 6: Devadoss-O’Rourke.
Convex Hull. University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day.
1 / 41 Convex Hulls in 3-space Jason C. Yang. 2 / 41 Problem Statement Given P: set of n points in 3-space Return: –Convex hull of P: CH (P) –Smallest.
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.
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.
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.
An Introduction to Computational Geometry: Arrangements and Duality Joseph S. B. Mitchell Stony Brook University Some images from [O’Rourke, Computational.
Convex Hulls Guo Qi, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
Polygon Triangulation
Convex Hull.
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
AMS 345/CSE 355 Computational Geometry
Convex Sets & Concave Sets
Convex Hull 1/1/ :28 AM Convex Hull obstacle start end.
CHAPTER 33 Computational Geometry
CMPS 3130/6130: Computational Geometry Spring 2017
CMPS 3120: Computational Geometry Spring 2013
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
Introduction to Algorithms
Computational Geometry Algorithms
Presentation transcript:

Computational Geometry 2D Convex Hulls Joseph S. B. Mitchell Stony Brook University

Comparing O(n), O(n log n), O(n2) n n log n n² 210 10³ 10 • 210  104 220  106 220  106 20 • 220  2 • 107 240 1012 Interactive Processing n log n algorithms n² algorithms n = 1000 yes ? n = 1000000 ? no

Convexity Set X is convex if p,qX  pq X non-convex convex Set X is convex if p,qX  pq X Point p X is an extreme point if there exists a line (hyperplane) through p such that all other points of X lie strictly to one side Fact: If X=S is a finite set of points in 2D, then CH(X) is a convex polygon whose vertices (extreme points) are points of S. Extreme points in red r p q

Fundamental Problem: 2D Convex Hulls More generally: CH(polygons) Input: n points S = (p1, p2, …, pn) Output: A boundary representation, e.g., ordered list of vertices (extreme points), of the convex hull, CH(S), of S (convex polygon) p2 p7 p4 p8 p3 p1 p6 p5 p9 Output: (9,6,4,2,7,8,5)

Equivalent Definitions of Convex Hull, CH(X) {all convex combinations of d+1 points of X } [Caratheodory’s Thm] (in any dimension d) Set-theoretic “smallest” convex set containing X. In 2D: min-area (or min-perimeter) enclosing convex body containing X In 2D:

2D Convex Hull Algorithms O(n4) simple, brute force (but finite!) O(n3) still simple, brute force O(nh) simple, “output-sensitive” h = output size (# vertices) O(n log n) worst-case optimal (as fcn of n) O(n log h) “ultimate” time bound (as fcn of n,h) Randomized, expected O(n log n) Lower bound: (n log n) Simple, elegant y= x2 (xi ,xi2 ) From SORTING: Note: Even if the output of CH is not required to be an ordered list of vertices (e.g., just the # of vertices), (n log n) holds xi

Primitive Computation “Left” tests: sign of a cross product (determinant), which determines the orientation of 3 points Time O(1) (“constant”) c b Left( a, b, c ) = TRUE  ab  ac > 0 c is left of ab a

SuperStupidCH: O(n4) Fact: If s ∆pqr, then s is not a vertex of CH(S)  q  p  r  p,q  s  p,q,r: If s  ∆pqr then mark s as NON-vertex Output: Vertices of CH(S) Can sort (O(n log n) ) to get ordered q s p O(n3) r O(n)

StupidCH: O(n3) Fact: If all points of S lie strictly to one side of the line pq or lie in between p and q, then pq is an edge of CH(S).  p  q  p  r  p,q: If r  red then mark pq as NON-edge (ccw) Output: Edges of CH(S) Can sort (O(n log n) ) to get ordered p r q O(n2) O(n) Applet by Snoeyink Caution!! Numerical errors require care to avoid crash/infinite loop!

O(nh) : Gift-Wrapping Idea: Use one edge to help find the next edge. Jarvis March Idea: Use one edge to help find the next edge. Output: Vertices of CH(S) Demo applet of Jarvis march r O(n) per step h steps Total: O(nh) q p Key observation: Output-sensitive!

Example: QHull Extensive links and material! webpage Komei Fukuda website Delaunay triangulation and 3D convex hulls applet

O(n log n) : Graham Scan Idea: Sorting helps! Start with vlowest (min-y), a known vertex Sort S by angle about vlowest Graham scan: Maintain a stack representing (left-turning) CH so far If pi is left of last edge of stack, then PUSH Else, POP stack until it is left, charging work to popped points O(n) O(n log n) O(n) CH so far vlowest Demo applet

O(n log n) : Divide and Conquer Split S into Sleft and Sright , sizes n/2 Recursively compute CH(Sleft ), CH(Sright) Merge the two hulls by finding upper/lower bridges in O(n), by “wobbly stick” Time O(n) Time 2T(n/2) Time O(n) Sleft Sright Time: T(n)  2T(n/2) + O(n)  T(n) = O(n log n) Demo applet

QuickHull Applet (programmed by Jeff So) Applet (by Lambert)

QuickHull QuickHull(a,b,S) to compute upperhull(S) B A S If S=, return () Else return (QuickHull(a,c,A), c, QuickHull(c,b,B)) c = point furthest from ab c Discard points in abc B A Worst-case: O(n2 ) Avg: O(n) b a Works well in higher dimensions too! S Qhull website Qhull, Brad Barber (used within MATLAB)

O(n log n) : Randomized Incremental Add points in random order Keep current Qi = CH(v1 ,v2 ,…,vi ) Add vi+1 : If vi+1  Qi , do nothing Else insert vi+1 by finding tangencies, updating the hull Expected cost of insertion: O(log n)

Each uninserted vj  Qi (j>i+1) points to the bucket (cone) containing it; each cone points to the list of uninserted vj  Qi within it (with its conflict edge) Add vi+1  Qi : Start from “conflict” edge e, and walk cw/ccw to establish new tangencies from vi+1 , charging walk to deleted vertices Rebucket points in affected cones (update lists for each bucket) Total work: O(n) + rebucketing work E(rebucket cost for vj at step i) = O(1)  P(rebucket)  O(1)  (2/i ) = O(1/i ) E(total rebucket cost for vj ) =  O(1/i ) = O(log n) Total expected work = O(n log n) e vi+1 Backwards Analysis: vj was just rebucketed iff the last point inserted was one of the 2 endpoints of the (current) conflict edge, e, for vj vj

More Demos Various 2D and 3D algorithms in an applet

More CG Applets Applets of algorithms in O’Rourke’s book Applets from Jack Snoeyink