@willcgage/module-schematic 0.49.1 → 0.49.2
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.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1338,6 +1338,7 @@ function returnLoop(shape, opts) {
|
|
|
1338
1338
|
const L = Math.max(1, opts.leadInches);
|
|
1339
1339
|
const R = Math.max(1, opts.radius);
|
|
1340
1340
|
const hw = Math.min(opts.boardHalfWidth ?? 6, R - 1);
|
|
1341
|
+
const leadHalf = Math.max(hw, opts.endplateHalfWidth ?? hw);
|
|
1341
1342
|
const T = { x: L, y: 0 };
|
|
1342
1343
|
const r2 = (v) => Math.round(v * 100) / 100;
|
|
1343
1344
|
const rd = (pts) => pts.map((p) => ({ x: r2(p.x), y: r2(p.y) }));
|
|
@@ -1360,18 +1361,18 @@ function returnLoop(shape, opts) {
|
|
|
1360
1361
|
const legDir = (P) => Math.atan2(P.y - T.y, P.x - T.x);
|
|
1361
1362
|
const half = Math.abs((legDir(P1) - legDir(P2) + Math.PI) % (2 * Math.PI) - Math.PI) / 2;
|
|
1362
1363
|
const ringOuter = (rr) => {
|
|
1363
|
-
const xTop = C.x - Math.sqrt(Math.max(0, rr * rr - (
|
|
1364
|
-
const xBot = C.x - Math.sqrt(Math.max(0, rr * rr - (-
|
|
1365
|
-
const tTop = Math.atan2(
|
|
1366
|
-
const tBot = Math.atan2(-
|
|
1364
|
+
const xTop = C.x - Math.sqrt(Math.max(0, rr * rr - (leadHalf - C.y) ** 2));
|
|
1365
|
+
const xBot = C.x - Math.sqrt(Math.max(0, rr * rr - (-leadHalf - C.y) ** 2));
|
|
1366
|
+
const tTop = Math.atan2(leadHalf - C.y, xTop - C.x);
|
|
1367
|
+
const tBot = Math.atan2(-leadHalf - C.y, xBot - C.x);
|
|
1367
1368
|
let end = tBot;
|
|
1368
1369
|
while (end >= tTop) end -= 2 * Math.PI;
|
|
1369
1370
|
return [
|
|
1370
|
-
{ x: 0, y:
|
|
1371
|
-
{ x: xTop, y:
|
|
1371
|
+
{ x: 0, y: leadHalf },
|
|
1372
|
+
{ x: xTop, y: leadHalf },
|
|
1372
1373
|
...arc(C.x, C.y, rr, tTop, end, 48).slice(1, -1),
|
|
1373
|
-
{ x: xBot, y: -
|
|
1374
|
-
{ x: 0, y: -
|
|
1374
|
+
{ x: xBot, y: -leadHalf },
|
|
1375
|
+
{ x: 0, y: -leadHalf }
|
|
1375
1376
|
];
|
|
1376
1377
|
};
|
|
1377
1378
|
const Ri = R - hw;
|
|
@@ -1380,14 +1381,14 @@ function returnLoop(shape, opts) {
|
|
|
1380
1381
|
const xR = C.x + R + hw;
|
|
1381
1382
|
const yT = R + hw;
|
|
1382
1383
|
const outerSquare = [
|
|
1383
|
-
{ x: 0, y:
|
|
1384
|
-
{ x: xL, y:
|
|
1384
|
+
{ x: 0, y: leadHalf },
|
|
1385
|
+
{ x: xL, y: leadHalf },
|
|
1385
1386
|
{ x: xL, y: yT },
|
|
1386
1387
|
{ x: xR, y: yT },
|
|
1387
1388
|
{ x: xR, y: -yT },
|
|
1388
1389
|
{ x: xL, y: -yT },
|
|
1389
|
-
{ x: xL, y: -
|
|
1390
|
-
{ x: 0, y: -
|
|
1390
|
+
{ x: xL, y: -leadHalf },
|
|
1391
|
+
{ x: 0, y: -leadHalf }
|
|
1391
1392
|
];
|
|
1392
1393
|
const iHalf = (R - hw) / Math.SQRT2;
|
|
1393
1394
|
const holeSquare = iHalf > 2 ? [
|