Lol
This commit is contained in:
parent
782fefdb06
commit
a3a97f9c00
21
h2/mbc.py
Normal file
21
h2/mbc.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import statistics
|
||||
from collections import namedtuple
|
||||
from typing import List, Set
|
||||
|
||||
Point = namedtuple('Point', 'x y')
|
||||
|
||||
|
||||
def mbc_ch(points: Set[Point]):
|
||||
# Find the point with median x-coordinate, and partition the points on this point
|
||||
pm = statistics.median_high(points)
|
||||
|
||||
pl = {point
|
||||
for point in points
|
||||
if point.x < pm.x}
|
||||
|
||||
pr = {point
|
||||
for point in points
|
||||
if point.x >= pm.x}
|
||||
|
||||
# Find the bridge over the vertical line in pm
|
||||
|
|
@ -55,7 +55,7 @@ def graham_scan(points):
|
|||
# A funky issue where both a and b become negative in the sidedness test causes us to have to use
|
||||
# Side.ABOVE for both tests, regardless of UH or LH.
|
||||
|
||||
sorted_points = sorted(points, key=lambda p: p.x)
|
||||
sorted_points = sorted(points)
|
||||
|
||||
UH = sorted_points[:2]
|
||||
#del sorted_points[0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user