SlideShare a Scribd company logo
1 of 77
Download to read offline
CONVEX HULLS
Chan's optimal output sensitive
algorithms for convex hulls
Alberto Parravicini
Université libre de Bruxelles
December 15, 2016
What's on the menu?
→ Basic notions
2
What's on the menu?
→ Basic notions
→ Algorithms for convex hulls
2
What's on the menu?
→ Basic notions
→ Algorithms for convex hulls
→ Optimal 2D algorithm
2
What's on the menu?
→ Basic notions
→ Algorithms for convex hulls
→ Optimal 2D algorithm
→ Optimal 3D algorithm
2
basic notions
Crash course on convex hulls
A convex set S is a set in which, ∀ x, y ∈ S, the
segment xy ⊆ S.
Given a set of points P in d dimensions, the
Convex Hull CH(P) of P is:
4
Crash course on convex hulls
A convex set S is a set in which, ∀ x, y ∈ S, the
segment xy ⊆ S.
Given a set of points P in d dimensions, the
Convex Hull CH(P) of P is:
→ the minimal convex set containing P.
4
Crash course on convex hulls
A convex set S is a set in which, ∀ x, y ∈ S, the
segment xy ⊆ S.
Given a set of points P in d dimensions, the
Convex Hull CH(P) of P is:
→ the minimal convex set containing P.
→ the union of all convex combinations of
points in P, i.e. the points CH(P) are s.t.
|P|
∑
i=1
wi · xi, ∀xi ∈ P, ∀wi : wi ≥ 0 and
|P|
∑
i=1
wi = 1
4
Output sensitive algorithm
The complexity of an output-sensitive
algorithm is a function of both the input size
and the output size.
5
algorithms for convex hulls
Jarvis's march
→ Core idea: given an edge pq of the convex
hull, the next edge qr to be added will
maximize the angle ∠∠∠pqr
7
Jarvis's march
→ Core idea: given an edge pq of the convex
hull, the next edge qr to be added will
maximize the angle ∠∠∠pqr
→ At each step we scan all the n points.
7
Jarvis's march
→ Core idea: given an edge pq of the convex
hull, the next edge qr to be added will
maximize the angle ∠∠∠pqr
→ At each step we scan all the n points.
→ How many steps? h, size of the hull.
7
Jarvis's march
→ Core idea: given an edge pq of the convex
hull, the next edge qr to be added will
maximize the angle ∠∠∠pqr
→ At each step we scan all the n points.
→ How many steps? h, size of the hull.
→ Complexity: O(nh)
7
One step, visually
Figure: A step of the Jarvis March. The red line is the next
segment that will be added to the hull.
8
Jarvis's march
Algorithm 1: Jarvis March
Input: a list S of bidimensional points.
Output: the convex hull of the set, sorted counterclockwise.
hull =[]
x0 = the leftmost point.
hull.push(x0)
Loop hull.last() != hull.first()
candidate = S.first()
foreach p in S do
if p != hull.last() and p is on the right of the segment
”hull.last(), candidate” then
candidate = p
if candidate != hull.first then hull.push(candidate) else break
return hull
9
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
10
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
→ Keep the current hull in a stack
H = {h0, . . . , hcurr}.
10
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
→ Keep the current hull in a stack
H = {h0, . . . , hcurr}.
→ Inspect each point p in order - Cost: O(n)
10
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
→ Keep the current hull in a stack
H = {h0, . . . , hcurr}.
→ Inspect each point p in order - Cost: O(n)
→ While hcurr−1hcurrp is a right turn, pop hcurr.
10
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
→ Keep the current hull in a stack
H = {h0, . . . , hcurr}.
→ Inspect each point p in order - Cost: O(n)
→ While hcurr−1hcurrp is a right turn, pop hcurr.
→ Push p to H.
10
Graham's scan
→ Sort the points in clockwise order around
the leftmost point - Cost: O(n log n)
→ Keep the current hull in a stack
H = {h0, . . . , hcurr}.
→ Inspect each point p in order - Cost: O(n)
→ While hcurr−1hcurrp is a right turn, pop hcurr.
→ Push p to H.
→ Overall complexity: O(n log n)
10
Graham's scan
Algorithm 2: Graham Scan
Input: a list S of bidimensional points.
Output: the convex hull of the set, sorted counterclockwise.
hull =[]
x0 = the leftmost point.
Put x0 as the first element of S.
Sort the remaining points in counter-clockwise order, with
respect to x0.
Add the first 3 points in S to the hull.
forall the remaining points in S do
while hull.second_to_last(), hull.last(), p form a right turn do
hull.pop()
hull.push(p)
return hull
11
Can we do better?
So far:
12
Can we do better?
So far:
→ Jarvis’s march: O(nh)
12
Can we do better?
So far:
→ Jarvis’s march: O(nh)
→ Graham’s scan: O(n log n)
12
Can we do better?
So far:
→ Jarvis’s march: O(nh)
→ Graham’s scan: O(n log n)
→ How do we compare their complexity?
12
Can we do better?
So far:
→ Jarvis’s march: O(nh)
→ Graham’s scan: O(n log n)
→ How do we compare their complexity?
→ We would like to do even better!
12
Can we do better?
So far:
→ Jarvis’s march: O(nh)
→ Graham’s scan: O(n log n)
→ How do we compare their complexity?
→ We would like to do even better!
Can we get to O(n log h)?
12
chan's 2d algorithm
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
→ Algorithm (Chan 2D):
→ Split the n points in groups of size m
(⌈n/m⌉ groups).
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
→ Algorithm (Chan 2D):
→ Split the n points in groups of size m
(⌈n/m⌉ groups).
→ Compute the hull Hi of each group
Cost: O((n/m) · (m log m)) = O(n log m)
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
→ Algorithm (Chan 2D):
→ Split the n points in groups of size m
(⌈n/m⌉ groups).
→ Compute the hull Hi of each group
Cost: O((n/m) · (m log m)) = O(n log m)
→ Until the hull is complete, repeat:
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
→ Algorithm (Chan 2D):
→ Split the n points in groups of size m
(⌈n/m⌉ groups).
→ Compute the hull Hi of each group
Cost: O((n/m) · (m log m)) = O(n log m)
→ Until the hull is complete, repeat:
→ Given the current hull Htot = {h0, . . . , hcurr},
find for each Hi the point right tangent to
hcurr (binary search, O(log m)⌈n/m⌉).
14
Chan's 2D algorithm
→ Idea: Some points will never be in the hull!
Discard them to speed up Jarvis’s march.
→ Combine Jarvis’s march and Graham’s scan.
→ Algorithm (Chan 2D):
→ Split the n points in groups of size m
(⌈n/m⌉ groups).
→ Compute the hull Hi of each group
Cost: O((n/m) · (m log m)) = O(n log m)
→ Until the hull is complete, repeat:
→ Given the current hull Htot = {h0, . . . , hcurr},
find for each Hi the point right tangent to
hcurr (binary search, O(log m)⌈n/m⌉).
→ Pick the tangent point p that maximizes
∠hcurr−1hcurrp.
14
One step, visually
Figure: A step of Chan’s algorithm. In blue, the existing
hull, in orange, the tangents, in red, the new edge that
will be added.
15
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
With m = h, we get complexity
O(n log h + (h(n/h)log h)) = O(n log h)
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
With m = h, we get complexity
O(n log h + (h(n/h)log h)) = O(n log h)
But h is not known!
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
With m = h, we get complexity
O(n log h + (h(n/h)log h)) = O(n log h)
But h is not known!
→ Reiterate the algorithm, with m = 22i
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
With m = h, we get complexity
O(n log h + (h(n/h)log h)) = O(n log h)
But h is not known!
→ Reiterate the algorithm, with m = 22i
→ Iteration cost: O(n log H) = O(n2i
)
16
Chan's 2D algorithm, part 2
Complexity: O(n log m + (h(n/m)log m))
What about m? Let’s pretend the size h of
the final hull is know.
With m = h, we get complexity
O(n log h + (h(n/h)log h)) = O(n log h)
But h is not known!
→ Reiterate the algorithm, with m = 22i
→ Iteration cost: O(n log H) = O(n2i
)
→ O
(∑⌈log log h⌉
i=1 n2i
)
= O(n2⌈log log h⌉+1
) = O(n log h)
16
Chan's 2D pseudo-code
Algorithm 3: ChanHullStep, a step of Chan’s
algorithm
Input: a list S of bidimensional points, the parameters m, H
Output: the convex hull of the set, sorted counterclockwise, or an empty list, if H
is < h
Partition S into subsets S1, . . . , S⌈n/m⌉.
for i = 1, . . . , ⌈n/m⌉ do
Compute the convex hull of Si by using Graham Scan, store the output in a
counter-clockwise sorted list.
p0 = (0, −∞)
p1 = the leftmost point of S.
for k = 1, . . . , H do
for i = 1, . . . , ⌈n/m⌉ do
Compute the points qi ∈ S that maximizes ∠pk−1pkqi, with qi ̸= pk, by
performing binary search on the vertices of the partial hull Si.
pk+1 = the point q ∈ {q1, . . . , q⌈n/m⌉}.
if pk+1 = pt then return {p1, . . . , pk}
return incomplete
17
Chan's 2D pseudo-code, reprise
Algorithm 4: Chan’s algorithm
Input: a list S of bidimensional points
Output: the convex hull of the set
for i = 1, 2, . . . do
L = ChanHullStep(S, m, H), where m = H = min{|S|, 22i
}
if L ̸= incomplete then return L
18
Chan's 2D - Empirical analysis
Is a real implementation O(n log h)?
Test 1: fixed hull size (1000), increasing number of
points.
0
10
20
30
40
50
50000
100000
150000
200000
Number of Points
Executiontime[sec]
Linear Model Real Data
19
Chan's 2D - Empirical analysis
Is a real implementation O(n log h)?
Test 2: fixed number of points (40000), increasing
hull size.
8
9
10
11 5000
10000
15000
20000
Size of the Hull
Executiontime[sec]
Logarithmic Model Real Data
20
chan's 3d algorithm
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
22
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
Given a set S of n points with an hull of size h:
22
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
Given a set S of n points with an hull of size h:
→ Jarvis's march −→ Chand and Kapur's gift
wrapping - O(nh).
22
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
Given a set S of n points with an hull of size h:
→ Jarvis's march −→ Chand and Kapur's gift
wrapping - O(nh).
→ Graham's scan −→ Preparata and Hong 3D
Algorithm - O(n log n).
22
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
Given a set S of n points with an hull of size h:
→ Jarvis's march −→ Chand and Kapur's gift
wrapping - O(nh).
→ Graham's scan −→ Preparata and Hong 3D
Algorithm - O(n log n).
→ Finding tangents in 2D −→ Supporting planes
in 3D with Dobkin-Kirkpatrick hierarchy -
O(log n).
22
Chan's 3D algorithm
→ Idea: The structure of the algorithm doesn’t
change, just the ingredients.
Given a set S of n points with an hull of size h:
→ Jarvis's march −→ Chand and Kapur's gift
wrapping - O(nh).
→ Graham's scan −→ Preparata and Hong 3D
Algorithm - O(n log n).
→ Finding tangents in 2D −→ Supporting planes
in 3D with Dobkin-Kirkpatrick hierarchy -
O(log n).
The overall complexity is still O(n log h).
22
Chan's 3D algorithm
→ 3D Gift wrapping
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
→ Use breadth first visit to build the entire hull.
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
→ Use breadth first visit to build the entire hull.
→ Preparata and Hong 3D algorithm, a
divide-and-conquer algorithm for convex
hulls
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
→ Use breadth first visit to build the entire hull.
→ Preparata and Hong 3D algorithm, a
divide-and-conquer algorithm for convex
hulls
→ Split the set of points S in S1 and S2.
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
→ Use breadth first visit to build the entire hull.
→ Preparata and Hong 3D algorithm, a
divide-and-conquer algorithm for convex
hulls
→ Split the set of points S in S1 and S2.
→ Recursively split until the base case, then build
the convex hull.
23
Chan's 3D algorithm
→ 3D Gift wrapping
→ Pick an edge ej of a face f of the partial hull.
→ Find p that maximizes the angle between f and
the new face given by ej and p. Repeat for the 3
edges of f.
→ Use breadth first visit to build the entire hull.
→ Preparata and Hong 3D algorithm, a
divide-and-conquer algorithm for convex
hulls
→ Split the set of points S in S1 and S2.
→ Recursively split until the base case, then build
the convex hull.
→ Merge the partial hulls.
23
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
→ Finding supporting planes in 3D
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
→ Finding supporting planes in 3D
→ Goal: given an edge ej and the DK hierarchy of a
partial hull Hi, find the plane passing through ej
and tangent to Hi in pt.
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
→ Finding supporting planes in 3D
→ Goal: given an edge ej and the DK hierarchy of a
partial hull Hi, find the plane passing through ej
and tangent to Hi in pt.
→ Find pt in constant time in Pk
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
→ Finding supporting planes in 3D
→ Goal: given an edge ej and the DK hierarchy of a
partial hull Hi, find the plane passing through ej
and tangent to Hi in pt.
→ Find pt in constant time in Pk
→ Step up in the hierarchy: if pt changes, it will
move to a neighbour (constant time check).
24
Chan's 3D algorithm
→ To find supporting planes, store each partial
hull as a Dobkin-Kirkpatrick hierarchy
→ Sequence P0, . . . , Pk of increasingly smaller
approximations of a polyhedron P = P0.
→ Build Pi+1 from Pi by picking a maximal set of
independent vertices of Pi.
→ Overall, building the hierarchies takes O(n).
→ Finding supporting planes in 3D
→ Goal: given an edge ej and the DK hierarchy of a
partial hull Hi, find the plane passing through ej
and tangent to Hi in pt.
→ Find pt in constant time in Pk
→ Step up in the hierarchy: if pt changes, it will
move to a neighbour (constant time check).
→ The DK hierarchy has O(log m) height.
24
THANK YOU!
References I
[1] C. Bradford Barber, David P. Dobkin, and Huhdanpaa Hannu.
The quickhull algorithm for convex hulls.
1995.
[2] T. M. Chan.
Optimal output-sensitive convex hull algorithms in two and three
dimensions.
Discrete & Computational Geometry, 16(4):361–368, 1996.
[3] Donald R. Chand and Sham S. Kapur.
[4] Ioannis Z. Emiris and John F. Canny.
An efficient approach to removing geometric degeneracies.
Technical report, 1991.
[5] Christer Ericson.
Real-Time Collision Detection.
CRC Press, Inc., Boca Raton, FL, USA, 2004.
[6] A. Goshtasby and G. C. Stockman.
Point pattern matching using convex hull edges.
IEEE Transactions on Systems, Man, and Cybernetics, SMC-15(5), 1985.
26
References II
[7] David G. Kirkpatrick and Raimund Seidel.
The ultimate planar convex hull algorithm ?
Technical report, 1983.
[8] Joseph O’Rourke.
Computational Geometry in C.
Cambridge University Press, 2nd edition, 1998.
[9] F. P. Preparata and S. J. Hong.
Convex hulls of finite sets of points in two and three dimensions.
Commun. ACM, 20(2):87–93, February 1977.
[10] Franco P. Preparata and Michael I. Shamos.
Computational Geometry: An Introduction.
Springer-Verlag New York, Inc., 1985.
[11] Franco P. Preparata and Michael I. Shamos.
Computational Geometry: An Introduction.
Springer-Verlag New York, Inc., 1985.
Beamer theme: Presento, by Ratul Saha. The research system in Germany, by
Hazem Alsaied
27

More Related Content

What's hot

AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAndrew Ferlitsch
 
Surface areas and volumes
Surface areas and volumesSurface areas and volumes
Surface areas and volumesarpangoyal5680
 
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...Animesh Chaturvedi
 
Probability & Information theory
Probability & Information theoryProbability & Information theory
Probability & Information theory성재 최
 
Minimum spanning tree (mst)
Minimum spanning tree (mst)Minimum spanning tree (mst)
Minimum spanning tree (mst)Pradeep Behera
 
Soh Cah Toa Indian
Soh Cah Toa IndianSoh Cah Toa Indian
Soh Cah Toa Indianguest6ba711
 
Category Theory for Programmers
Category Theory for ProgrammersCategory Theory for Programmers
Category Theory for ProgrammersSantosh Rajan
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programmingKrish_ver2
 
strassen matrix multiplication algorithm
strassen matrix multiplication algorithmstrassen matrix multiplication algorithm
strassen matrix multiplication algorithmevil eye
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Machine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree LearningMachine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree Learningbutest
 
Heap Sort || Heapify Method || Build Max Heap Algorithm
Heap Sort || Heapify Method || Build Max Heap AlgorithmHeap Sort || Heapify Method || Build Max Heap Algorithm
Heap Sort || Heapify Method || Build Max Heap AlgorithmLearning Courses Online
 
K means clustering
K means clusteringK means clustering
K means clusteringAhmedasbasb
 

What's hot (20)

AI Greedy and A-STAR Search
AI Greedy and A-STAR SearchAI Greedy and A-STAR Search
AI Greedy and A-STAR Search
 
Surface areas and volumes
Surface areas and volumesSurface areas and volumes
Surface areas and volumes
 
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
Shortest path, Bellman-Ford's algorithm, Dijkastra's algorithm, their Java co...
 
Probability & Information theory
Probability & Information theoryProbability & Information theory
Probability & Information theory
 
convex hull
convex hullconvex hull
convex hull
 
Maximum sum subarray
Maximum sum subarrayMaximum sum subarray
Maximum sum subarray
 
Minimum spanning tree (mst)
Minimum spanning tree (mst)Minimum spanning tree (mst)
Minimum spanning tree (mst)
 
Convex Hull Algorithms
Convex Hull AlgorithmsConvex Hull Algorithms
Convex Hull Algorithms
 
Soh Cah Toa Indian
Soh Cah Toa IndianSoh Cah Toa Indian
Soh Cah Toa Indian
 
Category Theory for Programmers
Category Theory for ProgrammersCategory Theory for Programmers
Category Theory for Programmers
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
 
Decision tree and random forest
Decision tree and random forestDecision tree and random forest
Decision tree and random forest
 
strassen matrix multiplication algorithm
strassen matrix multiplication algorithmstrassen matrix multiplication algorithm
strassen matrix multiplication algorithm
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Machine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree LearningMachine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree Learning
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Heap Sort || Heapify Method || Build Max Heap Algorithm
Heap Sort || Heapify Method || Build Max Heap AlgorithmHeap Sort || Heapify Method || Build Max Heap Algorithm
Heap Sort || Heapify Method || Build Max Heap Algorithm
 
K means clustering
K means clusteringK means clustering
K means clustering
 
Heap sort
Heap sortHeap sort
Heap sort
 
trees-and-forest.pdf
trees-and-forest.pdftrees-and-forest.pdf
trees-and-forest.pdf
 

Viewers also liked

Convex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisConvex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisRex Yuan
 
An Efficient Convex Hull Algorithm for a Planer Set of Points
An Efficient Convex Hull Algorithm for a Planer Set of PointsAn Efficient Convex Hull Algorithm for a Planer Set of Points
An Efficient Convex Hull Algorithm for a Planer Set of PointsKasun Ranga Wijeweera
 
project presentation on mouse simulation using finger tip detection
project presentation on mouse simulation using finger tip detection project presentation on mouse simulation using finger tip detection
project presentation on mouse simulation using finger tip detection Sumit Varshney
 
morphological image processing
morphological image processingmorphological image processing
morphological image processingJohn Williams
 

Viewers also liked (6)

Convex Hull Algorithm Analysis
Convex Hull Algorithm AnalysisConvex Hull Algorithm Analysis
Convex Hull Algorithm Analysis
 
An Efficient Convex Hull Algorithm for a Planer Set of Points
An Efficient Convex Hull Algorithm for a Planer Set of PointsAn Efficient Convex Hull Algorithm for a Planer Set of Points
An Efficient Convex Hull Algorithm for a Planer Set of Points
 
project presentation on mouse simulation using finger tip detection
project presentation on mouse simulation using finger tip detection project presentation on mouse simulation using finger tip detection
project presentation on mouse simulation using finger tip detection
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Hand gesture recognition
Hand gesture recognitionHand gesture recognition
Hand gesture recognition
 
Gesture recognition
Gesture recognitionGesture recognition
Gesture recognition
 

Similar to Convex hulls & Chan's algorithm

Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
An algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesAn algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesVissarion Fisikopoulos
 
14th Athens Colloquium on Algorithms and Complexity (ACAC19)
14th Athens Colloquium on Algorithms and Complexity (ACAC19)14th Athens Colloquium on Algorithms and Complexity (ACAC19)
14th Athens Colloquium on Algorithms and Complexity (ACAC19)Apostolos Chalkis
 
Geometric Separators and the Parabolic Lift
Geometric Separators and the Parabolic LiftGeometric Separators and the Parabolic Lift
Geometric Separators and the Parabolic LiftDon Sheehy
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpMath Homework Solver
 
"An output-sensitive algorithm for computing projections of resultant polytop...
"An output-sensitive algorithm for computing projections of resultant polytop..."An output-sensitive algorithm for computing projections of resultant polytop...
"An output-sensitive algorithm for computing projections of resultant polytop...Vissarion Fisikopoulos
 
Mining of massive datasets
Mining of massive datasetsMining of massive datasets
Mining of massive datasetsAshic Mahtab
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniquescseiitgn
 
A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisCharaf Ech-Chatbi
 
A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisCharaf Ech-Chatbi
 
Conctructing Polytopes via a Vertex Oracle
Conctructing Polytopes via a Vertex OracleConctructing Polytopes via a Vertex Oracle
Conctructing Polytopes via a Vertex OracleVissarion Fisikopoulos
 
Volume and edge skeleton computation in high dimensions
Volume and edge skeleton computation in high dimensionsVolume and edge skeleton computation in high dimensions
Volume and edge skeleton computation in high dimensionsVissarion Fisikopoulos
 
Perron method for the Dirichlet problem
Perron method for the Dirichlet problemPerron method for the Dirichlet problem
Perron method for the Dirichlet problemMichael Maltese
 
A Tutorial on Computational Geometry
A Tutorial on Computational GeometryA Tutorial on Computational Geometry
A Tutorial on Computational GeometryMinh-Tri Pham
 
module4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdfmodule4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdfShiwani Gupta
 
Approximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsApproximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsShrey Verma
 

Similar to Convex hulls & Chan's algorithm (20)

Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
An algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesAn algorithm for computing resultant polytopes
An algorithm for computing resultant polytopes
 
14th Athens Colloquium on Algorithms and Complexity (ACAC19)
14th Athens Colloquium on Algorithms and Complexity (ACAC19)14th Athens Colloquium on Algorithms and Complexity (ACAC19)
14th Athens Colloquium on Algorithms and Complexity (ACAC19)
 
Geometric Separators and the Parabolic Lift
Geometric Separators and the Parabolic LiftGeometric Separators and the Parabolic Lift
Geometric Separators and the Parabolic Lift
 
Single Variable Calculus Assignment Help
Single Variable Calculus Assignment HelpSingle Variable Calculus Assignment Help
Single Variable Calculus Assignment Help
 
"An output-sensitive algorithm for computing projections of resultant polytop...
"An output-sensitive algorithm for computing projections of resultant polytop..."An output-sensitive algorithm for computing projections of resultant polytop...
"An output-sensitive algorithm for computing projections of resultant polytop...
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Mining of massive datasets
Mining of massive datasetsMining of massive datasets
Mining of massive datasets
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniques
 
QMC: Transition Workshop - Probabilistic Integrators for Deterministic Differ...
QMC: Transition Workshop - Probabilistic Integrators for Deterministic Differ...QMC: Transition Workshop - Probabilistic Integrators for Deterministic Differ...
QMC: Transition Workshop - Probabilistic Integrators for Deterministic Differ...
 
QMC: Transition Workshop - Density Estimation by Randomized Quasi-Monte Carlo...
QMC: Transition Workshop - Density Estimation by Randomized Quasi-Monte Carlo...QMC: Transition Workshop - Density Estimation by Randomized Quasi-Monte Carlo...
QMC: Transition Workshop - Density Estimation by Randomized Quasi-Monte Carlo...
 
A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann Hypothesis
 
A Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann HypothesisA Proof of the Generalized Riemann Hypothesis
A Proof of the Generalized Riemann Hypothesis
 
Conctructing Polytopes via a Vertex Oracle
Conctructing Polytopes via a Vertex OracleConctructing Polytopes via a Vertex Oracle
Conctructing Polytopes via a Vertex Oracle
 
cswiercz-general-presentation
cswiercz-general-presentationcswiercz-general-presentation
cswiercz-general-presentation
 
Volume and edge skeleton computation in high dimensions
Volume and edge skeleton computation in high dimensionsVolume and edge skeleton computation in high dimensions
Volume and edge skeleton computation in high dimensions
 
Perron method for the Dirichlet problem
Perron method for the Dirichlet problemPerron method for the Dirichlet problem
Perron method for the Dirichlet problem
 
A Tutorial on Computational Geometry
A Tutorial on Computational GeometryA Tutorial on Computational Geometry
A Tutorial on Computational Geometry
 
module4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdfmodule4_dynamic programming_2022.pdf
module4_dynamic programming_2022.pdf
 
Approximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsApproximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher Dimensions
 

Recently uploaded

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 

Recently uploaded (20)

Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 

Convex hulls & Chan's algorithm

  • 1. CONVEX HULLS Chan's optimal output sensitive algorithms for convex hulls Alberto Parravicini Université libre de Bruxelles December 15, 2016
  • 2. What's on the menu? → Basic notions 2
  • 3. What's on the menu? → Basic notions → Algorithms for convex hulls 2
  • 4. What's on the menu? → Basic notions → Algorithms for convex hulls → Optimal 2D algorithm 2
  • 5. What's on the menu? → Basic notions → Algorithms for convex hulls → Optimal 2D algorithm → Optimal 3D algorithm 2
  • 7. Crash course on convex hulls A convex set S is a set in which, ∀ x, y ∈ S, the segment xy ⊆ S. Given a set of points P in d dimensions, the Convex Hull CH(P) of P is: 4
  • 8. Crash course on convex hulls A convex set S is a set in which, ∀ x, y ∈ S, the segment xy ⊆ S. Given a set of points P in d dimensions, the Convex Hull CH(P) of P is: → the minimal convex set containing P. 4
  • 9. Crash course on convex hulls A convex set S is a set in which, ∀ x, y ∈ S, the segment xy ⊆ S. Given a set of points P in d dimensions, the Convex Hull CH(P) of P is: → the minimal convex set containing P. → the union of all convex combinations of points in P, i.e. the points CH(P) are s.t. |P| ∑ i=1 wi · xi, ∀xi ∈ P, ∀wi : wi ≥ 0 and |P| ∑ i=1 wi = 1 4
  • 10. Output sensitive algorithm The complexity of an output-sensitive algorithm is a function of both the input size and the output size. 5
  • 12. Jarvis's march → Core idea: given an edge pq of the convex hull, the next edge qr to be added will maximize the angle ∠∠∠pqr 7
  • 13. Jarvis's march → Core idea: given an edge pq of the convex hull, the next edge qr to be added will maximize the angle ∠∠∠pqr → At each step we scan all the n points. 7
  • 14. Jarvis's march → Core idea: given an edge pq of the convex hull, the next edge qr to be added will maximize the angle ∠∠∠pqr → At each step we scan all the n points. → How many steps? h, size of the hull. 7
  • 15. Jarvis's march → Core idea: given an edge pq of the convex hull, the next edge qr to be added will maximize the angle ∠∠∠pqr → At each step we scan all the n points. → How many steps? h, size of the hull. → Complexity: O(nh) 7
  • 16. One step, visually Figure: A step of the Jarvis March. The red line is the next segment that will be added to the hull. 8
  • 17. Jarvis's march Algorithm 1: Jarvis March Input: a list S of bidimensional points. Output: the convex hull of the set, sorted counterclockwise. hull =[] x0 = the leftmost point. hull.push(x0) Loop hull.last() != hull.first() candidate = S.first() foreach p in S do if p != hull.last() and p is on the right of the segment ”hull.last(), candidate” then candidate = p if candidate != hull.first then hull.push(candidate) else break return hull 9
  • 18. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) 10
  • 19. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) → Keep the current hull in a stack H = {h0, . . . , hcurr}. 10
  • 20. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) → Keep the current hull in a stack H = {h0, . . . , hcurr}. → Inspect each point p in order - Cost: O(n) 10
  • 21. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) → Keep the current hull in a stack H = {h0, . . . , hcurr}. → Inspect each point p in order - Cost: O(n) → While hcurr−1hcurrp is a right turn, pop hcurr. 10
  • 22. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) → Keep the current hull in a stack H = {h0, . . . , hcurr}. → Inspect each point p in order - Cost: O(n) → While hcurr−1hcurrp is a right turn, pop hcurr. → Push p to H. 10
  • 23. Graham's scan → Sort the points in clockwise order around the leftmost point - Cost: O(n log n) → Keep the current hull in a stack H = {h0, . . . , hcurr}. → Inspect each point p in order - Cost: O(n) → While hcurr−1hcurrp is a right turn, pop hcurr. → Push p to H. → Overall complexity: O(n log n) 10
  • 24. Graham's scan Algorithm 2: Graham Scan Input: a list S of bidimensional points. Output: the convex hull of the set, sorted counterclockwise. hull =[] x0 = the leftmost point. Put x0 as the first element of S. Sort the remaining points in counter-clockwise order, with respect to x0. Add the first 3 points in S to the hull. forall the remaining points in S do while hull.second_to_last(), hull.last(), p form a right turn do hull.pop() hull.push(p) return hull 11
  • 25. Can we do better? So far: 12
  • 26. Can we do better? So far: → Jarvis’s march: O(nh) 12
  • 27. Can we do better? So far: → Jarvis’s march: O(nh) → Graham’s scan: O(n log n) 12
  • 28. Can we do better? So far: → Jarvis’s march: O(nh) → Graham’s scan: O(n log n) → How do we compare their complexity? 12
  • 29. Can we do better? So far: → Jarvis’s march: O(nh) → Graham’s scan: O(n log n) → How do we compare their complexity? → We would like to do even better! 12
  • 30. Can we do better? So far: → Jarvis’s march: O(nh) → Graham’s scan: O(n log n) → How do we compare their complexity? → We would like to do even better! Can we get to O(n log h)? 12
  • 32. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. 14
  • 33. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. 14
  • 34. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. → Algorithm (Chan 2D): → Split the n points in groups of size m (⌈n/m⌉ groups). 14
  • 35. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. → Algorithm (Chan 2D): → Split the n points in groups of size m (⌈n/m⌉ groups). → Compute the hull Hi of each group Cost: O((n/m) · (m log m)) = O(n log m) 14
  • 36. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. → Algorithm (Chan 2D): → Split the n points in groups of size m (⌈n/m⌉ groups). → Compute the hull Hi of each group Cost: O((n/m) · (m log m)) = O(n log m) → Until the hull is complete, repeat: 14
  • 37. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. → Algorithm (Chan 2D): → Split the n points in groups of size m (⌈n/m⌉ groups). → Compute the hull Hi of each group Cost: O((n/m) · (m log m)) = O(n log m) → Until the hull is complete, repeat: → Given the current hull Htot = {h0, . . . , hcurr}, find for each Hi the point right tangent to hcurr (binary search, O(log m)⌈n/m⌉). 14
  • 38. Chan's 2D algorithm → Idea: Some points will never be in the hull! Discard them to speed up Jarvis’s march. → Combine Jarvis’s march and Graham’s scan. → Algorithm (Chan 2D): → Split the n points in groups of size m (⌈n/m⌉ groups). → Compute the hull Hi of each group Cost: O((n/m) · (m log m)) = O(n log m) → Until the hull is complete, repeat: → Given the current hull Htot = {h0, . . . , hcurr}, find for each Hi the point right tangent to hcurr (binary search, O(log m)⌈n/m⌉). → Pick the tangent point p that maximizes ∠hcurr−1hcurrp. 14
  • 39. One step, visually Figure: A step of Chan’s algorithm. In blue, the existing hull, in orange, the tangents, in red, the new edge that will be added. 15
  • 40. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) 16
  • 41. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. 16
  • 42. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. With m = h, we get complexity O(n log h + (h(n/h)log h)) = O(n log h) 16
  • 43. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. With m = h, we get complexity O(n log h + (h(n/h)log h)) = O(n log h) But h is not known! 16
  • 44. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. With m = h, we get complexity O(n log h + (h(n/h)log h)) = O(n log h) But h is not known! → Reiterate the algorithm, with m = 22i 16
  • 45. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. With m = h, we get complexity O(n log h + (h(n/h)log h)) = O(n log h) But h is not known! → Reiterate the algorithm, with m = 22i → Iteration cost: O(n log H) = O(n2i ) 16
  • 46. Chan's 2D algorithm, part 2 Complexity: O(n log m + (h(n/m)log m)) What about m? Let’s pretend the size h of the final hull is know. With m = h, we get complexity O(n log h + (h(n/h)log h)) = O(n log h) But h is not known! → Reiterate the algorithm, with m = 22i → Iteration cost: O(n log H) = O(n2i ) → O (∑⌈log log h⌉ i=1 n2i ) = O(n2⌈log log h⌉+1 ) = O(n log h) 16
  • 47. Chan's 2D pseudo-code Algorithm 3: ChanHullStep, a step of Chan’s algorithm Input: a list S of bidimensional points, the parameters m, H Output: the convex hull of the set, sorted counterclockwise, or an empty list, if H is < h Partition S into subsets S1, . . . , S⌈n/m⌉. for i = 1, . . . , ⌈n/m⌉ do Compute the convex hull of Si by using Graham Scan, store the output in a counter-clockwise sorted list. p0 = (0, −∞) p1 = the leftmost point of S. for k = 1, . . . , H do for i = 1, . . . , ⌈n/m⌉ do Compute the points qi ∈ S that maximizes ∠pk−1pkqi, with qi ̸= pk, by performing binary search on the vertices of the partial hull Si. pk+1 = the point q ∈ {q1, . . . , q⌈n/m⌉}. if pk+1 = pt then return {p1, . . . , pk} return incomplete 17
  • 48. Chan's 2D pseudo-code, reprise Algorithm 4: Chan’s algorithm Input: a list S of bidimensional points Output: the convex hull of the set for i = 1, 2, . . . do L = ChanHullStep(S, m, H), where m = H = min{|S|, 22i } if L ̸= incomplete then return L 18
  • 49. Chan's 2D - Empirical analysis Is a real implementation O(n log h)? Test 1: fixed hull size (1000), increasing number of points. 0 10 20 30 40 50 50000 100000 150000 200000 Number of Points Executiontime[sec] Linear Model Real Data 19
  • 50. Chan's 2D - Empirical analysis Is a real implementation O(n log h)? Test 2: fixed number of points (40000), increasing hull size. 8 9 10 11 5000 10000 15000 20000 Size of the Hull Executiontime[sec] Logarithmic Model Real Data 20
  • 52. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. 22
  • 53. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. Given a set S of n points with an hull of size h: 22
  • 54. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. Given a set S of n points with an hull of size h: → Jarvis's march −→ Chand and Kapur's gift wrapping - O(nh). 22
  • 55. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. Given a set S of n points with an hull of size h: → Jarvis's march −→ Chand and Kapur's gift wrapping - O(nh). → Graham's scan −→ Preparata and Hong 3D Algorithm - O(n log n). 22
  • 56. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. Given a set S of n points with an hull of size h: → Jarvis's march −→ Chand and Kapur's gift wrapping - O(nh). → Graham's scan −→ Preparata and Hong 3D Algorithm - O(n log n). → Finding tangents in 2D −→ Supporting planes in 3D with Dobkin-Kirkpatrick hierarchy - O(log n). 22
  • 57. Chan's 3D algorithm → Idea: The structure of the algorithm doesn’t change, just the ingredients. Given a set S of n points with an hull of size h: → Jarvis's march −→ Chand and Kapur's gift wrapping - O(nh). → Graham's scan −→ Preparata and Hong 3D Algorithm - O(n log n). → Finding tangents in 2D −→ Supporting planes in 3D with Dobkin-Kirkpatrick hierarchy - O(log n). The overall complexity is still O(n log h). 22
  • 58. Chan's 3D algorithm → 3D Gift wrapping 23
  • 59. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. 23
  • 60. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. 23
  • 61. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. → Use breadth first visit to build the entire hull. 23
  • 62. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. → Use breadth first visit to build the entire hull. → Preparata and Hong 3D algorithm, a divide-and-conquer algorithm for convex hulls 23
  • 63. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. → Use breadth first visit to build the entire hull. → Preparata and Hong 3D algorithm, a divide-and-conquer algorithm for convex hulls → Split the set of points S in S1 and S2. 23
  • 64. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. → Use breadth first visit to build the entire hull. → Preparata and Hong 3D algorithm, a divide-and-conquer algorithm for convex hulls → Split the set of points S in S1 and S2. → Recursively split until the base case, then build the convex hull. 23
  • 65. Chan's 3D algorithm → 3D Gift wrapping → Pick an edge ej of a face f of the partial hull. → Find p that maximizes the angle between f and the new face given by ej and p. Repeat for the 3 edges of f. → Use breadth first visit to build the entire hull. → Preparata and Hong 3D algorithm, a divide-and-conquer algorithm for convex hulls → Split the set of points S in S1 and S2. → Recursively split until the base case, then build the convex hull. → Merge the partial hulls. 23
  • 66. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy 24
  • 67. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. 24
  • 68. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. 24
  • 69. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). 24
  • 70. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). → Finding supporting planes in 3D 24
  • 71. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). → Finding supporting planes in 3D → Goal: given an edge ej and the DK hierarchy of a partial hull Hi, find the plane passing through ej and tangent to Hi in pt. 24
  • 72. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). → Finding supporting planes in 3D → Goal: given an edge ej and the DK hierarchy of a partial hull Hi, find the plane passing through ej and tangent to Hi in pt. → Find pt in constant time in Pk 24
  • 73. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). → Finding supporting planes in 3D → Goal: given an edge ej and the DK hierarchy of a partial hull Hi, find the plane passing through ej and tangent to Hi in pt. → Find pt in constant time in Pk → Step up in the hierarchy: if pt changes, it will move to a neighbour (constant time check). 24
  • 74. Chan's 3D algorithm → To find supporting planes, store each partial hull as a Dobkin-Kirkpatrick hierarchy → Sequence P0, . . . , Pk of increasingly smaller approximations of a polyhedron P = P0. → Build Pi+1 from Pi by picking a maximal set of independent vertices of Pi. → Overall, building the hierarchies takes O(n). → Finding supporting planes in 3D → Goal: given an edge ej and the DK hierarchy of a partial hull Hi, find the plane passing through ej and tangent to Hi in pt. → Find pt in constant time in Pk → Step up in the hierarchy: if pt changes, it will move to a neighbour (constant time check). → The DK hierarchy has O(log m) height. 24
  • 76. References I [1] C. Bradford Barber, David P. Dobkin, and Huhdanpaa Hannu. The quickhull algorithm for convex hulls. 1995. [2] T. M. Chan. Optimal output-sensitive convex hull algorithms in two and three dimensions. Discrete & Computational Geometry, 16(4):361–368, 1996. [3] Donald R. Chand and Sham S. Kapur. [4] Ioannis Z. Emiris and John F. Canny. An efficient approach to removing geometric degeneracies. Technical report, 1991. [5] Christer Ericson. Real-Time Collision Detection. CRC Press, Inc., Boca Raton, FL, USA, 2004. [6] A. Goshtasby and G. C. Stockman. Point pattern matching using convex hull edges. IEEE Transactions on Systems, Man, and Cybernetics, SMC-15(5), 1985. 26
  • 77. References II [7] David G. Kirkpatrick and Raimund Seidel. The ultimate planar convex hull algorithm ? Technical report, 1983. [8] Joseph O’Rourke. Computational Geometry in C. Cambridge University Press, 2nd edition, 1998. [9] F. P. Preparata and S. J. Hong. Convex hulls of finite sets of points in two and three dimensions. Commun. ACM, 20(2):87–93, February 1977. [10] Franco P. Preparata and Michael I. Shamos. Computational Geometry: An Introduction. Springer-Verlag New York, Inc., 1985. [11] Franco P. Preparata and Michael I. Shamos. Computational Geometry: An Introduction. Springer-Verlag New York, Inc., 1985. Beamer theme: Presento, by Ratul Saha. The research system in Germany, by Hazem Alsaied 27