@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.d.cts CHANGED
@@ -1078,7 +1078,12 @@ interface ReturnLoopGeometry {
1078
1078
  declare function returnLoop(shape: ReturnLoopShape, opts: {
1079
1079
  leadInches: number;
1080
1080
  radius: number;
1081
+ /** Half-width of the board UNDER the loop track (the donut ring), inches. */
1081
1082
  boardHalfWidth?: number;
1083
+ /** Half the endplate face width, inches. The lead/interface board is sized to
1084
+ * this so the benchwork is never narrower than the endplate (Free-moN §2.0);
1085
+ * the track crosses the endplate centred on a full-width board. */
1086
+ endplateHalfWidth?: number;
1082
1087
  }): ReturnLoopGeometry;
1083
1088
  interface ModuleGeometryInput {
1084
1089
  lengthInches: number;
package/dist/index.d.ts CHANGED
@@ -1078,7 +1078,12 @@ interface ReturnLoopGeometry {
1078
1078
  declare function returnLoop(shape: ReturnLoopShape, opts: {
1079
1079
  leadInches: number;
1080
1080
  radius: number;
1081
+ /** Half-width of the board UNDER the loop track (the donut ring), inches. */
1081
1082
  boardHalfWidth?: number;
1083
+ /** Half the endplate face width, inches. The lead/interface board is sized to
1084
+ * this so the benchwork is never narrower than the endplate (Free-moN §2.0);
1085
+ * the track crosses the endplate centred on a full-width board. */
1086
+ endplateHalfWidth?: number;
1082
1087
  }): ReturnLoopGeometry;
1083
1088
  interface ModuleGeometryInput {
1084
1089
  lengthInches: number;
package/dist/index.js CHANGED
@@ -1336,6 +1336,7 @@ function returnLoop(shape, opts) {
1336
1336
  const L = Math.max(1, opts.leadInches);
1337
1337
  const R = Math.max(1, opts.radius);
1338
1338
  const hw = Math.min(opts.boardHalfWidth ?? 6, R - 1);
1339
+ const leadHalf = Math.max(hw, opts.endplateHalfWidth ?? hw);
1339
1340
  const T = { x: L, y: 0 };
1340
1341
  const r2 = (v) => Math.round(v * 100) / 100;
1341
1342
  const rd = (pts) => pts.map((p) => ({ x: r2(p.x), y: r2(p.y) }));
@@ -1358,16 +1359,18 @@ function returnLoop(shape, opts) {
1358
1359
  const legDir = (P) => Math.atan2(P.y - T.y, P.x - T.x);
1359
1360
  const half = Math.abs((legDir(P1) - legDir(P2) + Math.PI) % (2 * Math.PI) - Math.PI) / 2;
1360
1361
  const ringOuter = (rr) => {
1361
- const xTop = C.x - Math.sqrt(Math.max(0, rr * rr - (hw - C.y) ** 2));
1362
- const xBot = C.x - Math.sqrt(Math.max(0, rr * rr - (-hw - C.y) ** 2));
1363
- const tTop = Math.atan2(hw - C.y, xTop - C.x);
1364
- const tBot = Math.atan2(-hw - C.y, xBot - C.x);
1362
+ const xTop = C.x - Math.sqrt(Math.max(0, rr * rr - (leadHalf - C.y) ** 2));
1363
+ const xBot = C.x - Math.sqrt(Math.max(0, rr * rr - (-leadHalf - C.y) ** 2));
1364
+ const tTop = Math.atan2(leadHalf - C.y, xTop - C.x);
1365
+ const tBot = Math.atan2(-leadHalf - C.y, xBot - C.x);
1366
+ let end = tBot;
1367
+ while (end >= tTop) end -= 2 * Math.PI;
1365
1368
  return [
1366
- { x: 0, y: hw },
1367
- { x: xTop, y: hw },
1368
- ...arc(C.x, C.y, rr, tTop, tBot - 2 * Math.PI, 48).slice(1, -1),
1369
- { x: xBot, y: -hw },
1370
- { x: 0, y: -hw }
1369
+ { x: 0, y: leadHalf },
1370
+ { x: xTop, y: leadHalf },
1371
+ ...arc(C.x, C.y, rr, tTop, end, 48).slice(1, -1),
1372
+ { x: xBot, y: -leadHalf },
1373
+ { x: 0, y: -leadHalf }
1371
1374
  ];
1372
1375
  };
1373
1376
  const Ri = R - hw;
@@ -1376,14 +1379,14 @@ function returnLoop(shape, opts) {
1376
1379
  const xR = C.x + R + hw;
1377
1380
  const yT = R + hw;
1378
1381
  const outerSquare = [
1379
- { x: 0, y: hw },
1380
- { x: xL, y: hw },
1382
+ { x: 0, y: leadHalf },
1383
+ { x: xL, y: leadHalf },
1381
1384
  { x: xL, y: yT },
1382
1385
  { x: xR, y: yT },
1383
1386
  { x: xR, y: -yT },
1384
1387
  { x: xL, y: -yT },
1385
- { x: xL, y: -hw },
1386
- { x: 0, y: -hw }
1388
+ { x: xL, y: -leadHalf },
1389
+ { x: 0, y: -leadHalf }
1387
1390
  ];
1388
1391
  const iHalf = (R - hw) / Math.SQRT2;
1389
1392
  const holeSquare = iHalf > 2 ? [