diff --git a/h2/quick_hull.py b/h2/quick_hull.py index 9053e5e..7621a7f 100644 --- a/h2/quick_hull.py +++ b/h2/quick_hull.py @@ -59,13 +59,14 @@ def quick_hull(points: Set[Point]): right = max(points) hull = {left, right} + points = points - hull find_hull({p for p in points if not is_left(left, right, p)}, left, right, 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, left, hull) @@ -95,7 +96,7 @@ def find_hull(points: Set[Point], p: Point, q: Point, hull: Set[Point]): find_hull(s2, farthest, q, hull) -points = {gen_point() for _ in range(10)} -hull = quick_hull(points) +peepees = {gen_point() for _ in range(11)} +hulliees = quick_hull(peepees) -display(points, hull) +display(peepees, hulliees)