Test with a star shape where only tips are on the convex hull.
()
| 119 | |
| 120 | |
| 121 | def test_star_shape() -> None: |
| 122 | """Test with a star shape where only tips are on the convex hull.""" |
| 123 | # Tips of the star (on convex hull) |
| 124 | p1 = Point(-5, 6) |
| 125 | p2 = Point(-11, 0) |
| 126 | p3 = Point(-9, -8) |
| 127 | p4 = Point(4, 4) |
| 128 | p5 = Point(6, -7) |
| 129 | |
| 130 | # Interior points (not on convex hull) |
| 131 | p6 = Point(-7, -2) |
| 132 | p7 = Point(-2, -4) |
| 133 | p8 = Point(0, 1) |
| 134 | p9 = Point(1, 0) |
| 135 | p10 = Point(-6, 1) |
| 136 | |
| 137 | hull_points = [p1, p2, p3, p4, p5] |
| 138 | interior_points = [p6, p7, p8, p9, p10] |
| 139 | all_points = hull_points + interior_points |
| 140 | |
| 141 | hull = graham_scan(all_points) |
| 142 | |
| 143 | # All hull points should be in the result |
| 144 | for p in hull_points: |
| 145 | assert p in hull |
| 146 | |
| 147 | # No interior points should be in the result |
| 148 | for p in interior_points: |
| 149 | assert p not in hull |
| 150 | |
| 151 | |
| 152 | def test_rectangle_with_collinear_points() -> None: |
nothing calls this directly
no test coverage detected