(pos: dict)
| 389 | |
| 390 | |
| 391 | def _normalize_pos(pos: dict) -> dict: |
| 392 | if len(pos) <= 1: |
| 393 | return {n: (0.0, 0.0) for n in pos} |
| 394 | xs = [p[0] for p in pos.values()] |
| 395 | ys = [p[1] for p in pos.values()] |
| 396 | cx = (max(xs) + min(xs)) / 2 |
| 397 | cy = (max(ys) + min(ys)) / 2 |
| 398 | rng = max(max(xs) - min(xs), max(ys) - min(ys)) or 1.0 |
| 399 | return {n: ((x - cx) / rng * 1.5, (y - cy) / rng * 1.5) |
| 400 | for n, (x, y) in pos.items()} |
| 401 | |
| 402 | |
| 403 | def _mac_label(mac: str) -> str: |