@tscircuit/core 0.0.2162 → 0.0.2163
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 +19 -75
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3666,53 +3666,6 @@ function fillPolygonWithRects(polygon, options = {}) {
|
|
|
3666
3666
|
return rects;
|
|
3667
3667
|
}
|
|
3668
3668
|
|
|
3669
|
-
// lib/utils/obstacles/generateApproximatingRects.ts
|
|
3670
|
-
function generateApproximatingRects(rotatedRect, numRects = 2) {
|
|
3671
|
-
const { center, width, height, rotation: rotation5 } = rotatedRect;
|
|
3672
|
-
const rects = [];
|
|
3673
|
-
const angleRad = rotation5 * Math.PI / 180;
|
|
3674
|
-
const cosAngle = Math.cos(angleRad);
|
|
3675
|
-
const sinAngle = Math.sin(angleRad);
|
|
3676
|
-
const normalizedRotation = (rotation5 % 360 + 360) % 360;
|
|
3677
|
-
const sliceAlongWidth = height <= width ? normalizedRotation >= 45 && normalizedRotation < 135 || normalizedRotation >= 225 && normalizedRotation < 315 : normalizedRotation >= 135 && normalizedRotation < 225 || normalizedRotation >= 315 || normalizedRotation < 45;
|
|
3678
|
-
if (sliceAlongWidth) {
|
|
3679
|
-
const sliceWidth = width / numRects;
|
|
3680
|
-
for (let i2 = 0; i2 < numRects; i2++) {
|
|
3681
|
-
const x2 = (i2 - numRects / 2 + 0.5) * sliceWidth;
|
|
3682
|
-
const rotatedX = -x2 * cosAngle;
|
|
3683
|
-
const rotatedY = -x2 * sinAngle;
|
|
3684
|
-
const coverageWidth = sliceWidth * 1.1;
|
|
3685
|
-
const coverageHeight = Math.abs(height * cosAngle) + Math.abs(sliceWidth * sinAngle);
|
|
3686
|
-
rects.push({
|
|
3687
|
-
center: {
|
|
3688
|
-
x: center.x + rotatedX,
|
|
3689
|
-
y: center.y + rotatedY
|
|
3690
|
-
},
|
|
3691
|
-
width: coverageWidth,
|
|
3692
|
-
height: coverageHeight
|
|
3693
|
-
});
|
|
3694
|
-
}
|
|
3695
|
-
} else {
|
|
3696
|
-
const sliceHeight = height / numRects;
|
|
3697
|
-
for (let i2 = 0; i2 < numRects; i2++) {
|
|
3698
|
-
const y2 = (i2 - numRects / 2 + 0.5) * sliceHeight;
|
|
3699
|
-
const rotatedX = -y2 * sinAngle;
|
|
3700
|
-
const rotatedY = y2 * cosAngle;
|
|
3701
|
-
const coverageWidth = Math.abs(width * cosAngle) + Math.abs(sliceHeight * sinAngle);
|
|
3702
|
-
const coverageHeight = sliceHeight * 1.1;
|
|
3703
|
-
rects.push({
|
|
3704
|
-
center: {
|
|
3705
|
-
x: center.x + rotatedX,
|
|
3706
|
-
y: center.y + rotatedY
|
|
3707
|
-
},
|
|
3708
|
-
width: coverageWidth,
|
|
3709
|
-
height: coverageHeight
|
|
3710
|
-
});
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
return rects;
|
|
3714
|
-
}
|
|
3715
|
-
|
|
3716
3669
|
// lib/utils/obstacles/getAxisAlignedRectFromPolygon.ts
|
|
3717
3670
|
var AXIS_ALIGNED_RECT_TOLERANCE_MM = 1e-3;
|
|
3718
3671
|
var getAxisAlignedRectFromPolygon = (points) => {
|
|
@@ -3822,43 +3775,34 @@ var getObstaclesFromPcbKeepoutOutline = (keepout, componentId) => {
|
|
|
3822
3775
|
const deltaY = end.y - start.y;
|
|
3823
3776
|
const segmentLength = Math.hypot(deltaX, deltaY);
|
|
3824
3777
|
if (!Number.isFinite(segmentLength) || segmentLength === 0) continue;
|
|
3825
|
-
|
|
3778
|
+
obstacles.push({
|
|
3779
|
+
obstacleId: `${keepout.pcb_keepout_id}_segment_${segmentIndex}`,
|
|
3780
|
+
componentId,
|
|
3781
|
+
type: "rect",
|
|
3782
|
+
layers: keepout.layers,
|
|
3826
3783
|
center: {
|
|
3827
3784
|
x: (start.x + end.x) / 2,
|
|
3828
3785
|
y: (start.y + end.y) / 2
|
|
3829
3786
|
},
|
|
3830
3787
|
width: segmentLength,
|
|
3831
3788
|
height: stroke_width,
|
|
3832
|
-
|
|
3789
|
+
ccwRotationDegrees: Math.atan2(deltaY, deltaX) * 180 / Math.PI,
|
|
3790
|
+
connectedTo: []
|
|
3833
3791
|
});
|
|
3834
|
-
for (const [approximationIndex, rect] of approximatingRects.entries()) {
|
|
3835
|
-
obstacles.push({
|
|
3836
|
-
obstacleId: `${keepout.pcb_keepout_id}_segment_${segmentIndex}_rect_${approximationIndex}`,
|
|
3837
|
-
componentId,
|
|
3838
|
-
type: "rect",
|
|
3839
|
-
layers: keepout.layers,
|
|
3840
|
-
...rect,
|
|
3841
|
-
connectedTo: []
|
|
3842
|
-
});
|
|
3843
|
-
}
|
|
3844
3792
|
}
|
|
3845
3793
|
const isClosed = outline.length > 1 && outline[0].x === outline.at(-1)?.x && outline[0].y === outline.at(-1)?.y;
|
|
3846
3794
|
const joinPoints = isClosed ? outline.slice(0, -1) : outline;
|
|
3847
3795
|
for (const [joinIndex, point6] of joinPoints.entries()) {
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
...rect,
|
|
3859
|
-
connectedTo: []
|
|
3860
|
-
});
|
|
3861
|
-
}
|
|
3796
|
+
obstacles.push({
|
|
3797
|
+
obstacleId: `${keepout.pcb_keepout_id}_join_${joinIndex}`,
|
|
3798
|
+
componentId,
|
|
3799
|
+
type: "rect",
|
|
3800
|
+
layers: keepout.layers,
|
|
3801
|
+
center: point6,
|
|
3802
|
+
width: stroke_width,
|
|
3803
|
+
height: stroke_width,
|
|
3804
|
+
connectedTo: []
|
|
3805
|
+
});
|
|
3862
3806
|
}
|
|
3863
3807
|
return obstacles;
|
|
3864
3808
|
};
|
|
@@ -119177,7 +119121,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
119177
119121
|
var package_default = {
|
|
119178
119122
|
name: "@tscircuit/core",
|
|
119179
119123
|
type: "module",
|
|
119180
|
-
version: "0.0.
|
|
119124
|
+
version: "0.0.2162",
|
|
119181
119125
|
types: "dist/index.d.ts",
|
|
119182
119126
|
main: "dist/index.js",
|
|
119183
119127
|
module: "dist/index.js",
|
|
@@ -119214,7 +119158,7 @@ var package_default = {
|
|
|
119214
119158
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
119215
119159
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.21.tgz",
|
|
119216
119160
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
119217
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
119161
|
+
"@tscircuit/capacity-autorouter": "^0.0.985",
|
|
119218
119162
|
"@tscircuit/checks": "^0.0.256",
|
|
119219
119163
|
"@tscircuit/circuit-json-util": "^0.0.122",
|
|
119220
119164
|
"@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.2163",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
|
|
39
39
|
"@tscircuit/bus-lanes-solver": "https://jscdn.tscircuit.com/@tscircuit/bus-lanes-solver/0.0.21.tgz",
|
|
40
40
|
"@tscircuit/cableprinter": "^0.0.6",
|
|
41
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
41
|
+
"@tscircuit/capacity-autorouter": "^0.0.985",
|
|
42
42
|
"@tscircuit/checks": "^0.0.256",
|
|
43
43
|
"@tscircuit/circuit-json-util": "^0.0.122",
|
|
44
44
|
"@tscircuit/common": "^0.0.20",
|