MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / sample_within

Method sample_within

numericals.py:428–440  ·  view source on GitHub ↗

Sample a point within the boundary of points.

(self, points: list[Point], n: int = 5)

Source from the content-addressed store, hash-verified

426 return circle_circle_intersection(self, obj)
427
428 def sample_within(self, points: list[Point], n: int = 5) -> list[Point]:
429 """Sample a point within the boundary of points."""
430 result = None
431 best = -1.0
432 for _ in range(n):
433 ang = unif(0.0, 2.0) * np.pi
434 x = self.center + Point(np.cos(ang), np.sin(ang)) * self.radius
435 mind = min([x.distance(p) for p in points])
436 if mind > best:
437 best = mind
438 result = x
439
440 return [result]
441
442
443class HoleCircle(Circle):

Callers

nothing calls this directly

Calls 3

cosMethod · 0.80
PointClass · 0.70
distanceMethod · 0.45

Tested by

no test coverage detected