This commit is contained in:
Casper 2018-09-20 15:58:02 +02:00
parent d0f75a4327
commit 1bbb5d9cf3

View File

@ -59,13 +59,14 @@ def quick_hull(points: Set[Point]):
right = max(points) right = max(points)
hull = {left, right} hull = {left, right}
points = points - hull
find_hull({p for p in points if not is_left(left, right, p)}, find_hull({p for p in points if not is_left(left, right, p)},
left, left,
right, right,
hull) hull)
find_hull({p for p in points if is_left(left, right, p)}, find_hull({p for p in points if not is_left(right, left, p)},
right, right,
left, left,
hull) hull)
@ -95,7 +96,7 @@ def find_hull(points: Set[Point], p: Point, q: Point, hull: Set[Point]):
find_hull(s2, farthest, q, hull) find_hull(s2, farthest, q, hull)
points = {gen_point() for _ in range(10)} peepees = {gen_point() for _ in range(11)}
hull = quick_hull(points) hulliees = quick_hull(peepees)
display(points, hull) display(peepees, hulliees)