Computational Geometry 2D Convex Hulls - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Computational Geometry 2D Convex Hulls

Description:

Set X is convex if p,q X pq X ... O(nh) : Gift-Wrapping. Idea: Use one edge to help find the next edge. Output: Vertices of CH(S) ... – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 10
Provided by: S698
Category:

less

Transcript and Presenter's Notes

Title: Computational Geometry 2D Convex Hulls


1
Computational Geometry2D Convex Hulls
Joseph S. B. Mitchell Stony Brook University
2
Convexity
  • 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 XS 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
3
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)
4
Equivalent Definitions of Convex Hull, CH(X)
  • all convex combinations of d1 points of X
    Caratheodorys 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

5
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
6
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 gt 0
c is left of ab
a
7
SuperStupidCH O(n4)
  • Fact If s ??pqr, then s is not a vertex of CH(S)
  • ? p
  • ? 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)
8
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

O(n2)
O(n)
Caution!! Numerical errors require care to
avoid crash/infinite loop!
9
O(nh) Gift-Wrapping
Jarvis March
  • Idea Use one edge to help find the next edge.
  • Output Vertices of CH(S)
  • Demo applet of Jarvis march

O(n) per step h steps Total O(nh)
r
q
p
Key observation Output-sensitive!
Write a Comment
User Comments (0)
About PowerShow.com