@tscircuit/schematic-trace-solver 0.0.86 → 0.0.87

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
@@ -5777,6 +5777,57 @@ var getPointDistanceFromRect = (point, rect) => {
5777
5777
  return dx + dy;
5778
5778
  };
5779
5779
 
5780
+ // lib/solvers/Example28Solver/countCrossingsWithOtherTraces.ts
5781
+ var countCrossingsWithOtherTraces = (params) => {
5782
+ const { trace, outputTraces } = params;
5783
+ let crossingCount = 0;
5784
+ for (const otherTrace of outputTraces) {
5785
+ if (otherTrace.mspPairId === trace.mspPairId) continue;
5786
+ if (otherTrace.globalConnNetId === trace.globalConnNetId) continue;
5787
+ crossingCount += countPathIntersections(
5788
+ trace.tracePath,
5789
+ otherTrace.tracePath
5790
+ );
5791
+ }
5792
+ return crossingCount;
5793
+ };
5794
+
5795
+ // lib/solvers/Example28Solver/doesPathRunAlongChipBoundary.ts
5796
+ var doesPathRunAlongChipBoundary = (path, chipObstacles) => {
5797
+ for (let i = 0; i < path.length - 1; i++) {
5798
+ const start = path[i];
5799
+ const end = path[i + 1];
5800
+ for (const obstacle of chipObstacles) {
5801
+ if (!segmentRunsAlongRectBoundary(start, end, obstacle)) continue;
5802
+ if (getSegmentOverlapWithRectSpan(start, end, obstacle) > EPS7) {
5803
+ return true;
5804
+ }
5805
+ }
5806
+ }
5807
+ return false;
5808
+ };
5809
+ var getSegmentOverlapWithRectSpan = (start, end, rect) => {
5810
+ const isVertical4 = Math.abs(start.x - end.x) < EPS7;
5811
+ if (isVertical4) {
5812
+ return Math.min(Math.max(start.y, end.y), rect.maxY) - Math.max(Math.min(start.y, end.y), rect.minY);
5813
+ }
5814
+ return Math.min(Math.max(start.x, end.x), rect.maxX) - Math.max(Math.min(start.x, end.x), rect.minX);
5815
+ };
5816
+
5817
+ // lib/solvers/Example28Solver/scoreSolutionTracePath.ts
5818
+ var scoreSolutionTracePath = (params) => {
5819
+ const { traces, outputTraces, chipObstacles } = params;
5820
+ let chipEdgeRuns = 0;
5821
+ let traceCrossings = 0;
5822
+ for (const trace of traces) {
5823
+ if (doesPathRunAlongChipBoundary(trace.tracePath, chipObstacles)) {
5824
+ chipEdgeRuns += 1;
5825
+ }
5826
+ traceCrossings += countCrossingsWithOtherTraces({ trace, outputTraces });
5827
+ }
5828
+ return { chipEdgeRuns, traceCrossings };
5829
+ };
5830
+
5780
5831
  // lib/solvers/Example28Solver/visualize.ts
5781
5832
  var CANDIDATE_SELECTED_COLOR = "blue";
5782
5833
  var CANDIDATE_REJECTED_COLOR = "red";
@@ -5849,6 +5900,13 @@ ${label.netId ?? label.globalConnNetId}`
5849
5900
  var LABEL_OUTWARD_STEP = 0.1;
5850
5901
  var LABEL_MAX_OUTWARD_STEPS = 10;
5851
5902
  var LABEL_TRACE_CLEARANCE = 0.1;
5903
+ var isScoreBetter = (rerouteScore, labelMoveScore) => {
5904
+ if (!rerouteScore) return false;
5905
+ if (rerouteScore.chipEdgeRuns !== labelMoveScore.chipEdgeRuns) {
5906
+ return rerouteScore.chipEdgeRuns < labelMoveScore.chipEdgeRuns;
5907
+ }
5908
+ return rerouteScore.traceCrossings < labelMoveScore.traceCrossings;
5909
+ };
5852
5910
  var Example28Solver = class extends BaseSolver {
5853
5911
  inputProblem;
5854
5912
  traces;
@@ -5951,7 +6009,7 @@ var Example28Solver = class extends BaseSolver {
5951
6009
  );
5952
6010
  if (traceIndex === -1) return;
5953
6011
  const currentTrace = this.outputTraces[traceIndex];
5954
- if (this.tryMoveLabelOutward(overlap.label)) return;
6012
+ const labelMove = this.tryMoveLabelOutward(overlap.label);
5955
6013
  const rerouteResult = findBestReroutePath({
5956
6014
  trace: currentTrace,
5957
6015
  obstacleLabel: overlap.label,
@@ -5961,6 +6019,26 @@ var Example28Solver = class extends BaseSolver {
5961
6019
  chipObstacles: this.chipObstacles
5962
6020
  });
5963
6021
  this.currentCandidateResults = rerouteResult.candidateResults;
6022
+ let rerouteScore = null;
6023
+ if (rerouteResult.bestPath) {
6024
+ rerouteScore = scoreSolutionTracePath({
6025
+ traces: [{ ...currentTrace, tracePath: rerouteResult.bestPath }],
6026
+ outputTraces: this.outputTraces,
6027
+ chipObstacles: this.chipObstacles
6028
+ });
6029
+ }
6030
+ if (labelMove) {
6031
+ const labelMoveScore = scoreSolutionTracePath({
6032
+ traces: [labelMove.connectorTrace, currentTrace],
6033
+ outputTraces: this.outputTraces,
6034
+ chipObstacles: this.chipObstacles
6035
+ });
6036
+ if (!isScoreBetter(rerouteScore, labelMoveScore)) {
6037
+ this.outputNetLabelPlacements[labelMove.labelIndex] = labelMove.movedLabel;
6038
+ this.outputTraces.push(labelMove.connectorTrace);
6039
+ return;
6040
+ }
6041
+ }
5964
6042
  if (!rerouteResult.bestPath) return;
5965
6043
  const originalTracePath = currentTrace.tracePath;
5966
6044
  this.outputTraces[traceIndex] = {
@@ -5978,17 +6056,17 @@ var Example28Solver = class extends BaseSolver {
5978
6056
  const labelIndex = this.outputNetLabelPlacements.findIndex(
5979
6057
  (label2) => label2.globalConnNetId === labelToMove.globalConnNetId && label2.anchorPoint.x === labelToMove.anchorPoint.x && label2.anchorPoint.y === labelToMove.anchorPoint.y && label2.pinIds.join(",") === labelToMove.pinIds.join(",")
5980
6058
  );
5981
- if (labelIndex === -1) return false;
6059
+ if (labelIndex === -1) return null;
5982
6060
  const label = this.outputNetLabelPlacements[labelIndex];
5983
- if (label.mspConnectionPairIds.length > 0) return false;
5984
- if (label.pinIds.length !== 1) return false;
6061
+ if (label.mspConnectionPairIds.length > 0) return null;
6062
+ if (label.pinIds.length !== 1) return null;
5985
6063
  if (this.outputNetLabelPlacements.filter(
5986
6064
  (otherLabel) => otherLabel.globalConnNetId === label.globalConnNetId
5987
6065
  ).length !== 1) {
5988
- return false;
6066
+ return null;
5989
6067
  }
5990
6068
  const outward = dir(label.orientation);
5991
- if (outward.x === 0 && outward.y === 0) return false;
6069
+ if (outward.x === 0 && outward.y === 0) return null;
5992
6070
  for (let step = 1; step <= LABEL_MAX_OUTWARD_STEPS; step++) {
5993
6071
  const distance3 = step * LABEL_OUTWARD_STEP;
5994
6072
  const candidate = {
@@ -6024,11 +6102,9 @@ var Example28Solver = class extends BaseSolver {
6024
6102
  }).length > 0) {
6025
6103
  continue;
6026
6104
  }
6027
- this.outputNetLabelPlacements[labelIndex] = candidate;
6028
- this.outputTraces.push(connectorTrace);
6029
- return true;
6105
+ return { labelIndex, movedLabel: candidate, connectorTrace };
6030
6106
  }
6031
- return false;
6107
+ return null;
6032
6108
  }
6033
6109
  visualize() {
6034
6110
  return visualizeExample28Solver({
@@ -20,6 +20,10 @@ import type {
20
20
  import { dir } from "lib/utils/dir"
21
21
  import { moveAttachedLabelsToReroutedTrace } from "./labelMovement"
22
22
  import { findBestReroutePath } from "./reroute"
23
+ import {
24
+ scoreSolutionTracePath,
25
+ type TracePathScore,
26
+ } from "./scoreSolutionTracePath"
23
27
  import type { Example28SolverParams, RerouteCandidateResult } from "./types"
24
28
  import { visualizeExample28Solver } from "./visualize"
25
29
 
@@ -27,6 +31,17 @@ const LABEL_OUTWARD_STEP = 0.1
27
31
  const LABEL_MAX_OUTWARD_STEPS = 10
28
32
  const LABEL_TRACE_CLEARANCE = 0.1
29
33
 
34
+ const isScoreBetter = (
35
+ rerouteScore: TracePathScore | null,
36
+ labelMoveScore: TracePathScore,
37
+ ) => {
38
+ if (!rerouteScore) return false
39
+ if (rerouteScore.chipEdgeRuns !== labelMoveScore.chipEdgeRuns) {
40
+ return rerouteScore.chipEdgeRuns < labelMoveScore.chipEdgeRuns
41
+ }
42
+ return rerouteScore.traceCrossings < labelMoveScore.traceCrossings
43
+ }
44
+
30
45
  export class Example28Solver extends BaseSolver {
31
46
  inputProblem: InputProblem
32
47
  traces: SolvedTracePath[]
@@ -160,7 +175,7 @@ export class Example28Solver extends BaseSolver {
160
175
  if (traceIndex === -1) return
161
176
 
162
177
  const currentTrace = this.outputTraces[traceIndex]!
163
- if (this.tryMoveLabelOutward(overlap.label)) return
178
+ const labelMove = this.tryMoveLabelOutward(overlap.label)
164
179
 
165
180
  const rerouteResult = findBestReroutePath({
166
181
  trace: currentTrace,
@@ -172,6 +187,29 @@ export class Example28Solver extends BaseSolver {
172
187
  })
173
188
  this.currentCandidateResults = rerouteResult.candidateResults
174
189
 
190
+ let rerouteScore: TracePathScore | null = null
191
+ if (rerouteResult.bestPath) {
192
+ rerouteScore = scoreSolutionTracePath({
193
+ traces: [{ ...currentTrace, tracePath: rerouteResult.bestPath }],
194
+ outputTraces: this.outputTraces,
195
+ chipObstacles: this.chipObstacles,
196
+ })
197
+ }
198
+
199
+ if (labelMove) {
200
+ const labelMoveScore = scoreSolutionTracePath({
201
+ traces: [labelMove.connectorTrace, currentTrace],
202
+ outputTraces: this.outputTraces,
203
+ chipObstacles: this.chipObstacles,
204
+ })
205
+ if (!isScoreBetter(rerouteScore, labelMoveScore)) {
206
+ this.outputNetLabelPlacements[labelMove.labelIndex] =
207
+ labelMove.movedLabel
208
+ this.outputTraces.push(labelMove.connectorTrace)
209
+ return
210
+ }
211
+ }
212
+
175
213
  if (!rerouteResult.bestPath) return
176
214
 
177
215
  const originalTracePath = currentTrace.tracePath
@@ -195,21 +233,21 @@ export class Example28Solver extends BaseSolver {
195
233
  label.anchorPoint.y === labelToMove.anchorPoint.y &&
196
234
  label.pinIds.join(",") === labelToMove.pinIds.join(","),
197
235
  )
198
- if (labelIndex === -1) return false
236
+ if (labelIndex === -1) return null
199
237
 
200
238
  const label = this.outputNetLabelPlacements[labelIndex]!
201
- if (label.mspConnectionPairIds.length > 0) return false
202
- if (label.pinIds.length !== 1) return false
239
+ if (label.mspConnectionPairIds.length > 0) return null
240
+ if (label.pinIds.length !== 1) return null
203
241
  if (
204
242
  this.outputNetLabelPlacements.filter(
205
243
  (otherLabel) => otherLabel.globalConnNetId === label.globalConnNetId,
206
244
  ).length !== 1
207
245
  ) {
208
- return false
246
+ return null
209
247
  }
210
248
 
211
249
  const outward = dir(label.orientation)
212
- if (outward.x === 0 && outward.y === 0) return false
250
+ if (outward.x === 0 && outward.y === 0) return null
213
251
 
214
252
  for (let step = 1; step <= LABEL_MAX_OUTWARD_STEPS; step++) {
215
253
  const distance = step * LABEL_OUTWARD_STEP
@@ -252,12 +290,10 @@ export class Example28Solver extends BaseSolver {
252
290
  continue
253
291
  }
254
292
 
255
- this.outputNetLabelPlacements[labelIndex] = candidate
256
- this.outputTraces.push(connectorTrace)
257
- return true
293
+ return { labelIndex, movedLabel: candidate, connectorTrace }
258
294
  }
259
295
 
260
- return false
296
+ return null
261
297
  }
262
298
 
263
299
  override visualize(): GraphicsObject {
@@ -0,0 +1,19 @@
1
+ import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
2
+ import { countPathIntersections } from "./geometry"
3
+
4
+ export const countCrossingsWithOtherTraces = (params: {
5
+ trace: SolvedTracePath
6
+ outputTraces: SolvedTracePath[]
7
+ }) => {
8
+ const { trace, outputTraces } = params
9
+ let crossingCount = 0
10
+ for (const otherTrace of outputTraces) {
11
+ if (otherTrace.mspPairId === trace.mspPairId) continue
12
+ if (otherTrace.globalConnNetId === trace.globalConnNetId) continue
13
+ crossingCount += countPathIntersections(
14
+ trace.tracePath,
15
+ otherTrace.tracePath,
16
+ )
17
+ }
18
+ return crossingCount
19
+ }
@@ -0,0 +1,26 @@
1
+ import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
2
+ import { countCrossingsWithOtherTraces } from "./countCrossingsWithOtherTraces"
3
+ import { doesPathRunAlongChipBoundary } from "./doesPathRunAlongChipBoundary"
4
+ import type { ChipObstacle } from "./types"
5
+
6
+ export type TracePathScore = {
7
+ chipEdgeRuns: number
8
+ traceCrossings: number
9
+ }
10
+
11
+ export const scoreSolutionTracePath = (params: {
12
+ traces: SolvedTracePath[]
13
+ outputTraces: SolvedTracePath[]
14
+ chipObstacles: ChipObstacle[]
15
+ }): TracePathScore => {
16
+ const { traces, outputTraces, chipObstacles } = params
17
+ let chipEdgeRuns = 0
18
+ let traceCrossings = 0
19
+ for (const trace of traces) {
20
+ if (doesPathRunAlongChipBoundary(trace.tracePath, chipObstacles)) {
21
+ chipEdgeRuns += 1
22
+ }
23
+ traceCrossings += countCrossingsWithOtherTraces({ trace, outputTraces })
24
+ }
25
+ return { chipEdgeRuns, traceCrossings }
26
+ }
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.86",
4
+ "version": "0.0.87",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",
@@ -2,139 +2,133 @@
2
2
  <rect width="100%" height="100%" fill="white" />
3
3
  <g>
4
4
  <circle data-type="point" data-label="R7.1
5
- x-" data-x="-1.95" data-y="-6.6" cx="122.2014128470511" cy="219.67471660916704" r="3" fill="hsl(232, 100%, 50%, 0.8)" />
5
+ x-" data-x="-1.95" data-y="-6.6" cx="126.46276136167273" cy="214.47382063245198" r="3" fill="hsl(232, 100%, 50%, 0.8)" />
6
6
  </g>
7
7
  <g>
8
8
  <circle data-type="point" data-label="R7.2
9
- x+" data-x="-0.8499999999999999" data-y="-6.6" cx="223.4006899950715" cy="219.67471660916704" r="3" fill="hsl(233, 100%, 50%, 0.8)" />
9
+ x+" data-x="-0.8499999999999999" data-y="-6.6" cx="232.90824261275273" cy="214.47382063245198" r="3" fill="hsl(233, 100%, 50%, 0.8)" />
10
10
  </g>
11
11
  <g>
12
12
  <circle data-type="point" data-label="U5.1
13
- x-" data-x="-1.5225" data-y="-8.1" cx="161.5311319204863" cy="357.6737309019221" r="3" fill="hsl(203, 100%, 50%, 0.8)" />
13
+ x-" data-x="-1.5225" data-y="-8.1" cx="167.83134612061517" cy="359.6267496111974" r="3" fill="hsl(203, 100%, 50%, 0.8)" />
14
14
  </g>
15
15
  <g>
16
16
  <circle data-type="point" data-label="U5.2
17
- x-" data-x="-1.5225" data-y="-8.3" cx="161.5311319204863" cy="376.0735994742896" r="3" fill="hsl(204, 100%, 50%, 0.8)" />
17
+ x-" data-x="-1.5225" data-y="-8.3" cx="167.83134612061517" cy="378.9804734750303" r="3" fill="hsl(204, 100%, 50%, 0.8)" />
18
18
  </g>
19
19
  <g>
20
20
  <circle data-type="point" data-label="U5.3
21
- x-" data-x="-1.5225" data-y="-8.5" cx="161.5311319204863" cy="394.4734680466569" r="3" fill="hsl(205, 100%, 50%, 0.8)" />
21
+ x-" data-x="-1.5225" data-y="-8.5" cx="167.83134612061517" cy="398.33419733886296" r="3" fill="hsl(205, 100%, 50%, 0.8)" />
22
22
  </g>
23
23
  <g>
24
24
  <circle data-type="point" data-label="U5.4
25
- x-" data-x="-1.5225" data-y="-8.700000000000001" cx="161.5311319204863" cy="412.87333661902426" r="3" fill="hsl(206, 100%, 50%, 0.8)" />
25
+ x-" data-x="-1.5225" data-y="-8.700000000000001" cx="167.83134612061517" cy="417.68792120269575" r="3" fill="hsl(206, 100%, 50%, 0.8)" />
26
26
  </g>
27
27
  <g>
28
28
  <circle data-type="point" data-label="U5.5
29
- x+" data-x="1.5225" data-y="-8.1" cx="441.66913093477905" cy="357.6737309019221" r="3" fill="hsl(207, 100%, 50%, 0.8)" />
29
+ x+" data-x="1.5225" data-y="-8.1" cx="462.4917919474684" cy="359.6267496111974" r="3" fill="hsl(207, 100%, 50%, 0.8)" />
30
30
  </g>
31
31
  <g>
32
32
  <circle data-type="point" data-label="U5.6
33
- x+" data-x="1.5225" data-y="-8.3" cx="441.66913093477905" cy="376.0735994742896" r="3" fill="hsl(208, 100%, 50%, 0.8)" />
33
+ x+" data-x="1.5225" data-y="-8.3" cx="462.4917919474684" cy="378.9804734750303" r="3" fill="hsl(208, 100%, 50%, 0.8)" />
34
34
  </g>
35
35
  <g>
36
36
  <circle data-type="point" data-label="U5.7
37
- x+" data-x="1.5225" data-y="-8.700000000000001" cx="441.66913093477905" cy="412.87333661902426" r="3" fill="hsl(209, 100%, 50%, 0.8)" />
37
+ x+" data-x="1.5225" data-y="-8.700000000000001" cx="462.4917919474684" cy="417.68792120269575" r="3" fill="hsl(209, 100%, 50%, 0.8)" />
38
38
  </g>
39
39
  <g>
40
40
  <circle data-type="point" data-label="U5.8
41
- x+" data-x="1.5225" data-y="-8.5" cx="441.66913093477905" cy="394.4734680466569" r="3" fill="hsl(210, 100%, 50%, 0.8)" />
41
+ x+" data-x="1.5225" data-y="-8.5" cx="462.4917919474684" cy="398.33419733886296" r="3" fill="hsl(210, 100%, 50%, 0.8)" />
42
42
  </g>
43
43
  <g>
44
44
  <circle data-type="point" data-label="anchorPoint
45
- orientation: y+" data-x="-2.15" data-y="-6.6" cx="103.80154427468375" cy="219.67471660916704" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
45
+ orientation: y+" data-x="-2.15" data-y="-6.6" cx="107.10903749784" cy="214.47382063245198" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
46
46
  </g>
47
47
  <g>
48
48
  <circle data-type="point" data-label="anchorPoint
49
- orientation: x+" data-x="-0.8499999999999999" data-y="-6.6" cx="223.4006899950715" cy="219.67471660916704" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
49
+ orientation: x+" data-x="-0.8499999999999999" data-y="-6.6" cx="232.90824261275273" cy="214.47382063245198" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
50
50
  </g>
51
51
  <g>
52
52
  <circle data-type="point" data-label="anchorPoint
53
- orientation: x-" data-x="-1.5225" data-y="-8.700000000000001" cx="161.5311319204863" cy="412.87333661902426" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
53
+ orientation: x-" data-x="-1.5225" data-y="-8.700000000000001" cx="167.83134612061517" cy="417.68792120269575" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
54
54
  </g>
55
55
  <g>
56
56
  <circle data-type="point" data-label="anchorPoint
57
- orientation: x-" data-x="-1.5225" data-y="-8.1" cx="161.5311319204863" cy="357.6737309019221" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
57
+ orientation: x-" data-x="-1.5225" data-y="-8.1" cx="167.83134612061517" cy="359.6267496111974" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
58
58
  </g>
59
59
  <g>
60
60
  <circle data-type="point" data-label="anchorPoint
61
- orientation: x-" data-x="-1.5225" data-y="-8.3" cx="161.5311319204863" cy="376.0735994742896" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
61
+ orientation: x-" data-x="-1.5225" data-y="-8.3" cx="167.83134612061517" cy="378.9804734750303" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
62
62
  </g>
63
63
  <g>
64
64
  <circle data-type="point" data-label="anchorPoint
65
- orientation: x-" data-x="-1.5225" data-y="-8.5" cx="161.5311319204863" cy="394.4734680466569" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
65
+ orientation: x-" data-x="-1.5225" data-y="-8.5" cx="167.83134612061517" cy="398.33419733886296" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
66
66
  </g>
67
67
  <g>
68
68
  <circle data-type="point" data-label="anchorPoint
69
- orientation: x+" data-x="1.8225" data-y="-8.1" cx="469.2689337933301" cy="357.6737309019221" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
69
+ orientation: x+" data-x="1.5225" data-y="-8.1" cx="462.4917919474684" cy="359.6267496111974" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
70
70
  </g>
71
71
  <g>
72
72
  <circle data-type="point" data-label="anchorPoint
73
- orientation: x+" data-x="1.9224999999999999" data-y="-8.3" cx="478.46886807951375" cy="376.0735994742896" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
73
+ orientation: x+" data-x="1.5225" data-y="-8.3" cx="462.4917919474684" cy="378.9804734750303" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
74
74
  </g>
75
75
  <g>
76
76
  <circle data-type="point" data-label="anchorPoint
77
- orientation: y-" data-x="1.6235" data-y="-8.901" cx="450.9610645638246" cy="431.3652045342533" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
77
+ orientation: y-" data-x="1.6235" data-y="-8.901" cx="472.26542249870397" cy="437.1384136858476" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
78
78
  </g>
79
79
  <g>
80
- <polyline data-points="-1.95,-6.6 1.5225,-8.5" data-type="line" data-label="" points="122.2014128470511,219.67471660916704 441.66913093477905,394.4734680466569" fill="none" stroke="hsl(154, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
80
+ <polyline data-points="-1.95,-6.6 1.5225,-8.5" data-type="line" data-label="" points="126.46276136167273,214.47382063245198 462.4917919474684,398.33419733886296" fill="none" stroke="hsl(154, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
81
81
  </g>
82
82
  <g>
83
- <polyline data-points="-0.8499999999999999,-6.6 -1.5225,-8.700000000000001" data-type="line" data-label="" points="223.4006899950715,219.67471660916704 161.5311319204863,412.87333661902426" fill="none" stroke="hsl(172, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
83
+ <polyline data-points="-0.8499999999999999,-6.6 -1.5225,-8.700000000000001" data-type="line" data-label="" points="232.90824261275273,214.47382063245198 167.83134612061517,417.68792120269575" fill="none" stroke="hsl(172, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
84
84
  </g>
85
85
  <g>
86
- <polyline data-points="-1.95,-6.6 -2.15,-6.6 -2.15,-7.55 1.7225000000000004,-7.55 1.7225000000000004,-8.5 1.5225000000000002,-8.5" data-type="line" data-label="" points="122.2014128470511,219.67471660916704 103.80154427468375,219.67471660916704 103.80154427468375,307.0740923279119 460.06899950714643,307.0740923279119 460.06899950714643,394.4734680466569 441.6691309347791,394.4734680466569" fill="none" stroke="purple" stroke-width="1" />
86
+ <polyline data-points="-1.95,-6.6 -2.15,-6.6 -2.15,-7.55 2.9435000000000002,-7.55 2.9435000000000002,-8.5 1.5225000000000002,-8.5" data-type="line" data-label="" points="126.46276136167273,214.47382063245198 107.10903749784,214.47382063245198 107.10903749784,306.40400898565747 600,306.40400898565747 600,398.33419733886296 462.4917919474684,398.33419733886296" fill="none" stroke="purple" stroke-width="1" />
87
87
  </g>
88
88
  <g>
89
- <polyline data-points="1.5225,-8.1 1.8225,-8.1" data-type="line" data-label="" points="441.66913093477905,357.6737309019221 469.2689337933301,357.6737309019221" fill="none" stroke="purple" stroke-width="1" />
89
+ <polyline data-points="1.5225,-8.700000000000001 1.6235,-8.700000000000001 1.6235,-8.901" data-type="line" data-label="" points="462.4917919474684,417.68792120269575 472.26542249870397,417.68792120269575 472.26542249870397,437.1384136858476" fill="none" stroke="purple" stroke-width="1" />
90
90
  </g>
91
91
  <g>
92
- <polyline data-points="1.5225,-8.3 1.9224999999999999,-8.3" data-type="line" data-label="" points="441.66913093477905,376.0735994742896 478.46886807951375,376.0735994742896" fill="none" stroke="purple" stroke-width="1" />
92
+ <rect data-type="rect" data-label="schematic_component_0" data-x="-1.4" data-y="-6.6" x="126.46276136167273" y="176.78676412649043" width="106.44548125108" height="75.37411301192321" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.010333928571428572" />
93
93
  </g>
94
94
  <g>
95
- <polyline data-points="1.5225,-8.700000000000001 1.6235,-8.700000000000001 1.6235,-8.901" data-type="line" data-label="" points="441.66913093477905,412.87333661902426 450.9610645638246,412.87333661902426 450.9610645638246,431.3652045342533" fill="none" stroke="purple" stroke-width="1" />
96
- </g>
97
- <g>
98
- <rect data-type="rect" data-label="schematic_component_0" data-x="-1.4" data-y="-6.6" x="122.2014128470511" y="183.84508033514044" width="101.1992771480204" height="71.6592725480532" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.010869642857142855" />
99
- </g>
100
- <g>
101
- <rect data-type="rect" data-label="schematic_component_1" data-x="0" data-y="-8.4" x="161.5311319204863" y="339.27386232955485" width="280.13799901429275" height="91.99934286183668" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.010869642857142855" />
95
+ <rect data-type="rect" data-label="schematic_component_1" data-x="0" data-y="-8.4" x="167.83134612061517" y="340.27302574736484" width="294.6604458268532" height="96.76861931916358" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.010333928571428572" />
102
96
  </g>
103
97
  <g>
104
98
  <rect data-type="rect" data-label="netId: V3V3
105
- globalConnNetId: connectivity_net0" data-x="-2.15" data-y="-6.3" x="94.60160998850009" y="164.47511089206512" width="18.399868572367353" height="55.19960571710192" fill="#ef444466" stroke="#ef4444" stroke-width="0.010869642857142855" />
99
+ globalConnNetId: connectivity_net0" data-x="-2.15" data-y="-6.3" x="97.43217556592361" y="156.41264904095385" width="19.353723863832755" height="58.06117159149812" fill="#ef444466" stroke="#ef4444" stroke-width="0.010333928571428572" />
106
100
  </g>
107
101
  <g>
108
102
  <rect data-type="rect" data-label="netId: QSPI_CS
109
- globalConnNetId: connectivity_net1" data-x="-0.3689999999999999" data-y="-6.6" x="223.4926893379333" y="210.4747823229834" width="88.31936914736326" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
103
+ globalConnNetId: connectivity_net1" data-x="-0.3689999999999999" data-y="-6.6" x="233.0050112320719" y="204.7969587005357" width="92.8978745463971" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
110
104
  </g>
111
105
  <g>
112
106
  <rect data-type="rect" data-label="netId: QSPI_CS
113
- globalConnNetId: connectivity_net1" data-x="-2.0035" data-y="-8.700000000000001" x="73.11976343026123" y="403.6734023328406" width="88.31936914736323" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
107
+ globalConnNetId: connectivity_net1" data-x="-2.0035" data-y="-8.700000000000001" x="74.83670295489893" y="408.01105927077947" width="92.8978745463971" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
114
108
  </g>
115
109
  <g>
116
110
  <rect data-type="rect" data-label="netId: QSPI_SCK
117
- globalConnNetId: connectivity_net2" data-x="-2.0635" data-y="-8.1" x="62.0798422868408" y="348.4737966157385" width="99.35929029078366" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
111
+ globalConnNetId: connectivity_net2" data-x="-2.0635" data-y="-8.1" x="63.22446863659928" y="349.9498876792811" width="104.51010886469675" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
118
112
  </g>
119
113
  <g>
120
114
  <rect data-type="rect" data-label="netId: QSPI_DATA0
121
- globalConnNetId: connectivity_net3" data-x="-2.1835" data-y="-8.3" x="40" y="366.873665188106" width="121.43913257762446" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
115
+ globalConnNetId: connectivity_net3" data-x="-2.1835" data-y="-8.3" x="40" y="369.3036115431139" width="127.73457750129603" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
122
116
  </g>
123
117
  <g>
124
118
  <rect data-type="rect" data-label="netId: QSPI_DATA1
125
- globalConnNetId: connectivity_net4" data-x="-2.1835" data-y="-8.5" x="40" y="385.27353376047324" width="121.43913257762446" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
119
+ globalConnNetId: connectivity_net4" data-x="-2.1835" data-y="-8.5" x="40" y="388.6573354069466" width="127.73457750129603" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
126
120
  </g>
127
121
  <g>
128
122
  <rect data-type="rect" data-label="netId: QSPI_DATA2
129
- globalConnNetId: connectivity_net5" data-x="2.4835000000000003" data-y="-8.1" x="469.36093313619193" y="348.4737966157385" width="121.43913257762443" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
123
+ globalConnNetId: connectivity_net5" data-x="2.1835" data-y="-8.1" x="462.5885605667876" y="349.9498876792811" width="127.73457750129603" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
130
124
  </g>
131
125
  <g>
132
126
  <rect data-type="rect" data-label="netId: QSPI_DATA3
133
- globalConnNetId: connectivity_net6" data-x="2.5835" data-y="-8.3" x="478.56086742237557" y="366.873665188106" width="121.43913257762443" height="18.399868572367268" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010869642857142855" />
127
+ globalConnNetId: connectivity_net6" data-x="2.1835" data-y="-8.3" x="462.5885605667876" y="369.3036115431139" width="127.73457750129603" height="19.35372386383267" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.010333928571428572" />
134
128
  </g>
135
129
  <g>
136
130
  <rect data-type="rect" data-label="netId: GND
137
- globalConnNetId: connectivity_net7" data-x="1.6235" data-y="-9.141" x="441.76113027764086" y="431.3652045342533" width="18.39986857236738" height="44.159684573681716" fill="#00000066" stroke="#000000" stroke-width="0.010869642857142855" />
131
+ globalConnNetId: connectivity_net7" data-x="1.6235" data-y="-9.141" x="462.5885605667876" y="437.1384136858476" width="19.353723863832784" height="46.44893727319857" fill="#00000066" stroke="#000000" stroke-width="0.010333928571428572" />
138
132
  </g>
139
133
  <g id="crosshair" style="display: none">
140
134
  <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
@@ -164,12 +158,12 @@ globalConnNetId: connectivity_net7" data-x="1.6235" data-y="-9.141" x="441.76113
164
158
 
165
159
  // Calculate real coordinates using inverse transformation
166
160
  const matrix = {
167
- "a": 91.99934286183671,
161
+ "a": 96.76861931916363,
168
162
  "c": 0,
169
- "e": 301.6001314276327,
163
+ "e": 315.1615690340418,
170
164
  "b": 0,
171
- "d": -91.99934286183671,
172
- "f": -387.5209462789552
165
+ "d": -96.76861931916363,
166
+ "f": -424.19906687402795
173
167
  };
174
168
  // Manually invert and apply the affine transform
175
169
  // Since we only use translate and scale, we can directly compute: