@tscircuit/schematic-trace-solver 0.0.61 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -83,6 +83,7 @@ interface InputNetConnection {
83
83
  netId: string;
84
84
  pinIds: Array<PinId>;
85
85
  netLabelWidth?: number;
86
+ netLabelHeight?: number;
86
87
  }
87
88
  interface InputProblem {
88
89
  chips: Array<InputChip>;
@@ -288,6 +289,7 @@ declare class SingleNetLabelPlacementSolver extends BaseSolver {
288
289
  availableOrientations: Array<FacingDirection>;
289
290
  chipObstacleSpatialIndex: ChipObstacleSpatialIndex;
290
291
  netLabelWidth?: number;
292
+ netLabelHeight?: number;
291
293
  netLabelPlacement: NetLabelPlacement | null;
292
294
  testedCandidates: Array<{
293
295
  center: {
@@ -316,6 +318,7 @@ declare class SingleNetLabelPlacementSolver extends BaseSolver {
316
318
  overlappingSameNetTraceGroup: OverlappingSameNetTraceGroup;
317
319
  availableOrientations: FacingDirection[];
318
320
  netLabelWidth?: number;
321
+ netLabelHeight?: number;
319
322
  });
320
323
  getConstructorParams(): ConstructorParameters<typeof SingleNetLabelPlacementSolver>[0];
321
324
  _step(): void;
@@ -385,6 +388,7 @@ declare class NetLabelPlacementSolver extends BaseSolver {
385
388
  });
386
389
  computeOverlappingSameNetTraceGroups(): Array<OverlappingSameNetTraceGroup>;
387
390
  private getNetLabelWidthForGroup;
391
+ private getNetLabelHeightForGroup;
388
392
  _step(): void;
389
393
  visualize(): GraphicsObject;
390
394
  }
@@ -647,10 +651,10 @@ type CandidateLabel = {
647
651
  width: number;
648
652
  height: number;
649
653
  };
650
- type CandidateStatus$1 = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
654
+ type CandidateStatus$2 = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
651
655
  type CandidatePhase = "rotate" | "shift" | "lateral-shift";
652
656
  type EvaluatedCandidate = CandidateLabel & {
653
- status: CandidateStatus$1;
657
+ status: CandidateStatus$2;
654
658
  selected: boolean;
655
659
  phase: CandidatePhase;
656
660
  distance?: number;
@@ -707,6 +711,7 @@ declare class AvailableNetOrientationSolver extends BaseSolver {
707
711
  private getLateralColumnMaxDistance;
708
712
  private createCandidate;
709
713
  private getNetLabelWidth;
714
+ private getNetLabelHeight;
710
715
  private getCandidateStatus;
711
716
  private getBoundsStatus;
712
717
  private intersectsAnyOtherNetLabel;
@@ -782,7 +787,7 @@ type LabelOverlap = {
782
787
  firstLabelIndex: number;
783
788
  secondLabelIndex: number;
784
789
  };
785
- type CandidateStatus = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
790
+ type CandidateStatus$1 = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
786
791
  type LabelCandidate = {
787
792
  anchorPoint: Point;
788
793
  center: Point;
@@ -792,7 +797,7 @@ type LabelCandidate = {
792
797
  traceId: string;
793
798
  pathDistance: number;
794
799
  distanceFromOriginal: number;
795
- status: CandidateStatus;
800
+ status: CandidateStatus$1;
796
801
  selected: boolean;
797
802
  };
798
803
 
@@ -860,6 +865,66 @@ declare class NetLabelTraceCollisionSolver extends BaseSolver {
860
865
  visualize(): GraphicsObject;
861
866
  }
862
867
 
868
+ type CandidateStatus = "ok" | "chip-collision" | "trace-collision" | "label-collision";
869
+ type Candidate = {
870
+ orientation: FacingDirection;
871
+ anchor: {
872
+ x: number;
873
+ y: number;
874
+ };
875
+ center: {
876
+ x: number;
877
+ y: number;
878
+ };
879
+ width: number;
880
+ height: number;
881
+ bounds: {
882
+ minX: number;
883
+ minY: number;
884
+ maxX: number;
885
+ maxY: number;
886
+ };
887
+ hostPairId?: MspConnectionPairId;
888
+ hostSegIndex?: number;
889
+ status: CandidateStatus | null;
890
+ };
891
+ interface NetLabelNetLabelCollisionSolverParams {
892
+ inputProblem: InputProblem;
893
+ traces: SolvedTracePath[];
894
+ netLabelPlacements: NetLabelPlacement[];
895
+ }
896
+ declare class NetLabelNetLabelCollisionSolver extends BaseSolver {
897
+ inputProblem: InputProblem;
898
+ traces: SolvedTracePath[];
899
+ netLabelPlacements: NetLabelPlacement[];
900
+ outputNetLabelPlacements: NetLabelPlacement[];
901
+ currentCollision: [NetLabelPlacement, NetLabelPlacement] | null;
902
+ currentLabelToMove: NetLabelPlacement | null;
903
+ candidateResults: Candidate[];
904
+ private chipIndex;
905
+ private traceMap;
906
+ private skippedCollisionKeys;
907
+ private labelsToTry;
908
+ private candidateQueue;
909
+ private candidateIndex;
910
+ constructor(params: NetLabelNetLabelCollisionSolverParams);
911
+ getConstructorParams(): ConstructorParameters<typeof NetLabelNetLabelCollisionSolver>[0];
912
+ getOutput(): {
913
+ netLabelPlacements: NetLabelPlacement[];
914
+ };
915
+ private labelBounds;
916
+ private collisionKey;
917
+ private findNextCollidingPair;
918
+ private netLabelWidthOf;
919
+ private netLabelHeightOf;
920
+ private buildCandidatesForLabel;
921
+ private checkCandidate;
922
+ private beginSearchForLabel;
923
+ private clearActiveSearch;
924
+ _step(): void;
925
+ visualize(): GraphicsObject;
926
+ }
927
+
863
928
  /**
864
929
  * Pipeline solver that runs a series of solvers to find the best schematic layout.
865
930
  * Coordinates the entire layout process from chip partitioning through final packing.
@@ -890,12 +955,13 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
890
955
  vccNetLabelCornerPlacementSolver?: VccNetLabelCornerPlacementSolver;
891
956
  traceAnchoredNetLabelOverlapSolver?: TraceAnchoredNetLabelOverlapSolver;
892
957
  netLabelTraceCollisionSolver?: NetLabelTraceCollisionSolver;
958
+ netLabelNetLabelCollisionSolver?: NetLabelNetLabelCollisionSolver;
893
959
  startTimeOfPhase: Record<string, number>;
894
960
  endTimeOfPhase: Record<string, number>;
895
961
  timeSpentOnPhase: Record<string, number>;
896
962
  firstIterationOfPhase: Record<string, number>;
897
963
  inputProblem: InputProblem;
898
- pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver> | PipelineStep<typeof AvailableNetOrientationSolver> | PipelineStep<typeof VccNetLabelCornerPlacementSolver> | PipelineStep<typeof TraceAnchoredNetLabelOverlapSolver> | PipelineStep<typeof NetLabelTraceCollisionSolver>)[];
964
+ pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver> | PipelineStep<typeof AvailableNetOrientationSolver> | PipelineStep<typeof VccNetLabelCornerPlacementSolver> | PipelineStep<typeof TraceAnchoredNetLabelOverlapSolver> | PipelineStep<typeof NetLabelTraceCollisionSolver> | PipelineStep<typeof NetLabelNetLabelCollisionSolver>)[];
899
965
  constructor(inputProblem: InputProblem);
900
966
  getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>[0];
901
967
  currentPipelineStepIndex: number;