fix: align separators at complex crosswalks

This commit is contained in:
que01 committed 2026-09-29 10:23:13 +08:00
1 parent c03a90709e
commit 0f1850f740
2 files changed
+32 -4

No files matched your search

+11 -1
View File
@@ -57,12 +57,22 @@ for (const ordered of [clusters, [...clusters].reverse()]) {
.filter((separator) => separator.properties.cluster_id === 'west')
.map((separator) => {
const ring = separator.geometry.coordinates[0];
return Math.min(...ring.map((point) => meters(point, clusterCenter)));
const start = [(ring[0][0] + ring[1][0]) / 2, (ring[0][1] + ring[1][1]) / 2];
const end = [(ring[2][0] + ring[3][0]) / 2, (ring[2][1] + ring[3][1]) / 2];
return meters(start, end);
});
assert.ok(
Math.max(...endpointDistances) - Math.min(...endpointDistances) < 0.2,
'adjacent complex separators must share a stable core-side endpoint',
);
const separatorLengths = complexSeparators.map((separator) => {
const ring = separator.geometry.coordinates[0];
return ring.slice(1, -1).reduce((sum, point, index) => sum + meters(ring[index], point), 0);
});
assert.ok(
Math.max(...separatorLengths) - Math.min(...separatorLengths) < 0.2,
'adjacent complex separators must share the same zebra-side cutoff',
);
}
}
for (const separator of complexSeparators) {