@@ -88,6 +88,7 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
8888
8989 activeConnectionPair : ConnectionNodePair | null = null
9090
91+ ogUnprocessedSubpaths : SubpathNodePair [ ] | null = null
9192 unprocessedSubpaths : SubpathNodePair [ ] | null = null
9293 solvedSubpaths : SubpathNodePair [ ] | null = null
9394
@@ -172,6 +173,7 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
172173 this . unprocessedSubpaths = this . breakConnectionPairIntoSubpaths (
173174 this . activeConnectionPair ,
174175 )
176+ this . ogUnprocessedSubpaths = this . unprocessedSubpaths . slice ( )
175177 this . solvedSubpaths = [ ]
176178 this . lastStepOperation = "breakConnectionPairIntoSubpaths"
177179 return
@@ -184,6 +186,7 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
184186 const completedConnectionPair = this . activeConnectionPair
185187 this . activeConnectionPair = null
186188 this . unprocessedSubpaths = null
189+ this . ogUnprocessedSubpaths = null
187190 this . activeSubpath = null
188191
189192 this . solvedRoutes . push (
@@ -485,9 +488,9 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
485488 getClosestVia ( node : CapacityMeshNode ) : CapacityMeshNode {
486489 if ( this . viaNodes . length === 0 ) return node
487490 // Exclude blocked vias
488- const candidates = this . viaNodes . filter (
489- ( v ) => ! v . _completelyInsideObstacle && ! v . _containsObstacle ,
490- )
491+ const candidates = this . viaNodes
492+ . filter ( ( v ) => ! v . _completelyInsideObstacle && ! v . _containsObstacle )
493+ . filter ( ( v ) => ! this . usedNodeMap . has ( v . capacityMeshNodeId ) )
491494 if ( candidates . length === 0 ) return node
492495 candidates . sort ( ( a , b ) => this . _dist ( a , node ) - this . _dist ( b , node ) )
493496 return candidates [ 0 ]
@@ -506,6 +509,7 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
506509
507510 const viable = this . viaNodes . filter (
508511 ( v ) =>
512+ ! this . usedNodeMap . has ( v . capacityMeshNodeId ) &&
509513 v . capacityMeshNodeId !== closestVia . capacityMeshNodeId &&
510514 ! v . _completelyInsideObstacle &&
511515 ! v . _containsObstacle &&
@@ -635,7 +639,7 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
635639 for ( let i = 0 ; i < this . solvedRoutes . length ; i ++ ) {
636640 const solvedRoute = this . solvedRoutes [ i ]
637641 const path = solvedRoute . path
638- const color = this . colorMap [ solvedRoute . connection . name ] || "green "
642+ const color = "blue "
639643
640644 for ( let j = 0 ; j < path . length - 1 ; j ++ ) {
641645 const node1 = path [ j ]
@@ -743,15 +747,15 @@ export class AssignableViaCapacityPathingSolver_DirectiveSubOptimal extends Base
743747 if ( start && end && isValidPoint ( start ) && isValidPoint ( end ) ) {
744748 graphics . lines ! . push ( {
745749 points : [ start , end ] ,
746- strokeColor : "red " ,
747- strokeDash : "10 5" ,
750+ strokeColor : "green " ,
751+ strokeDash : "20 5" ,
748752 } )
749753 }
750754 }
751755
752756 // 7. Visualize directive vias (if using directive strategy)
753- if ( this . unprocessedSubpaths && this . unprocessedSubpaths . length === 3 ) {
754- const [ , mid ] = this . unprocessedSubpaths
757+ if ( this . ogUnprocessedSubpaths ) {
758+ const [ , mid ] = this . ogUnprocessedSubpaths
755759 if ( mid . start ?. center && isValidPoint ( mid . start . center ) ) {
756760 const radius = Math . max ( mid . start . width || 0 , mid . start . height || 0 )
757761 if ( isValidNumber ( radius ) && radius > 0 ) {
0 commit comments