MCPcopy
hub / github.com/TheAlgorithms/Python / test_large_hull

Function test_large_hull

geometry/tests/test_graham_scan.py:220–243  ·  view source on GitHub ↗

Test with a larger set of points.

()

Source from the content-addressed store, hash-verified

218
219
220def test_large_hull() -> None:
221 """Test with a larger set of points."""
222 # Create a circle of points
223 import math
224
225 points = []
226 for i in range(20):
227 angle = 2 * math.pi * i / 20
228 x = math.cos(angle)
229 y = math.sin(angle)
230 points.append(Point(x, y))
231
232 # Add some interior points
233 points.append(Point(0, 0))
234 points.append(Point(0.5, 0.5))
235 points.append(Point(-0.3, 0.2))
236
237 hull = graham_scan(points)
238
239 # The hull should contain the circle points but not the interior points
240 assert len(hull) >= 3
241 assert Point(0, 0) not in hull
242 assert Point(0.5, 0.5) not in hull
243 assert Point(-0.3, 0.2) not in hull
244
245
246def test_random_order() -> None:

Callers

nothing calls this directly

Calls 3

PointClass · 0.90
graham_scanFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected