diff --git a/lib/RectDiffPipeline.ts b/lib/RectDiffPipeline.ts index 055986a..994952d 100644 --- a/lib/RectDiffPipeline.ts +++ b/lib/RectDiffPipeline.ts @@ -77,6 +77,8 @@ export class RectDiffPipeline extends BasePipelineSolver rectDiffPipeline.inputProblem.simpleRouteJson.layerCount || 0, }, maxGapFillPasses: rectDiffPipeline.inputProblem.maxGapFillPasses, + minTraceWidth: + rectDiffPipeline.inputProblem.simpleRouteJson.minTraceWidth, }, ], ), diff --git a/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts b/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts index b4ca2d3..508b99c 100644 --- a/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts +++ b/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts @@ -79,6 +79,7 @@ const getDistanceToBoardEdge = ( export type ExpandEdgesToEmptySpaceSolverInput = { /** Optional for standalone callers; the full board pipeline always supplies it. */ bounds?: Bounds + minTraceWidth?: number inputMeshNodes: CapacityMeshNode[] segmentsWithAdjacentEmptySpace: Array boardVoid?: { @@ -261,6 +262,11 @@ export class ExpandEdgesToEmptySpaceSolver extends BaseSolver { const nodeWidth = nodeBounds.maxX - nodeBounds.minX const nodeHeight = nodeBounds.maxY - nodeBounds.minY + const minRoutableDimension = Math.max(EPS, this.input.minTraceWidth ?? 0) + if (nodeWidth < minRoutableDimension || nodeHeight < minRoutableDimension) { + return + } + const expandedSegment = { segment, newNode: { @@ -274,11 +280,6 @@ export class ExpandEdgesToEmptySpaceSolver extends BaseSolver { } this.lastExpandedSegment = expandedSegment - if (nodeWidth < EPS || nodeHeight < EPS) { - // Node is too small, skipping - return - } - this.expandedSegments.push(expandedSegment) this.rectSpatialIndex.insert({ ...expandedSegment.newNode, diff --git a/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts b/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts index 6a59188..683ba99 100644 --- a/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts +++ b/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts @@ -27,6 +27,7 @@ type GapFillSolverInput = { * expanded nodes; values below 1 are clamped to 1. */ maxGapFillPasses: number + minTraceWidth: number } type GapFillOutput = { @@ -75,6 +76,7 @@ export class GapFillSolverPipeline extends BasePipelineSolverLayer z=0Layer z=1Layer z=2Layer z=3