Add a point to hull, removing collinear intermediate points.
(hull: list[Point], point: Point)
| 109 | |
| 110 | |
| 111 | def _add_point_to_hull(hull: list[Point], point: Point) -> None: |
| 112 | """Add a point to hull, removing collinear intermediate points.""" |
| 113 | last = len(hull) - 1 |
| 114 | if len(hull) > 1 and _is_point_on_segment(hull[last - 1], hull[last], point): |
| 115 | hull[last] = Point(point.x, point.y) |
| 116 | else: |
| 117 | hull.append(Point(point.x, point.y)) |
| 118 | |
| 119 | |
| 120 | def jarvis_march(points: list[Point]) -> list[Point]: |
no test coverage detected