Upper hull
This commit is contained in:
parent
1bbb5d9cf3
commit
1f6ade0c9a
|
@ -61,16 +61,11 @@ def quick_hull(points: Set[Point]):
|
|||
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 is_left(left, right, p)},
|
||||
left,
|
||||
right,
|
||||
hull)
|
||||
|
||||
find_hull({p for p in points if not is_left(right, left, p)},
|
||||
right,
|
||||
left,
|
||||
hull)
|
||||
|
||||
return hull
|
||||
|
||||
|
||||
|
@ -83,20 +78,24 @@ def find_hull(points: Set[Point], p: Point, q: Point, hull: Set[Point]):
|
|||
|
||||
s1 = {point
|
||||
for point in points
|
||||
if not is_left(p, farthest, point)}
|
||||
if is_left(p, farthest, point)}
|
||||
print("--")
|
||||
print(s1)
|
||||
|
||||
s2 = {point
|
||||
for point in points
|
||||
if not is_left(farthest, q, point)}
|
||||
if is_left(farthest, q, point)}
|
||||
print(s2)
|
||||
|
||||
find_hull(s1, p, farthest, hull)
|
||||
find_hull(s2, farthest, q, hull)
|
||||
|
||||
|
||||
peepees = {gen_point() for _ in range(11)}
|
||||
peepees = {gen_point() for _ in range(13)}
|
||||
#peepees = {Point(2, 5), Point(3, 1), Point(3, 4), Point(9, 4), Point(1, 5), Point(5, 7)}
|
||||
|
||||
hulliees = quick_hull(peepees)
|
||||
|
||||
display(peepees, hulliees)
|
||||
a = sorted(hulliees)
|
||||
|
||||
display(peepees, a)
|
||||
|
|
Loading…
Reference in New Issue
Block a user