(spawnpoint, cluster, radius, time_threshold)
| 79 | return distance |
| 80 | |
| 81 | def check_cluster(spawnpoint, cluster, radius, time_threshold): |
| 82 | # discard infinite cost or too far away |
| 83 | if cost(spawnpoint, cluster, time_threshold) > 2 * radius: |
| 84 | return False |
| 85 | |
| 86 | new_centroid = cluster.simulate_centroid(spawnpoint) |
| 87 | |
| 88 | # we'd be removing ourselves |
| 89 | if utils.distance(spawnpoint.position, new_centroid) > radius: |
| 90 | return False |
| 91 | |
| 92 | # we'd be removing x |
| 93 | if any(utils.distance(x.position, new_centroid) > radius for x in cluster): |
| 94 | return False |
| 95 | |
| 96 | return True |
| 97 | |
| 98 | def cluster(spawnpoints, radius, time_threshold): |
| 99 | clusters = [] |
no test coverage detected