5.5
unknown
python
5 months ago
520 B
3
Indexable
# Continuation of ex 5.1's code def lowerHull(points): points = sorted(points, key=lambda p: (p[0], p[1])) lower = [] for p in points: while len(lower) >= 2 and orientation(Point(*lower[-2]), Point(*lower[-1]), Point(*p)) != 2: lower.pop() lower.append(p) return lower input_points = [(1, 10), (-2, 7), (3, 8), (4, 10), (5, 7), (6, 7), (7, 11)] lower_hull = lowerHull(input_points) print("Lower Hull:") for x, y in lower_hull: print(f"({x}, {y})")
Editor is loading...
Leave a Comment