Done and fix
This commit is contained in:
parent
8da0712c72
commit
782fefdb06
|
@ -1,11 +1,10 @@
|
||||||
import random
|
import random
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from enum import Enum, auto
|
||||||
|
from math import sqrt
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from enum import Enum, auto
|
|
||||||
from math import atan2, degrees, tau, pi, acos, sqrt
|
|
||||||
|
|
||||||
|
|
||||||
Point = namedtuple('Point', 'x y')
|
Point = namedtuple('Point', 'x y')
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ def display(points, hull):
|
||||||
h_x = [point.x for point in hull]
|
h_x = [point.x for point in hull]
|
||||||
h_y = [point.y for point in hull]
|
h_y = [point.y for point in hull]
|
||||||
|
|
||||||
plt.plot(h_x, h_y, 'ro-')
|
plt.plot(h_x, h_y, 'ro')
|
||||||
|
|
||||||
plt.scatter(x, y)
|
plt.scatter(x, y)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -90,7 +89,7 @@ def find_hull(points: Set[Point], p: Point, q: Point, hull: Set[Point]):
|
||||||
hull)
|
hull)
|
||||||
|
|
||||||
|
|
||||||
peepees = {gen_point() for _ in range(30)}
|
points = {gen_point() for _ in range(30)}
|
||||||
hulliees = quick_hull(peepees)
|
hull = quick_hull(points)
|
||||||
|
|
||||||
display(peepees, hulliees)
|
display(points, hull)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user