We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14cc7cc commit b52cba2Copy full SHA for b52cba2
1 file changed
city2graph/proximity.py
@@ -1098,8 +1098,9 @@ def relative_neighborhood_graph(
1098
if np.any(dots < 0.0):
1099
continue
1100
dij2 = np.dot(coords[i] - coords[j], coords[i] - coords[j])
1101
- di2 = np.sum((coords - coords[i]) ** 2, axis=1) < dij2
1102
- dj2 = np.sum((coords - coords[j]) ** 2, axis=1) < dij2
+ threshold = dij2 - np.finfo(float).eps * max(dij2, 1.0) * 64.0
+ di2 = np.sum((coords - coords[i]) ** 2, axis=1) < threshold
1103
+ dj2 = np.sum((coords - coords[j]) ** 2, axis=1) < threshold
1104
closer_both = np.where(di2 & dj2)[0]
1105
if len(closer_both) == 0:
1106
kept_edges.add((builder.node_ids[i], builder.node_ids[j]))
0 commit comments