Download presentation
Presentation is loading. Please wait.
Published byNathan Hart Modified over 9 years ago
1
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 has been stretched around the set S and released to conform as closely as possible to S. Formal Definition : The convex hull of a set S in space is the smallest convex polygon P for which every point in S must be on the boundary of P or in its interior. By: Aassem Jawhar
2
For example, the convex hull of three points in space is the planar triangle that has the three points as its vertices, and the convex hull of a cube in space is the solid cube. In these two links, we can see clearly what the convex hull is: Click here
3
Input Description: A set S of n points in d-dimensional space. Problem: Find the smallest convex polygon containing all the points of S. Convex Hull runs in 2-d, 3-d, 4-d, and higher dimensions, but the problem gets very hard to solve when it gets to 8-d and higher.
4
The most popular algorithms are the "Graham scan" algorithm [Graham, 1972] and the "divide-and- conquer" algorithm. Both are O(n log n) time algorithms, but the Graham scan runs very fast in 2D because it has a low runtime constant in 2D. However, the divide-and-conquer algorithm has natural extension in 3D and higher dimensions, but the Graham’s algorithm doesn’t generalize to 3D and higher dimensions.
5
In the following algorithms we do not consider 3D or higher dimensions. Here are list of some well-known 2D convex hull algorithms. N = number of points in the input set. H = number of vertices on the output hull. (Note that h £ n, so nh £ n2).
6
Discovered BySpeedAlgorithm [Anon, the dark ages]O(n 4 )Brute Force [Chand & Kapur, 1970]O(nh)Gift Wrapping [Graham, 1972]O(n log n)Graham Scan [Jarvis, 1973]O(nh)Jarvis March [Eddy, 1977], [Bykat, 1978]O(nh)QuickHull [Preparata & Hong, 1977]O(n log n)Divide-and-Conquer [Andrew, 1979]O(n log n)Monotone Chain [Kallay, 1984]O(n log n)Incremental [Kirkpatrick & Seidel, 1986]O(n log n)Marriage-before-Conquest
7
We will talk about two kinds of algorithms which are: 1) Graham’s Scan Algorithm. 2) Jarvis’s MarchAlgorithm. Graham’s Scan: This is the first algorithm we will examine for finding a convex hull which is called Graham's scan. It maintains a stack of candidate points to solve the convex hull problems. We push every point of the set S onto the stack, and the points that are not vertices of the convex hull H(S) are popped off as the algorithm runs. The stack will contain the vertices of the convex hull H(S) in counterclockwise order of their appearance on the boundary when the algorithm ends. Complexity = O(n log n)
8
The Graham’s Scan Algorithm: Step 1: we find the extreme point (pivot) which has the minimum y-coordinate, and we call it P0. (O(n)) - Notes: 1) we chose the minimum y-coordinate because it is guaranteed that it is on the hull. 2) If there are two points have the minimum y-coordinate, we choose the leftmost one. Step 2: We sort the other points of S in order of increasing the polar angle with respect to P0. Step 3: We build P0, P1, P2, …,Pk as long as Pk-1 Pk Pk+1 makes a left turn. - Note that Pk is on the top of the stack. Step 4: If Pk-1 Pk Pk+1 makes a Right Turn, we remove Pk’s (pop off from the stack) until it makes a left turn.
11
Click Here
12
Jarvis's march Jarvis's march uses the polar angles between each point and the other like Graham's scan. The only difference that March algorithm uses technique called gift wrapping or package wrapping. Complexity = O(nh)
13
Jarvis's march algorithm: This algorithm also called the "gift-wrapping" algorithm because this method marches around the hull in counter-clockwise order, like a ribbon wrapping itself around the points. Step 1: we choose the vertex with the least y-coordinate because this point is guaranteed to be on the hull H(s) and we call this vertex P0. Step 2: we choose the point (vertex) that has the least polar angle with respect to the previous point (vertex) in every step.
14
Step 3: We repeat step #3 till we reach the highest vertex ( the one that has the greatest y-coordinate). We will call this vertex Pk. At this point Pk, we have constructed all the points in what is called right chain of the hull H(s). Step 4: we start at Pk, and we choose Pk+1 which has the least polar angle with respect to Pk, but from the negative x-axis. Note: Think about this as turning the picture 180 degrees and think of it as another right chain. Step 5: We continue on, forming the left chain, by taking the polar angles from the negative x-axis, till we reach the original vertex P0.
15
Pseudo-code: Jarvis-March (P) ; P = (P 0,P 1,…,P n-1 )points p = p 0, the lowest point while p not highest point find point p m with minimum polar angle from p add p m to convex hull p = p m while p != p 0 find point p m with minimum polar angle from p add p m to convex hull p = p m
16
Example Click Here to see the Demo Click here to see another Demo
17
The End
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.