Scale iterative routing clearance with NodeSpacing

minLineClearance in the iterative optimizer now uses
max(nodeSizeClearance, nodeSpacing * 1.2) instead of just
nodeSizeClearance. Wider NodeSpacing produces wider routing corridors.

The 3 copies of ResolveMinLineClearance in scoring/post-processing still
use the node-size-only formula (17 call sites need refactoring to thread
NodeSpacing). This is tracked as future work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-04-01 16:38:13 +03:00
parent ccf8cb0318
commit abbf004948

View File

@@ -33,9 +33,13 @@ internal static partial class ElkEdgeRouterIterative
}
var serviceNodes = nodes.Where(n => n.Kind is not "Start" and not "End").ToArray();
var minLineClearance = serviceNodes.Length > 0
var nodeSizeClearance = serviceNodes.Length > 0
? Math.Min(serviceNodes.Average(n => n.Width), serviceNodes.Average(n => n.Height)) / 2d
: 50d;
// Scale clearance with NodeSpacing: wider spacing should produce wider
// routing corridors. Use the larger of node-size-based clearance and
// spacing-proportional clearance so the pipeline adapts to any spacing.
var minLineClearance = Math.Max(nodeSizeClearance, layoutOptions.NodeSpacing * 1.2d);
var diagnostics = ElkLayoutDiagnostics.Current;
var validSolutions = new List<CandidateSolution>();