Sample a point within the boundary of points.
(self, points: list[Point], n: int = 5)
| 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 | |
| 443 | class HoleCircle(Circle): |