CMPUT 301 Convex Hulls in 2D - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

CMPUT 301 Convex Hulls in 2D

Description:

Convexity of a region in 2D. A region is convex iff pq is wholly inside the region for each p,q in the region. ... Binary vs. ternary branching ... – PowerPoint PPT presentation

Number of Views:136
Avg rating:3.0/5.0
Slides: 23
Provided by: csUal
Category:
Tags: cmput | convex | hulls | ternary

less

Transcript and Presenter's Notes

Title: CMPUT 301 Convex Hulls in 2D


1
CMPUT 301 Convex Hulls in 2D
  • Lecturer Sherif Ghali
  • Department of Computing Science
  • University of Alberta

2
Geometric Problems
  • Voronoi Diagram
  • Motion Planning

3
Convexity of a region in 2D
  • A region is convex iff pq is wholly inside the
    region for each p,q in the region.
  • A convex hull is the smallest such convex set.

4
The Convex Hull
5
The Input and Output of aConvex Hull Computation
6
Characterization of Points on the Convex Hull
two points p and q are on the convex hull if and
only if none of the other points lies on the left
side of pq
7
Convex HullFirst Algorithm
8
Implementation Details - time
  • Left vs. right turn
  • Connecting the hull

r1
r2
pqr1 is a left turn
q
pqr2 is a right turn
p
what is the time complexity?
9
Handling Degeneracy
two points p and q are on the convex hull if and
only if none of the other points lies on the left
side of pq
10
Reliability of floating point
  • float a,b
  • if (ab)

Conclusion SlowConvexHull can succumb to
degenerate inputs
11
Incremental algorithms
  • We know the solution for Si p1, p2, pi
  • Insert pi1
  • We compute the solution for Si1 p1, p2, pi
    ,pi1

12
Types of Polygons
  • Simple polygon edges intersect only at endpoints
  • Convex polygon
  • pq wholly inside
  • turns are only right turns

13
Upper and Lower Hull
14
Incremental Insertion
15
(No Transcript)
16
Lexicographic Sorting
  • bool xcompare(Point a, Point b)
  • return a.x lt b.x
  • bool xycompare(Point a, Point b)
  • if (a.x b.x)
  • return a.y lt b.y
  • else
  • return a.x lt b.x

1
6
3
4
2
5
5
3
6
1
2
4
17
Degeneracy
  • Potential problems
  • a hull point is mistakenly removed
  • an interior point is not removed
  • small dents in the hull
  • Conclusion output not necessarily correct, but
    the program will not crash
  • Perils of floating point

18
Correctness
  • Induction hypothesis assume the Hull Hi-1
  • Hi-1 Hull(p1, p2, pi -1)
  • is the upper hull
  • Base case H2 Hull(p1, p2)
  • is trivially correct
  • Could a point be above the hull Hi
  • Hi Hull(p1, p2, pi )
  • after adding pi ?

19
Time
  • Lexicographic sorting O(n log n)
  • A point is deleted at most once

20
Degeneracies
  • General position assumption
  • Binary vs. ternary branching
  • If affordable, use exact arithmetic (integers,
    rationals, algebraic numbers)
  • Correctness of an algorithm is with respect to
    the definition

21
Application Domains
  • Computer Graphics
  • Modeling and rendering, collision detection
  • Robotics
  • Motion planning, optimal robot arm placement
  • Geographic Information Systems
  • Maps, overlaying maps, terrains, nearness
  • CAD/CAM
  • prototyping, manufacturing, assembly
  • Other
  • molecular modeling, character/fingerprint
    recognition, database queries

22
Reference
Chap. 1
Write a Comment
User Comments (0)
About PowerShow.com