@tscircuit/schematic-trace-solver 0.0.10 → 0.0.12

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.js CHANGED
@@ -5264,11 +5264,13 @@ var ConnectivityMap = class {
5264
5264
  var getConnectivityMapsFromInputProblem = (inputProblem) => {
5265
5265
  const directConnMap = new ConnectivityMap({});
5266
5266
  for (const directConn of inputProblem.directConnections) {
5267
- directConnMap.addConnections([directConn.pinIds]);
5267
+ directConnMap.addConnections([
5268
+ directConn.netId ? [directConn.netId, ...directConn.pinIds] : directConn.pinIds
5269
+ ]);
5268
5270
  }
5269
5271
  const netConnMap = new ConnectivityMap(directConnMap.netMap);
5270
5272
  for (const netConn of inputProblem.netConnections) {
5271
- netConnMap.addConnections([netConn.pinIds]);
5273
+ netConnMap.addConnections([[netConn.netId, ...netConn.pinIds]]);
5272
5274
  }
5273
5275
  return { directConnMap, netConnMap };
5274
5276
  };
@@ -5512,7 +5514,7 @@ var MspConnectionPairSolver = class extends BaseSolver {
5512
5514
  return;
5513
5515
  }
5514
5516
  const msp = getOrthogonalMinimumSpanningTree(
5515
- directlyConnectedPins.map((p) => this.pinMap[p]),
5517
+ directlyConnectedPins.map((p) => this.pinMap[p]).filter(Boolean),
5516
5518
  { maxDistance: this.maxMspPairDistance }
5517
5519
  );
5518
5520
  for (const [pin1, pin2] of msp) {
@@ -6708,16 +6710,40 @@ var SchematicTraceSingleLineSolver = class extends BaseSolver {
6708
6710
  const startPin = this.pins.find(
6709
6711
  (pin) => Math.abs(pin.x - start.x) < 1e-10 && Math.abs(pin.y - start.y) < 1e-10
6710
6712
  );
6711
- if (startPin && !excludeChipIds.includes(startPin.chipId)) {
6712
- excludeChipIds.push(startPin.chipId);
6713
+ if (startPin) {
6714
+ const bounds = getInputChipBounds(this.chipMap[startPin.chipId]);
6715
+ const dx = end.x - start.x;
6716
+ const dy = end.y - start.y;
6717
+ const EPS = 1e-9;
6718
+ const onLeft = Math.abs(start.x - bounds.minX) < 1e-9;
6719
+ const onRight = Math.abs(start.x - bounds.maxX) < 1e-9;
6720
+ const onBottom = Math.abs(start.y - bounds.minY) < 1e-9;
6721
+ const onTop = Math.abs(start.y - bounds.maxY) < 1e-9;
6722
+ const entersInterior = onLeft && dx > EPS || onRight && dx < -EPS || onBottom && dy > EPS || onTop && dy < -EPS;
6723
+ if (entersInterior) return;
6724
+ if (!excludeChipIds.includes(startPin.chipId)) {
6725
+ excludeChipIds.push(startPin.chipId);
6726
+ }
6713
6727
  }
6714
6728
  }
6715
6729
  if (isEndPin) {
6716
6730
  const endPin = this.pins.find(
6717
6731
  (pin) => Math.abs(pin.x - end.x) < 1e-10 && Math.abs(pin.y - end.y) < 1e-10
6718
6732
  );
6719
- if (endPin && !excludeChipIds.includes(endPin.chipId)) {
6720
- excludeChipIds.push(endPin.chipId);
6733
+ if (endPin) {
6734
+ const bounds = getInputChipBounds(this.chipMap[endPin.chipId]);
6735
+ const dx = start.x - end.x;
6736
+ const dy = start.y - end.y;
6737
+ const EPS = 1e-9;
6738
+ const onLeft = Math.abs(end.x - bounds.minX) < 1e-9;
6739
+ const onRight = Math.abs(end.x - bounds.maxX) < 1e-9;
6740
+ const onBottom = Math.abs(end.y - bounds.minY) < 1e-9;
6741
+ const onTop = Math.abs(end.y - bounds.maxY) < 1e-9;
6742
+ const entersInterior = onLeft && dx > EPS || onRight && dx < -EPS || onBottom && dy > EPS || onTop && dy < -EPS;
6743
+ if (entersInterior) return;
6744
+ if (!excludeChipIds.includes(endPin.chipId)) {
6745
+ excludeChipIds.push(endPin.chipId);
6746
+ }
6721
6747
  }
6722
6748
  }
6723
6749
  const obstacleOps = { excludeChipIds };
@@ -113,7 +113,7 @@ export class MspConnectionPairSolver extends BaseSolver {
113
113
  // There are more than 3 pins, so we need to run MSP to find the best pairs
114
114
 
115
115
  const msp = getOrthogonalMinimumSpanningTree(
116
- directlyConnectedPins.map((p) => this.pinMap[p]!),
116
+ directlyConnectedPins.map((p) => this.pinMap[p]!).filter(Boolean),
117
117
  { maxDistance: this.maxMspPairDistance },
118
118
  )
119
119
 
@@ -7,13 +7,17 @@ export const getConnectivityMapsFromInputProblem = (
7
7
  const directConnMap = new ConnectivityMap({})
8
8
 
9
9
  for (const directConn of inputProblem.directConnections) {
10
- directConnMap.addConnections([directConn.pinIds])
10
+ directConnMap.addConnections([
11
+ directConn.netId
12
+ ? [directConn.netId, ...directConn.pinIds]
13
+ : directConn.pinIds,
14
+ ])
11
15
  }
12
16
 
13
17
  const netConnMap = new ConnectivityMap(directConnMap.netMap)
14
18
 
15
19
  for (const netConn of inputProblem.netConnections) {
16
- netConnMap.addConnections([netConn.pinIds])
20
+ netConnMap.addConnections([[netConn.netId, ...netConn.pinIds]])
17
21
  }
18
22
 
19
23
  return { directConnMap, netConnMap }
@@ -13,6 +13,7 @@ import {
13
13
  } from "./generateElbowVariants"
14
14
  import type { Point } from "@tscircuit/math-utils"
15
15
  import { visualizeGuidelines } from "lib/solvers/GuidelinesSolver/visualizeGuidelines"
16
+ import { getInputChipBounds } from "lib/solvers/GuidelinesSolver/getInputChipBounds"
16
17
  import { getColorFromString } from "lib/utils/getColorFromString"
17
18
 
18
19
  export class SchematicTraceSingleLineSolver extends BaseSolver {
@@ -128,8 +129,25 @@ export class SchematicTraceSingleLineSolver extends BaseSolver {
128
129
  Math.abs(pin.x - start.x) < 1e-10 &&
129
130
  Math.abs(pin.y - start.y) < 1e-10,
130
131
  )
131
- if (startPin && !excludeChipIds.includes(startPin.chipId)) {
132
- excludeChipIds.push(startPin.chipId)
132
+ if (startPin) {
133
+ // Enforce that the first segment does not enter the chip interior.
134
+ const bounds = getInputChipBounds(this.chipMap[startPin.chipId])
135
+ const dx = end.x - start.x
136
+ const dy = end.y - start.y
137
+ const EPS = 1e-9
138
+ const onLeft = Math.abs(start.x - bounds.minX) < 1e-9
139
+ const onRight = Math.abs(start.x - bounds.maxX) < 1e-9
140
+ const onBottom = Math.abs(start.y - bounds.minY) < 1e-9
141
+ const onTop = Math.abs(start.y - bounds.maxY) < 1e-9
142
+ const entersInterior =
143
+ (onLeft && dx > EPS) ||
144
+ (onRight && dx < -EPS) ||
145
+ (onBottom && dy > EPS) ||
146
+ (onTop && dy < -EPS)
147
+ if (entersInterior) return
148
+ if (!excludeChipIds.includes(startPin.chipId)) {
149
+ excludeChipIds.push(startPin.chipId)
150
+ }
133
151
  }
134
152
  }
135
153
 
@@ -138,8 +156,25 @@ export class SchematicTraceSingleLineSolver extends BaseSolver {
138
156
  (pin) =>
139
157
  Math.abs(pin.x - end.x) < 1e-10 && Math.abs(pin.y - end.y) < 1e-10,
140
158
  )
141
- if (endPin && !excludeChipIds.includes(endPin.chipId)) {
142
- excludeChipIds.push(endPin.chipId)
159
+ if (endPin) {
160
+ // Enforce that the last segment approaches the pin from outside the chip.
161
+ const bounds = getInputChipBounds(this.chipMap[endPin.chipId])
162
+ const dx = start.x - end.x // vector from pin outward toward previous point
163
+ const dy = start.y - end.y
164
+ const EPS = 1e-9
165
+ const onLeft = Math.abs(end.x - bounds.minX) < 1e-9
166
+ const onRight = Math.abs(end.x - bounds.maxX) < 1e-9
167
+ const onBottom = Math.abs(end.y - bounds.minY) < 1e-9
168
+ const onTop = Math.abs(end.y - bounds.maxY) < 1e-9
169
+ const entersInterior =
170
+ (onLeft && dx > EPS) ||
171
+ (onRight && dx < -EPS) ||
172
+ (onBottom && dy > EPS) ||
173
+ (onTop && dy < -EPS)
174
+ if (entersInterior) return
175
+ if (!excludeChipIds.includes(endPin.chipId)) {
176
+ excludeChipIds.push(endPin.chipId)
177
+ }
143
178
  }
144
179
  }
145
180
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-trace-solver",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.10",
4
+ "version": "0.0.12",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",
@@ -0,0 +1,11 @@
1
+ import { useMemo } from "react"
2
+ import { GenericSolverDebugger } from "../components/GenericSolverDebugger"
3
+ import { SchematicTraceLinesSolver } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
4
+ import inputProblem from "./SchematicTraceLinesSolver02_params.json"
5
+
6
+ export default () => {
7
+ const solver = useMemo(() => {
8
+ return new SchematicTraceLinesSolver(inputProblem as any)
9
+ }, [])
10
+ return <GenericSolverDebugger solver={solver} />
11
+ }
@@ -0,0 +1,393 @@
1
+ {
2
+ "inputProblem": {
3
+ "chips": [
4
+ {
5
+ "chipId": "schematic_component_0",
6
+ "center": {
7
+ "x": 0,
8
+ "y": 0
9
+ },
10
+ "width": 1.8,
11
+ "height": 5,
12
+ "pins": [
13
+ {
14
+ "pinId": "U1.1",
15
+ "x": 0.9,
16
+ "y": 1.2
17
+ },
18
+ {
19
+ "pinId": "U1.2",
20
+ "x": 0.9,
21
+ "y": 0.3999999999999999
22
+ },
23
+ {
24
+ "pinId": "U1.3",
25
+ "x": 0.9,
26
+ "y": 0.5999999999999999
27
+ },
28
+ {
29
+ "pinId": "U1.4",
30
+ "x": -0.9,
31
+ "y": 0.3999999999999999
32
+ },
33
+ {
34
+ "pinId": "U1.5",
35
+ "x": 0.9,
36
+ "y": 0.9999999999999998
37
+ },
38
+ {
39
+ "pinId": "U1.6",
40
+ "x": 0.9,
41
+ "y": -0.19999999999999996
42
+ },
43
+ {
44
+ "pinId": "U1.7",
45
+ "x": -0.9,
46
+ "y": -0.7999999999999998
47
+ },
48
+ {
49
+ "pinId": "U1.9",
50
+ "x": 0.9,
51
+ "y": 0.19999999999999996
52
+ },
53
+ {
54
+ "pinId": "U1.10",
55
+ "x": 0.9,
56
+ "y": 0
57
+ },
58
+ {
59
+ "pinId": "U1.11",
60
+ "x": 0.9,
61
+ "y": 0.7999999999999998
62
+ },
63
+ {
64
+ "pinId": "U1.12",
65
+ "x": 0.9,
66
+ "y": -1.2
67
+ },
68
+ {
69
+ "pinId": "U1.13",
70
+ "x": 0.9,
71
+ "y": -1
72
+ },
73
+ {
74
+ "pinId": "U1.14",
75
+ "x": 0.9,
76
+ "y": -0.7999999999999999
77
+ },
78
+ {
79
+ "pinId": "U1.15",
80
+ "x": -0.9,
81
+ "y": 1
82
+ },
83
+ {
84
+ "pinId": "U1.16",
85
+ "x": -0.9,
86
+ "y": 1.2
87
+ },
88
+ {
89
+ "pinId": "U1.17",
90
+ "x": -0.9,
91
+ "y": 0.5999999999999999
92
+ },
93
+ {
94
+ "pinId": "U1.18",
95
+ "x": -0.9,
96
+ "y": -0.9999999999999998
97
+ },
98
+ {
99
+ "pinId": "U1.19",
100
+ "x": -0.9,
101
+ "y": -0.19999999999999996
102
+ },
103
+ {
104
+ "pinId": "U1.20",
105
+ "x": -0.9,
106
+ "y": 0.7999999999999999
107
+ },
108
+ {
109
+ "pinId": "U1.21",
110
+ "x": -0.9,
111
+ "y": -1.2
112
+ },
113
+ {
114
+ "pinId": "U1.22",
115
+ "x": 0.9,
116
+ "y": -0.5999999999999999
117
+ },
118
+ {
119
+ "pinId": "U1.23",
120
+ "x": 0.9,
121
+ "y": -0.3999999999999999
122
+ },
123
+ {
124
+ "pinId": "U1.25",
125
+ "x": -0.9,
126
+ "y": -0.5999999999999999
127
+ },
128
+ {
129
+ "pinId": "U1.26",
130
+ "x": -0.9,
131
+ "y": -0.3999999999999999
132
+ },
133
+ {
134
+ "pinId": "U1.27",
135
+ "x": -0.9,
136
+ "y": 0.19999999999999996
137
+ },
138
+ {
139
+ "pinId": "U1.28",
140
+ "x": -0.9,
141
+ "y": 0
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "chipId": "schematic_component_1",
147
+ "center": {
148
+ "x": 2,
149
+ "y": 1
150
+ },
151
+ "width": 1.0402490999999996,
152
+ "height": 0.5476905999999993,
153
+ "pins": [
154
+ {
155
+ "pinId": "LED1.1",
156
+ "x": 1.4798754500000002,
157
+ "y": 1.0005122999999987
158
+ },
159
+ {
160
+ "pinId": "LED1.2",
161
+ "x": 2.52012455,
162
+ "y": 0.9994877000000013
163
+ }
164
+ ]
165
+ }
166
+ ],
167
+ "directConnections": [
168
+ {
169
+ "pinIds": ["LED1.2", "U1.20"],
170
+ "netId": ".LED1 > port.right to .U1 > .pin20"
171
+ }
172
+ ],
173
+ "netConnections": [],
174
+ "availableNetLabelOrientations": {},
175
+ "maxMspPairDistance": 2
176
+ },
177
+ "chipMap": {
178
+ "schematic_component_0": {
179
+ "chipId": "schematic_component_0",
180
+ "center": {
181
+ "x": 0,
182
+ "y": 0
183
+ },
184
+ "width": 1.8,
185
+ "height": 5,
186
+ "pins": [
187
+ {
188
+ "pinId": "U1.1",
189
+ "x": 0.9,
190
+ "y": 1.2
191
+ },
192
+ {
193
+ "pinId": "U1.2",
194
+ "x": 0.9,
195
+ "y": 0.3999999999999999
196
+ },
197
+ {
198
+ "pinId": "U1.3",
199
+ "x": 0.9,
200
+ "y": 0.5999999999999999
201
+ },
202
+ {
203
+ "pinId": "U1.4",
204
+ "x": -0.9,
205
+ "y": 0.3999999999999999
206
+ },
207
+ {
208
+ "pinId": "U1.5",
209
+ "x": 0.9,
210
+ "y": 0.9999999999999998
211
+ },
212
+ {
213
+ "pinId": "U1.6",
214
+ "x": 0.9,
215
+ "y": -0.19999999999999996
216
+ },
217
+ {
218
+ "pinId": "U1.7",
219
+ "x": -0.9,
220
+ "y": -0.7999999999999998
221
+ },
222
+ {
223
+ "pinId": "U1.9",
224
+ "x": 0.9,
225
+ "y": 0.19999999999999996
226
+ },
227
+ {
228
+ "pinId": "U1.10",
229
+ "x": 0.9,
230
+ "y": 0
231
+ },
232
+ {
233
+ "pinId": "U1.11",
234
+ "x": 0.9,
235
+ "y": 0.7999999999999998
236
+ },
237
+ {
238
+ "pinId": "U1.12",
239
+ "x": 0.9,
240
+ "y": -1.2
241
+ },
242
+ {
243
+ "pinId": "U1.13",
244
+ "x": 0.9,
245
+ "y": -1
246
+ },
247
+ {
248
+ "pinId": "U1.14",
249
+ "x": 0.9,
250
+ "y": -0.7999999999999999
251
+ },
252
+ {
253
+ "pinId": "U1.15",
254
+ "x": -0.9,
255
+ "y": 1
256
+ },
257
+ {
258
+ "pinId": "U1.16",
259
+ "x": -0.9,
260
+ "y": 1.2
261
+ },
262
+ {
263
+ "pinId": "U1.17",
264
+ "x": -0.9,
265
+ "y": 0.5999999999999999
266
+ },
267
+ {
268
+ "pinId": "U1.18",
269
+ "x": -0.9,
270
+ "y": -0.9999999999999998
271
+ },
272
+ {
273
+ "pinId": "U1.19",
274
+ "x": -0.9,
275
+ "y": -0.19999999999999996
276
+ },
277
+ {
278
+ "pinId": "U1.20",
279
+ "x": -0.9,
280
+ "y": 0.7999999999999999
281
+ },
282
+ {
283
+ "pinId": "U1.21",
284
+ "x": -0.9,
285
+ "y": -1.2
286
+ },
287
+ {
288
+ "pinId": "U1.22",
289
+ "x": 0.9,
290
+ "y": -0.5999999999999999
291
+ },
292
+ {
293
+ "pinId": "U1.23",
294
+ "x": 0.9,
295
+ "y": -0.3999999999999999
296
+ },
297
+ {
298
+ "pinId": "U1.25",
299
+ "x": -0.9,
300
+ "y": -0.5999999999999999
301
+ },
302
+ {
303
+ "pinId": "U1.26",
304
+ "x": -0.9,
305
+ "y": -0.3999999999999999
306
+ },
307
+ {
308
+ "pinId": "U1.27",
309
+ "x": -0.9,
310
+ "y": 0.19999999999999996
311
+ },
312
+ {
313
+ "pinId": "U1.28",
314
+ "x": -0.9,
315
+ "y": 0
316
+ }
317
+ ]
318
+ },
319
+ "schematic_component_1": {
320
+ "chipId": "schematic_component_1",
321
+ "center": {
322
+ "x": 2,
323
+ "y": 1
324
+ },
325
+ "width": 1.0402490999999996,
326
+ "height": 0.5476905999999993,
327
+ "pins": [
328
+ {
329
+ "pinId": "LED1.1",
330
+ "x": 1.4798754500000002,
331
+ "y": 1.0005122999999987
332
+ },
333
+ {
334
+ "pinId": "LED1.2",
335
+ "x": 2.52012455,
336
+ "y": 0.9994877000000013
337
+ }
338
+ ]
339
+ }
340
+ },
341
+ "mspConnectionPairs": [
342
+ {
343
+ "mspPairId": "LED1.2-U1.20",
344
+ "dcConnNetId": "connectivity_net0",
345
+ "globalConnNetId": "connectivity_net0",
346
+ "userNetId": ".LED1 > port.right to .U1 > .pin20",
347
+ "pins": [
348
+ {
349
+ "pinId": "LED1.2",
350
+ "x": 2.52012455,
351
+ "y": 0.9994877000000013,
352
+ "_facingDirection": "x+",
353
+ "chipId": "schematic_component_1"
354
+ },
355
+ {
356
+ "pinId": "U1.20",
357
+ "x": -0.9,
358
+ "y": 0.7999999999999999,
359
+ "_facingDirection": "x-",
360
+ "chipId": "schematic_component_0"
361
+ }
362
+ ]
363
+ }
364
+ ],
365
+ "dcConnMap": {
366
+ "netMap": {
367
+ "connectivity_net0": ["LED1.2", "U1.20"]
368
+ },
369
+ "idToNetMap": {
370
+ "LED1.2": "connectivity_net0",
371
+ "U1.20": "connectivity_net0"
372
+ }
373
+ },
374
+ "globalConnMap": {
375
+ "netMap": {
376
+ "connectivity_net0": ["LED1.2", "U1.20"]
377
+ },
378
+ "idToNetMap": {
379
+ "LED1.2": "connectivity_net0",
380
+ "U1.20": "connectivity_net0"
381
+ }
382
+ },
383
+ "guidelines": [
384
+ {
385
+ "orientation": "horizontal",
386
+ "y": 1
387
+ },
388
+ {
389
+ "orientation": "vertical",
390
+ "x": 1.189937725
391
+ }
392
+ ]
393
+ }
@@ -0,0 +1,182 @@
1
+ import type { InputProblem } from "lib/index"
2
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
3
+
4
+ const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: 0,
10
+ y: 0,
11
+ },
12
+ width: 1,
13
+ height: 5,
14
+ pins: [
15
+ {
16
+ pinId: "U1.1",
17
+ x: 0.9,
18
+ y: 1.2,
19
+ },
20
+ {
21
+ pinId: "U1.2",
22
+ x: 0.9,
23
+ y: 0.3999999999999999,
24
+ },
25
+ {
26
+ pinId: "U1.3",
27
+ x: 0.9,
28
+ y: 0.5999999999999999,
29
+ },
30
+ {
31
+ pinId: "U1.4",
32
+ x: -0.9,
33
+ y: 0.3999999999999999,
34
+ },
35
+ {
36
+ pinId: "U1.5",
37
+ x: 0.9,
38
+ y: 0.9999999999999998,
39
+ },
40
+ {
41
+ pinId: "U1.6",
42
+ x: 0.9,
43
+ y: -0.19999999999999996,
44
+ },
45
+ {
46
+ pinId: "U1.7",
47
+ x: -0.9,
48
+ y: -0.7999999999999998,
49
+ },
50
+ {
51
+ pinId: "U1.9",
52
+ x: 0.9,
53
+ y: 0.19999999999999996,
54
+ },
55
+ {
56
+ pinId: "U1.10",
57
+ x: 0.9,
58
+ y: 0,
59
+ },
60
+ {
61
+ pinId: "U1.11",
62
+ x: 0.9,
63
+ y: 0.7999999999999998,
64
+ },
65
+ {
66
+ pinId: "U1.12",
67
+ x: 0.9,
68
+ y: -1.2,
69
+ },
70
+ {
71
+ pinId: "U1.13",
72
+ x: 0.9,
73
+ y: -1,
74
+ },
75
+ {
76
+ pinId: "U1.14",
77
+ x: 0.9,
78
+ y: -0.7999999999999999,
79
+ },
80
+ {
81
+ pinId: "U1.15",
82
+ x: -0.9,
83
+ y: 1,
84
+ },
85
+ {
86
+ pinId: "U1.16",
87
+ x: -0.9,
88
+ y: 1.2,
89
+ },
90
+ {
91
+ pinId: "U1.17",
92
+ x: -0.9,
93
+ y: 0.5999999999999999,
94
+ },
95
+ {
96
+ pinId: "U1.18",
97
+ x: -0.9,
98
+ y: -0.9999999999999998,
99
+ },
100
+ {
101
+ pinId: "U1.19",
102
+ x: -0.9,
103
+ y: -0.19999999999999996,
104
+ },
105
+ {
106
+ pinId: "U1.20",
107
+ x: -0.9,
108
+ y: 0.7999999999999999,
109
+ },
110
+ {
111
+ pinId: "U1.21",
112
+ x: -0.9,
113
+ y: -1.2,
114
+ },
115
+ {
116
+ pinId: "U1.22",
117
+ x: 0.9,
118
+ y: -0.5999999999999999,
119
+ },
120
+ {
121
+ pinId: "U1.23",
122
+ x: 0.9,
123
+ y: -0.3999999999999999,
124
+ },
125
+ {
126
+ pinId: "U1.25",
127
+ x: -0.9,
128
+ y: -0.5999999999999999,
129
+ },
130
+ {
131
+ pinId: "U1.26",
132
+ x: -0.9,
133
+ y: -0.3999999999999999,
134
+ },
135
+ {
136
+ pinId: "U1.27",
137
+ x: -0.9,
138
+ y: 0.19999999999999996,
139
+ },
140
+ {
141
+ pinId: "U1.28",
142
+ x: -0.9,
143
+ y: 0,
144
+ },
145
+ ],
146
+ },
147
+ {
148
+ chipId: "schematic_component_1",
149
+ center: {
150
+ x: 2,
151
+ y: 1,
152
+ },
153
+ width: 1.0402490999999996,
154
+ height: 0.5476905999999993,
155
+ pins: [
156
+ {
157
+ pinId: "LED1.1",
158
+ x: 1.4808529,
159
+ y: 1.0005122999999987,
160
+ },
161
+ {
162
+ pinId: "LED1.2",
163
+ x: 2.5191471,
164
+ y: 0.9994877000000013,
165
+ },
166
+ ],
167
+ },
168
+ ],
169
+ directConnections: [
170
+ {
171
+ pinIds: ["LED1.2", "U1.20"],
172
+ netId: ".LED1 > port.right to .U1 > .pin20",
173
+ },
174
+ ],
175
+ netConnections: [],
176
+ availableNetLabelOrientations: {},
177
+ maxMspPairDistance: 2,
178
+ }
179
+
180
+ export default function Example05Page() {
181
+ return <PipelineDebugger inputProblem={inputProblem} />
182
+ }
@@ -0,0 +1,111 @@
1
+ import type { InputProblem } from "lib/types/InputProblem"
2
+ import { test, expect } from "bun:test"
3
+ import { SchematicTracePipelineSolver } from "lib/index"
4
+
5
+ const inputProblem: InputProblem = {
6
+ chips: [
7
+ {
8
+ chipId: "U1",
9
+ center: { x: 0, y: 0 },
10
+ width: 1.6,
11
+ height: 0.6,
12
+ pins: [
13
+ {
14
+ pinId: "U1.1",
15
+ x: -0.8,
16
+ y: 0.2,
17
+ },
18
+ {
19
+ pinId: "U1.2",
20
+ x: -0.8,
21
+ y: 0,
22
+ },
23
+ {
24
+ pinId: "U1.3",
25
+ x: -0.8,
26
+ y: -0.2,
27
+ },
28
+ {
29
+ pinId: "U1.4",
30
+ x: 0.8,
31
+ y: -0.2,
32
+ },
33
+ {
34
+ pinId: "U1.5",
35
+ x: 0.8,
36
+ y: 0,
37
+ },
38
+ {
39
+ pinId: "U1.6",
40
+ x: 0.8,
41
+ y: 0.2,
42
+ },
43
+ ],
44
+ },
45
+ {
46
+ chipId: "C1",
47
+ center: { x: -2, y: 0 },
48
+ width: 0.5,
49
+ height: 1,
50
+ pins: [
51
+ {
52
+ pinId: "C1.1",
53
+ x: -2,
54
+ y: 0.5,
55
+ },
56
+ {
57
+ pinId: "C1.2",
58
+ x: -2,
59
+ y: -0.5,
60
+ },
61
+ ],
62
+ },
63
+ {
64
+ chipId: "C2",
65
+ center: { x: -4, y: 0 },
66
+ width: 0.5,
67
+ height: 1,
68
+ pins: [
69
+ {
70
+ pinId: "C2.1",
71
+ x: -4,
72
+ y: 0.5,
73
+ },
74
+ {
75
+ pinId: "C2.2",
76
+ x: -4,
77
+ y: -0.5,
78
+ },
79
+ ],
80
+ },
81
+ ],
82
+ directConnections: [
83
+ {
84
+ pinIds: ["U1.1", "C1.1"],
85
+ netId: "VCC",
86
+ },
87
+ {
88
+ pinIds: ["U1.2", "C2.1"],
89
+ netId: "EN",
90
+ },
91
+ ],
92
+ netConnections: [
93
+ {
94
+ pinIds: ["U1.3", "C2.2", "C1.2"],
95
+ netId: "GND",
96
+ },
97
+ ],
98
+ availableNetLabelOrientations: {
99
+ VCC: ["y+"],
100
+ EN: ["x+", "x-"],
101
+ GND: ["y-"],
102
+ },
103
+ maxMspPairDistance: 2,
104
+ }
105
+
106
+ test("SchematicTracePipelineSolver_repro01", () => {
107
+ const solver = new SchematicTracePipelineSolver(inputProblem)
108
+ solver.solve()
109
+
110
+ // console.log(solver.schematicTraceLinesSolver!.solvedTracePaths)
111
+ })