fix(junction): bound complex cutback transitions

This commit is contained in:
que01 committed 2026-09-09 10:28:55 +08:00
1 parent 280b726c6f
commit 4e7274ec61
4 files changed
+23 -4

No files matched your search

+1 -1
View File
@@ -110,7 +110,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
center,
{
outerRadiusFor: (item) => Math.max(coreRadius + 4, outerRadius - Math.max(0, Number(item.approach.cutback) || 0)),
innerRadiusFor: () => coreRadius * 0.7,
innerRadiusFor: () => complexJunctionMetrics(cluster).approachInnerRadius,
},
helpers,
model.exclusionRegions || [],
+6 -3
View File
@@ -344,9 +344,12 @@ function numericValue(constraint, key, fallback) {
function clusterCutbackMaximum(cluster, approachLength) {
const metrics = complexJunctionMetrics(cluster);
// The carriageway's outer edge may retreat only to the core safety envelope.
// The other cap preserves a usable part of a short source approach.
return Math.min(approachLength * 0.45, Math.max(1, metrics.approachOuterRadius - (metrics.coreRadius + 4)));
// Keep a measurable local taper between the source-road outer section and
// the inner core section. The other cap preserves a usable source approach.
return Math.min(
approachLength * 0.45,
Math.max(1, metrics.approachOuterRadius - (metrics.approachInnerRadius + metrics.minimumTransitionMeters)),
);
}
function roadGroups(model) {
+7
View File
@@ -6,9 +6,16 @@ function complexJunctionMetrics(cluster, calibration = null) {
const coreRadius = calibration
? Math.max(12, Math.min(24, calibration.shortSpanMeters * 0.14))
: Math.max(12, Math.min(80, Number(cluster.coreRadiusMeters) || 28));
const approachInnerRadius = coreRadius * 0.7;
// The local correction needs a real taper between the immutable source-road
// section and the core. This is a geometric feasibility limit, not a UI-only
// preference, so solver and compiler consumers derive it from one metric.
const minimumTransitionMeters = Math.max(8, coreRadius * 0.5);
return {
calibration,
coreRadius,
approachInnerRadius,
minimumTransitionMeters,
approachOuterRadius: coreRadius + (Number(cluster.outerRadiusExtraMeters) || 18),
};
}