Compute a minimal rectangle that covers all the points.
(pts)
| 68 | |
| 69 | # get_bound |
| 70 | def get_bound(pts): |
| 71 | """Compute a minimal rectangle that covers all the points.""" |
| 72 | (x0, y0, x1, y1) = (INF, INF, -INF, -INF) |
| 73 | for (x,y) in pts: |
| 74 | x0 = min(x0, x) |
| 75 | y0 = min(y0, y) |
| 76 | x1 = max(x1, x) |
| 77 | y1 = max(y1, y) |
| 78 | return (x0,y0,x1,y1) |
| 79 | |
| 80 | # pick |
| 81 | def pick(seq, func, maxobj=None): |