0% found this document useful (0 votes)
4 views

Convex Hull

Uploaded by

fastaka.ft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Convex Hull

Uploaded by

fastaka.ft
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 31

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 called concave.

P x y P x y

concave convex
The convex hull problem
concave polygon: convex polygon:

• The convex hull of a set of planar points is the


smallest convex polygon containing all of the
points.

3
Graham’s Scan
• Start at point guaranteed to be on the hull.
(the point with the minimum y value)
• Sort remaining points by polar angles of
vertices relative to the first point.
• Go through sorted points, keeping vertices
of points that have left turns and dropping
points that have right turns.
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Scan
Graham’s Runtime
• Graham’s scan is O(n log n) due to initial
sort of angles.
A more detailed algorithm
Convex Hull
by Divide-and-Conquer
• First, sort all points by their x coordinate.
– ( O(n log n) time)
• Then divide and conquer:
– Find the convex hull of the left half of points.
– Find the convex hull of the right half of
points.
– Merge the two hulls into one.
5

Hull of S by exhaustive search;


Lower Tangent Example
•Initially, T=(4, 7) is only a lower
tangent for A. The A loop does
not execute, but the B loop
increments b to 11.
•But now T=(4, 11) is no longer
a lower tangent for A, so the A
loop decrements a to 0.
•T=(0, 11) is not a lower
tangent for B, so b is
incremented to 12.
• T=(0, 12) is a lower tangent
for both A and B, and T is
returned.
Q&A

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy