@tscircuit/schematic-trace-solver 0.0.31 → 0.0.33
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/CLAUDE.md +8 -0
- package/dist/index.d.ts +24 -53
- package/dist/index.js +494 -807
- package/lib/index.ts +1 -0
- package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +54 -3
- package/lib/solvers/MspConnectionPairSolver/doesPairCrossRestrictedCenterLines.ts +62 -0
- package/lib/solvers/MspConnectionPairSolver/getMspConnectionPairsFromPins.ts +7 -2
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +5 -11
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver.ts +37 -7
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/generateElbowVariants.ts +7 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +239 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions.ts +57 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/mid.ts +97 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/pathOps.ts +65 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/rect.ts +19 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +14 -14
- package/package.json +1 -1
- package/site/SchematicTracePipelineSolver/SchematicTracePipelineSolver03.page.tsx +486 -0
- package/site/examples/example09.page.tsx +1 -1
- package/tests/examples/__snapshots__/example01.snap.svg +29 -29
- package/tests/examples/__snapshots__/example02.snap.svg +13 -10
- package/tests/examples/__snapshots__/example04.snap.svg +12 -12
- package/tests/examples/__snapshots__/example05.snap.svg +38 -38
- package/tests/examples/__snapshots__/example06.snap.svg +14 -14
- package/tests/examples/__snapshots__/example08.snap.svg +29 -23
- package/tests/examples/__snapshots__/example09.snap.svg +119 -149
- package/tests/examples/__snapshots__/example11.snap.svg +39 -33
- package/tests/examples/__snapshots__/example12.snap.svg +32 -29
- package/tests/examples/__snapshots__/example13.snap.svg +87 -84
- package/tests/examples/__snapshots__/example15.snap.svg +57 -57
- package/tests/examples/__snapshots__/example16.snap.svg +3 -3
- package/tests/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver_repro03.test.ts +491 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
- use `bunx tsc --noEmit` to type check
|
|
2
|
+
- use `bun test path/to/test.ts` to run a test
|
|
3
|
+
- use `bun add <package>` to add a package
|
|
4
|
+
|
|
5
|
+
There are two ways the user tests the algorithm:
|
|
6
|
+
|
|
7
|
+
- Running `bun test`
|
|
8
|
+
- Looking at the `*.page.tsx` files in the `site` directory via a browser
|
package/dist/index.d.ts
CHANGED
|
@@ -121,64 +121,38 @@ declare class MspConnectionPairSolver extends BaseSolver {
|
|
|
121
121
|
visualize(): GraphicsObject;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
type
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
y: undefined;
|
|
131
|
-
x: number;
|
|
124
|
+
type ChipWithBounds = {
|
|
125
|
+
chipId: string;
|
|
126
|
+
minX: number;
|
|
127
|
+
minY: number;
|
|
128
|
+
maxX: number;
|
|
129
|
+
maxY: number;
|
|
132
130
|
};
|
|
133
|
-
declare class GuidelinesSolver extends BaseSolver {
|
|
134
|
-
inputProblem: InputProblem;
|
|
135
|
-
guidelines: Guideline[];
|
|
136
|
-
chipPairsGenerator: Generator<readonly [InputChip, InputChip]>;
|
|
137
|
-
usedXGuidelines: Set<number>;
|
|
138
|
-
usedYGuidelines: Set<number>;
|
|
139
|
-
constructor(params: {
|
|
140
|
-
inputProblem: InputProblem;
|
|
141
|
-
});
|
|
142
|
-
getConstructorParams(): ConstructorParameters<typeof GuidelinesSolver>[0];
|
|
143
|
-
_step(): void;
|
|
144
|
-
visualize(): GraphicsObject;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface MovableSegment {
|
|
148
|
-
start: Point;
|
|
149
|
-
end: Point;
|
|
150
|
-
freedom: "x+" | "x-" | "y+" | "y-";
|
|
151
|
-
dir: {
|
|
152
|
-
x: number;
|
|
153
|
-
y: number;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
131
|
|
|
157
|
-
|
|
158
|
-
chipId: ChipId;
|
|
159
|
-
};
|
|
160
|
-
declare class SchematicTraceSingleLineSolver extends BaseSolver {
|
|
132
|
+
declare class SchematicTraceSingleLineSolver2 extends BaseSolver {
|
|
161
133
|
pins: MspConnectionPair["pins"];
|
|
162
134
|
inputProblem: InputProblem;
|
|
163
|
-
guidelines: Guideline[];
|
|
164
135
|
chipMap: Record<string, InputChip>;
|
|
165
|
-
|
|
136
|
+
obstacles: ChipWithBounds[];
|
|
137
|
+
rectById: Map<string, ChipWithBounds>;
|
|
138
|
+
aabb: {
|
|
139
|
+
minX: number;
|
|
140
|
+
maxX: number;
|
|
141
|
+
minY: number;
|
|
142
|
+
maxY: number;
|
|
143
|
+
};
|
|
166
144
|
baseElbow: Point[];
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
solvedTracePath: {
|
|
171
|
-
x: number;
|
|
172
|
-
y: number;
|
|
173
|
-
}[] | null;
|
|
174
|
-
pinIdMap: Map<PinId, ChipPin>;
|
|
145
|
+
solvedTracePath: Point[] | null;
|
|
146
|
+
private queue;
|
|
147
|
+
private visited;
|
|
175
148
|
constructor(params: {
|
|
176
149
|
pins: MspConnectionPair["pins"];
|
|
177
|
-
guidelines: Guideline[];
|
|
178
150
|
inputProblem: InputProblem;
|
|
179
151
|
chipMap: Record<string, InputChip>;
|
|
180
152
|
});
|
|
181
|
-
getConstructorParams(): ConstructorParameters<typeof
|
|
153
|
+
getConstructorParams(): ConstructorParameters<typeof SchematicTraceSingleLineSolver2>[0];
|
|
154
|
+
private axisOfSegment;
|
|
155
|
+
private pathLength;
|
|
182
156
|
_step(): void;
|
|
183
157
|
visualize(): GraphicsObject;
|
|
184
158
|
}
|
|
@@ -190,7 +164,6 @@ interface SolvedTracePath extends MspConnectionPair {
|
|
|
190
164
|
}
|
|
191
165
|
declare class SchematicTraceLinesSolver extends BaseSolver {
|
|
192
166
|
inputProblem: InputProblem;
|
|
193
|
-
guidelines: Guideline[];
|
|
194
167
|
mspConnectionPairs: MspConnectionPair[];
|
|
195
168
|
dcConnMap: ConnectivityMap;
|
|
196
169
|
globalConnMap: ConnectivityMap;
|
|
@@ -201,14 +174,13 @@ declare class SchematicTraceLinesSolver extends BaseSolver {
|
|
|
201
174
|
failedConnectionPairs: Array<MspConnectionPair & {
|
|
202
175
|
error?: string;
|
|
203
176
|
}>;
|
|
204
|
-
activeSubSolver:
|
|
177
|
+
activeSubSolver: SchematicTraceSingleLineSolver2 | null;
|
|
205
178
|
constructor(params: {
|
|
206
179
|
mspConnectionPairs: MspConnectionPair[];
|
|
207
180
|
chipMap: Record<string, InputChip>;
|
|
208
181
|
dcConnMap: ConnectivityMap;
|
|
209
182
|
globalConnMap: ConnectivityMap;
|
|
210
183
|
inputProblem: InputProblem;
|
|
211
|
-
guidelines: Guideline[];
|
|
212
184
|
});
|
|
213
185
|
getConstructorParams(): ConstructorParameters<typeof SchematicTraceLinesSolver>[0];
|
|
214
186
|
_step(): void;
|
|
@@ -419,7 +391,6 @@ type PipelineStep<T extends new (...args: any[]) => BaseSolver> = {
|
|
|
419
391
|
};
|
|
420
392
|
declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
421
393
|
mspConnectionPairSolver?: MspConnectionPairSolver;
|
|
422
|
-
guidelinesSolver?: GuidelinesSolver;
|
|
423
394
|
schematicTraceLinesSolver?: SchematicTraceLinesSolver;
|
|
424
395
|
traceOverlapShiftSolver?: TraceOverlapShiftSolver;
|
|
425
396
|
netLabelPlacementSolver?: NetLabelPlacementSolver;
|
|
@@ -428,7 +399,7 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
|
428
399
|
timeSpentOnPhase: Record<string, number>;
|
|
429
400
|
firstIterationOfPhase: Record<string, number>;
|
|
430
401
|
inputProblem: InputProblem;
|
|
431
|
-
pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof
|
|
402
|
+
pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver>)[];
|
|
432
403
|
constructor(inputProblem: InputProblem);
|
|
433
404
|
getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>[0];
|
|
434
405
|
currentPipelineStepIndex: number;
|
|
@@ -444,4 +415,4 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
|
|
|
444
415
|
preview(): GraphicsObject;
|
|
445
416
|
}
|
|
446
417
|
|
|
447
|
-
export { type ChipId, type InputChip, type InputDirectConnection, type InputNetConnection, type InputPin, type InputProblem, type NetId, type PinId, SchematicTracePipelineSolver };
|
|
418
|
+
export { type ChipId, type InputChip, type InputDirectConnection, type InputNetConnection, type InputPin, type InputProblem, type NetId, type PinId, SchematicTracePipelineSolver, SchematicTraceSingleLineSolver2 };
|