@tscircuit/schematic-trace-solver 0.0.51 → 0.0.52
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 +65 -3
- package/dist/index.js +827 -51
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +14 -0
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/TraceAnchoredNetLabelOverlapSolver.ts +331 -0
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/candidates.ts +429 -0
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/geometry.ts +250 -0
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/types.ts +47 -0
- package/lib/solvers/TraceAnchoredNetLabelOverlapSolver/visualize.ts +125 -0
- package/package.json +1 -1
- package/tests/examples/__snapshots__/example17.snap.svg +2 -2
- package/tests/examples/__snapshots__/example30.snap.svg +59 -59
package/dist/index.d.ts
CHANGED
|
@@ -642,10 +642,10 @@ type CandidateLabel = {
|
|
|
642
642
|
width: number;
|
|
643
643
|
height: number;
|
|
644
644
|
};
|
|
645
|
-
type CandidateStatus = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
645
|
+
type CandidateStatus$1 = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
646
646
|
type CandidatePhase = "rotate" | "shift";
|
|
647
647
|
type EvaluatedCandidate = CandidateLabel & {
|
|
648
|
-
status: CandidateStatus;
|
|
648
|
+
status: CandidateStatus$1;
|
|
649
649
|
selected: boolean;
|
|
650
650
|
phase: CandidatePhase;
|
|
651
651
|
distance?: number;
|
|
@@ -760,6 +760,67 @@ declare class VccNetLabelCornerPlacementSolver extends BaseSolver {
|
|
|
760
760
|
visualize(): GraphicsObject;
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
+
interface TraceAnchoredNetLabelOverlapSolverParams {
|
|
764
|
+
inputProblem: InputProblem;
|
|
765
|
+
traces: SolvedTracePath[];
|
|
766
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
767
|
+
}
|
|
768
|
+
type LabelOverlap = {
|
|
769
|
+
firstLabelIndex: number;
|
|
770
|
+
secondLabelIndex: number;
|
|
771
|
+
};
|
|
772
|
+
type CandidateStatus = "valid" | "chip-collision" | "trace-collision" | "netlabel-collision";
|
|
773
|
+
type LabelCandidate = {
|
|
774
|
+
anchorPoint: Point;
|
|
775
|
+
center: Point;
|
|
776
|
+
width: number;
|
|
777
|
+
height: number;
|
|
778
|
+
orientation: FacingDirection;
|
|
779
|
+
traceId: string;
|
|
780
|
+
pathDistance: number;
|
|
781
|
+
distanceFromOriginal: number;
|
|
782
|
+
status: CandidateStatus;
|
|
783
|
+
selected: boolean;
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
declare class TraceAnchoredNetLabelOverlapSolver extends BaseSolver {
|
|
787
|
+
inputProblem: InputProblem;
|
|
788
|
+
traces: SolvedTracePath[];
|
|
789
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
790
|
+
outputNetLabelPlacements: NetLabelPlacement[];
|
|
791
|
+
currentOverlap: LabelOverlap | null;
|
|
792
|
+
currentCandidateResults: LabelCandidate[];
|
|
793
|
+
private activeSearch;
|
|
794
|
+
private skippedOverlapKeys;
|
|
795
|
+
constructor(params: TraceAnchoredNetLabelOverlapSolverParams);
|
|
796
|
+
getConstructorParams(): ConstructorParameters<typeof TraceAnchoredNetLabelOverlapSolver>[0];
|
|
797
|
+
_step(): void;
|
|
798
|
+
getOutput(): {
|
|
799
|
+
netLabelPlacements: NetLabelPlacement[];
|
|
800
|
+
};
|
|
801
|
+
private findNextOverlap;
|
|
802
|
+
private isLabelEligible;
|
|
803
|
+
private labelsOverlap;
|
|
804
|
+
private startNextOverlapSearch;
|
|
805
|
+
private getMoveLabelIndices;
|
|
806
|
+
private getNextSearchWithCandidates;
|
|
807
|
+
private activateNextLabelSearch;
|
|
808
|
+
private skipSearch;
|
|
809
|
+
private evaluateNextCandidate;
|
|
810
|
+
private getCandidatesForLabel;
|
|
811
|
+
private getCandidateStatus;
|
|
812
|
+
private applyCandidate;
|
|
813
|
+
private intersectsAnyChip;
|
|
814
|
+
private intersectsAnyOtherLabel;
|
|
815
|
+
private getTraceLocationsForLabel;
|
|
816
|
+
private isTraceAssociatedWithLabel;
|
|
817
|
+
private getOverlapKey;
|
|
818
|
+
private finish;
|
|
819
|
+
private setActiveSearch;
|
|
820
|
+
private clearActiveSearch;
|
|
821
|
+
visualize(): GraphicsObject;
|
|
822
|
+
}
|
|
823
|
+
|
|
763
824
|
/**
|
|
764
825
|
* Pipeline solver that runs a series of solvers to find the best schematic layout.
|
|
765
826
|
* Coordinates the entire layout process from chip partitioning through final packing.
|
|
@@ -788,12 +849,13 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
|
788
849
|
example28Solver?: Example28Solver;
|
|
789
850
|
availableNetOrientationSolver?: AvailableNetOrientationSolver;
|
|
790
851
|
vccNetLabelCornerPlacementSolver?: VccNetLabelCornerPlacementSolver;
|
|
852
|
+
traceAnchoredNetLabelOverlapSolver?: TraceAnchoredNetLabelOverlapSolver;
|
|
791
853
|
startTimeOfPhase: Record<string, number>;
|
|
792
854
|
endTimeOfPhase: Record<string, number>;
|
|
793
855
|
timeSpentOnPhase: Record<string, number>;
|
|
794
856
|
firstIterationOfPhase: Record<string, number>;
|
|
795
857
|
inputProblem: InputProblem;
|
|
796
|
-
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>)[];
|
|
858
|
+
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>)[];
|
|
797
859
|
constructor(inputProblem: InputProblem);
|
|
798
860
|
getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>[0];
|
|
799
861
|
currentPipelineStepIndex: number;
|