convex hull. university of manchester biologists used lasers to measure the minimum amount of skin...
TRANSCRIPT
Convex Hull
University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day mammals, including reindeer, polar bears, giraffes and elephants.
They discovered that the animals had almost exactly 21% more body mass than the minimum skeletal 'skin and bone' wrap volume, and applied this to a giant Brachiosaur skeleton in Berlin's Museum für Naturkunde.
--ScienceDaily (June 5, 2012)
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. Otherwise, it is called concave.
Convex
p
qR 1
p
qR 2
Concave
Convex Hull The convex hull CH(Q) of a set Q is
the smallest convex region that contains Q. When Q is finite, its convex hull is the unique convex polygon whose vertices are from Q and that contains all points of Q.
Rubber band
The Convex Hull Problem
Input: a set P = {p1, p2, …, pn} of points.
Output: a list of vertices of CH(P) in counterclockwise order.
Example:
CH(P)= { p2, p9, p5, p7, p10, p8}
8
pp
p
p
p
p
p
p
pp
9
210
5
76 1
3 4
Graham Scan
– incremental approach (similar to selection sort/insertion sort)
p 0
pp
pp
p
p
p
pp
p
12
3
4
p5
67
8
9
10
11
Graham Scan
Steps: Sort the angles form a convex hull of 1st three
points, add them to a stack push/pop the rest of the point on the
list based on we are make a right turn or left turn
Polar Angle
p
polar angle
x
y
q
r
Stack Initialization
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
2
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
3
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
4
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
4
p 5
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
4
p 6
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
4
p 6
p 7
p 8
p
pp
pp
p
p
p
pp
p
0
12
3
4
p5
67
8
9
10
11
p
p
p
S
0
1
4
p 6
p 7
p
pp
p
p
p
p
p
pp
p
0
12
3
4
p5
6
78
9
10
11
p
p
p
S
0
1
4
p 6
p 9
p10
p
pp
p
p
p
p
p
pp
p
0
12
3
4
p5
6
78
9
10
11
p
p
p
S
0
1
4
p 6
p 9
p11
Finish
p
pp
p
p
p
p
p
pp
p
0
12
3
4
p5
6
78
9
10
11
p
p
p
S
0
1
4
p 6
p 9
p11
Running time
The running time of Graham’s Scan is O(n lg n).
Jarvis march Gift wrapping
algorithm
How do we find the angle?
Complexity is O(hn)
Convex Hull - Divide and Conquer
Algorithm: Find a point with a median x coordinate (time:
O(n)) Compute the convex hull of each half
(recursive execution) Combine the two convex hulls by finding
common tangents.
Convex Hull - Divide and Conquer
If n ≤ 3, compute the hull by brute force o.w. divide points into A, B, where xi<xj,
piA, pjB. Recursively compute HA = Hull(A) and
HB = Hull(B). Merge the two hulls by computing the
upper and lower tangents for HA and HB and discarding all the points lying between these two tangents.
Convex Hull - CombineFinding the Lower Tangent LowerTangent (HA ;
HB ) : Let a be the rightmost point of HA . Let b be the leftmost point of HB . While ab is not a lower tangent for HA and HB do
While ab is not a lower tangent to HA do a = a - 1 (move a clockwise).
While ab is not a lower tangent to HB do b = b + 1 (move b counterclockwise).
Return ab.
Combine (a,b)=(right most, left most) …
a
b
Complexity
Complexity: O(nlogn)
Quick Hull
Quick hull – based on the idea of quick sort
S
Quick Hull Partition
l
r
L
S(1)
S(2)
Quick Hull
l
r
Quick Hull
l
r
LL1
L2
S(1,1)
S(1,2)
eliminated
h
Quick Hull
L
l
r
L1
L2
S(1,2,2)
h
S(1,2)
Quick Hull
Complexity T(n) = O(n2) worst case T(n) = O(nlogn) average and best case
Graphs