fix: stabilize fengshu native road compilation

This commit is contained in:
2026-08-24 13:51:21 +08:00
parent a16400ff96
commit f1f829c2c6
6 changed files with 4501 additions and 8937 deletions

View File

@@ -261,9 +261,15 @@ function readReferenceCalibration(cluster) {
function complexJunctionMetrics(cluster) {
if (metricsCache.has(cluster)) return metricsCache.get(cluster);
const calibration = readReferenceCalibration(cluster);
// Without a reference geometry `coreRadiusMeters` is the only size input the
// template has, so honour it literally within the schema's own 12..80 range.
// It used to be scaled by .52 and clamped to 17, which silently capped every
// unreferenced junction at a core far smaller than its own approach envelope
// — a 24 m dual-carriageway arm was being fitted into a 16.6 m core no matter
// what the config asked for. The calibrated branch is unchanged.
const coreRadius = calibration
? Math.max(12, Math.min(24, calibration.shortSpanMeters * .14))
: Math.max(11, Math.min(17, cluster.coreRadiusMeters * .52));
: Math.max(12, Math.min(80, Number(cluster.coreRadiusMeters) || 28));
const metrics = { calibration, coreRadius, approachOuterRadius: coreRadius + (Number(cluster.outerRadiusExtraMeters) || 18) };
metricsCache.set(cluster, metrics);
return metrics;