cs504 presentation chan’s algorithm. planar convex hull cs504 presentation

25
CS504 Presentation Chan’s algorithm

Upload: darwin-keeton

Post on 15-Dec-2015

228 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

CS504 Presentation

Chan’s algorithm

Page 2: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Planar Convex Hull

CS504 Presentation

• Graham’s Scan :

• Jarvis’s March :

• Is there any algorithm?

Page 3: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Chan’s algorithm– combining Graham’s scan and Jarvis’s March together

• 3 stages of Chan’s algorithm1. divide vertices into partitions2. apply Graham’s scan on each partition3. apply Jarvis’s March on the small convex hull

(repeat 1~3 until we find the hull)

Page 4: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage1 : Partition

• Consider arbitrary value , the size of partition– how to decide will be treated later

• Partition the points into groups, each of size – is the number of groups

Page 5: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage 1

n = 32

Set m = 8

Page 6: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage 1

n = 32

Set m = 8 r = 4

Page 7: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage2 : Graham’s Scan

• Compute convex hull of each partition using Gra-ham’s scan

• Total time

Page 8: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage 2

(After Stage 1) m = 8 r = 4

Page 9: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage 2

Using Graham’s Scan

for each group-> total =

Page 10: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Stage3 : Jarvis’s March

• How to merge these r hulls into a single hull?

• IDEA : treat each hull as a “fat point” and run Jarvis’s March!

• # of iteration is at most m– to guarantee the time complexity O(nlogh)

Page 11: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• (-inf,0) -> lowest pt

(−∞ ,0)

lowest pt

Page 12: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Find the point that maximize the angle in each hull

(−∞ ,0)

lowest pt1

Page 13: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Find the point that maximize the angle in each hull

(−∞ ,0)

lowest pt1

2

Page 14: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Find the point that maximize the angle in each hull

(−∞ ,0)

lowest pt1

2

3

Page 15: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

If , then the algorithm will fail!

Page 16: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• FAIL EXAMPLE – too small value m

m = 4

(−∞ ,0)

4 iteration

Page 17: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

In 4(a), how to find such points?

Page 18: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Find the point that maximize the angle in each hull

(−∞ ,0)

lowest pt1

Page 19: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Find the point that maximize the angle in a hull

(−∞ ,0)

Page 20: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Finding tangent between a point and a convex -gon

1

23

4

5

process

Page 21: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

→𝑂 (log𝑚)

Page 22: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

Analysis• Suppose God told you some good value for

• for stage1~2• At most h steps in Jarvis’s March

– time to compute each tangent– tangent for each iteration– total time

• as desired.

𝑚≤h2

Page 23: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• The only question remaining is…

how do we know what value to give to ?

Page 24: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• Answer : square search

• Try this way -

• Then we eventually get to be in !

Page 25: CS504 Presentation Chan’s algorithm. Planar Convex Hull CS504 Presentation

Chan’s Algorithm

CS504 Presentation

• The algorithm stops as soon as

• Total time complexity