Return a function that checks whether a point is in a circle with center (*cx*, *cy*) and radius *r*. The returned function has the signature:: f(xy: tuple[float, float]) -> bool
(cx, cy, r)
| 498 | |
| 499 | |
| 500 | def inside_circle(cx, cy, r): |
| 501 | """ |
| 502 | Return a function that checks whether a point is in a circle with center |
| 503 | (*cx*, *cy*) and radius *r*. |
| 504 | |
| 505 | The returned function has the signature:: |
| 506 | |
| 507 | f(xy: tuple[float, float]) -> bool |
| 508 | """ |
| 509 | r2 = r ** 2 |
| 510 | |
| 511 | def _f(xy): |
| 512 | x, y = xy |
| 513 | return (x - cx) ** 2 + (y - cy) ** 2 < r2 |
| 514 | return _f |
| 515 | |
| 516 | |
| 517 | # quadratic Bezier lines |
no outgoing calls
searching dependent graphs…