@willcgage/module-schematic 0.49.0 → 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 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,16 +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 - (hw - C.y) ** 2));
1364
- const xBot = C.x - Math.sqrt(Math.max(0, rr * rr - (-hw - C.y) ** 2));
1365
- const tTop = Math.atan2(hw - C.y, xTop - C.x);
1366
- const tBot = Math.atan2(-hw - C.y, xBot - C.x);
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);
1368
+ let end = tBot;
1369
+ while (end >= tTop) end -= 2 * Math.PI;
1367
1370
  return [
1368
- { x: 0, y: hw },
1369
- { x: xTop, y: hw },
1370
- ...arc(C.x, C.y, rr, tTop, tBot - 2 * Math.PI, 48).slice(1, -1),
1371
- { x: xBot, y: -hw },
1372
- { x: 0, y: -hw }
1371
+ { x: 0, y: leadHalf },
1372
+ { x: xTop, y: leadHalf },
1373
+ ...arc(C.x, C.y, rr, tTop, end, 48).slice(1, -1),
1374
+ { x: xBot, y: -leadHalf },
1375
+ { x: 0, y: -leadHalf }
1373
1376
  ];
1374
1377
  };
1375
1378
  const Ri = R - hw;
@@ -1378,14 +1381,14 @@ function returnLoop(shape, opts) {
1378
1381
  const xR = C.x + R + hw;
1379
1382
  const yT = R + hw;
1380
1383
  const outerSquare = [
1381
- { x: 0, y: hw },
1382
- { x: xL, y: hw },
1384
+ { x: 0, y: leadHalf },
1385
+ { x: xL, y: leadHalf },
1383
1386
  { x: xL, y: yT },
1384
1387
  { x: xR, y: yT },
1385
1388
  { x: xR, y: -yT },
1386
1389
  { x: xL, y: -yT },
1387
- { x: xL, y: -hw },
1388
- { x: 0, y: -hw }
1390
+ { x: xL, y: -leadHalf },
1391
+ { x: 0, y: -leadHalf }
1389
1392
  ];
1390
1393
  const iHalf = (R - hw) / Math.SQRT2;
1391
1394
  const holeSquare = iHalf > 2 ? [