MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / check_cluster

Function check_cluster

Tools/Spawnpoint-Clustering/cluster.py:81–96  ·  view source on GitHub ↗
(spawnpoint, cluster, radius, time_threshold)

Source from the content-addressed store, hash-verified

79 return distance
80
81def 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
98def cluster(spawnpoints, radius, time_threshold):
99 clusters = []

Callers 1

clusterFunction · 0.85

Calls 2

costFunction · 0.85
simulate_centroidMethod · 0.80

Tested by

no test coverage detected