@tscircuit/core 0.0.1202 → 0.0.1203
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 +12 -61
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2599,53 +2599,6 @@ var getObstaclesFromRoute = (route, source_trace_id, { viaDiameter = 0.5 } = {})
|
|
|
2599
2599
|
return obstacles;
|
|
2600
2600
|
};
|
|
2601
2601
|
|
|
2602
|
-
// lib/utils/obstacles/generateApproximatingRects.ts
|
|
2603
|
-
function generateApproximatingRects(rotatedRect, numRects = 2) {
|
|
2604
|
-
const { center, width, height, rotation: rotation4 } = rotatedRect;
|
|
2605
|
-
const rects = [];
|
|
2606
|
-
const angleRad = rotation4 * Math.PI / 180;
|
|
2607
|
-
const cosAngle = Math.cos(angleRad);
|
|
2608
|
-
const sinAngle = Math.sin(angleRad);
|
|
2609
|
-
const normalizedRotation = (rotation4 % 360 + 360) % 360;
|
|
2610
|
-
const sliceAlongWidth = height <= width ? normalizedRotation >= 45 && normalizedRotation < 135 || normalizedRotation >= 225 && normalizedRotation < 315 : normalizedRotation >= 135 && normalizedRotation < 225 || normalizedRotation >= 315 || normalizedRotation < 45;
|
|
2611
|
-
if (sliceAlongWidth) {
|
|
2612
|
-
const sliceWidth = width / numRects;
|
|
2613
|
-
for (let i = 0; i < numRects; i++) {
|
|
2614
|
-
const x = (i - numRects / 2 + 0.5) * sliceWidth;
|
|
2615
|
-
const rotatedX = -x * cosAngle;
|
|
2616
|
-
const rotatedY = -x * sinAngle;
|
|
2617
|
-
const coverageWidth = sliceWidth * 1.1;
|
|
2618
|
-
const coverageHeight = Math.abs(height * cosAngle) + Math.abs(sliceWidth * sinAngle);
|
|
2619
|
-
rects.push({
|
|
2620
|
-
center: {
|
|
2621
|
-
x: center.x + rotatedX,
|
|
2622
|
-
y: center.y + rotatedY
|
|
2623
|
-
},
|
|
2624
|
-
width: coverageWidth,
|
|
2625
|
-
height: coverageHeight
|
|
2626
|
-
});
|
|
2627
|
-
}
|
|
2628
|
-
} else {
|
|
2629
|
-
const sliceHeight = height / numRects;
|
|
2630
|
-
for (let i = 0; i < numRects; i++) {
|
|
2631
|
-
const y = (i - numRects / 2 + 0.5) * sliceHeight;
|
|
2632
|
-
const rotatedX = -y * sinAngle;
|
|
2633
|
-
const rotatedY = y * cosAngle;
|
|
2634
|
-
const coverageWidth = Math.abs(width * cosAngle) + Math.abs(sliceHeight * sinAngle);
|
|
2635
|
-
const coverageHeight = sliceHeight * 1.1;
|
|
2636
|
-
rects.push({
|
|
2637
|
-
center: {
|
|
2638
|
-
x: center.x + rotatedX,
|
|
2639
|
-
y: center.y + rotatedY
|
|
2640
|
-
},
|
|
2641
|
-
width: coverageWidth,
|
|
2642
|
-
height: coverageHeight
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
return rects;
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
2602
|
// lib/utils/obstacles/fillPolygonWithRects.ts
|
|
2650
2603
|
function fillPolygonWithRects(polygon, options = {}) {
|
|
2651
2604
|
if (polygon.length < 3) return [];
|
|
@@ -2772,18 +2725,16 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
2772
2725
|
rotation: element.ccw_rotation
|
|
2773
2726
|
};
|
|
2774
2727
|
const singleRect = getAxisAlignedRectFromRotatedRect(rotatedRect);
|
|
2775
|
-
const
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
});
|
|
2786
|
-
}
|
|
2728
|
+
const rect = singleRect ?? rotatedRect;
|
|
2729
|
+
obstacles.push({
|
|
2730
|
+
type: "rect",
|
|
2731
|
+
layers: [element.layer],
|
|
2732
|
+
center: rect.center,
|
|
2733
|
+
width: rect.width,
|
|
2734
|
+
height: rect.height,
|
|
2735
|
+
ccwRotationDegrees: element.ccw_rotation,
|
|
2736
|
+
connectedTo: withNetId([element.pcb_smtpad_id])
|
|
2737
|
+
});
|
|
2787
2738
|
} else if (element.shape === "pill" || element.shape === "rotated_pill") {
|
|
2788
2739
|
obstacles.push({
|
|
2789
2740
|
type: "rect",
|
|
@@ -20123,7 +20074,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20123
20074
|
var package_default = {
|
|
20124
20075
|
name: "@tscircuit/core",
|
|
20125
20076
|
type: "module",
|
|
20126
|
-
version: "0.0.
|
|
20077
|
+
version: "0.0.1202",
|
|
20127
20078
|
types: "dist/index.d.ts",
|
|
20128
20079
|
main: "dist/index.js",
|
|
20129
20080
|
module: "dist/index.js",
|
|
@@ -20155,7 +20106,7 @@ var package_default = {
|
|
|
20155
20106
|
"@biomejs/biome": "^1.8.3",
|
|
20156
20107
|
"@resvg/resvg-js": "^2.6.2",
|
|
20157
20108
|
"@tscircuit/alphabet": "0.0.25",
|
|
20158
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
20109
|
+
"@tscircuit/capacity-autorouter": "^0.0.475",
|
|
20159
20110
|
"@tscircuit/checks": "0.0.125",
|
|
20160
20111
|
"@tscircuit/circuit-json-util": "^0.0.94",
|
|
20161
20112
|
"@tscircuit/common": "^0.0.20",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1203",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@biomejs/biome": "^1.8.3",
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
35
|
"@tscircuit/alphabet": "0.0.25",
|
|
36
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
36
|
+
"@tscircuit/capacity-autorouter": "^0.0.475",
|
|
37
37
|
"@tscircuit/checks": "0.0.125",
|
|
38
38
|
"@tscircuit/circuit-json-util": "^0.0.94",
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|