@willcgage/module-schematic 0.55.0 → 0.56.0

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
@@ -1139,14 +1139,19 @@ var ATLAS_CODE55_N = [
1139
1139
  partNumbers: { left: "2052", right: "2053" },
1140
1140
  frogNumber: 7,
1141
1141
  lead: {
1142
- inches: 3.375,
1142
+ inches: 3.59375,
1143
1143
  source: "measured",
1144
- note: "Steve Branton, physical Atlas code 55 #7, 3\u215C\u2033 points\u2192frog (#173)"
1144
+ note: "Will Gage, physical Atlas 2052 (#7), 3\xB9\u2079\u2044\u2083\u2082\u2033 points\u2192frog as a single span \u2014 and it matches his two positions exactly (4\u2077\u2044\u2083\u2082 \u2212 \u2075\u2044\u2088), so the reading is internally consistent. SUPERSEDES Steve Branton's 3\u215C\u2033 (#173), which was \u2077\u2044\u2083\u2082\u2033 short and was the library's founding measurement. \u26A0\uFE0F Steve's number was also the SOLE basis of TURNOUT_LEAD_INCHES_PER_FROG (3.375/7 = 0.482) \u2014 that constant is now baseless as well as refuted."
1145
+ },
1146
+ pointsOffset: {
1147
+ inches: 0.625,
1148
+ source: "measured",
1149
+ note: "Will Gage, physical Atlas 2052 (#7) \u2014 \xB9\u2070\u2044\u2081\u2086\u2033 tie end to point tips"
1145
1150
  },
1146
1151
  frogOffset: {
1147
- inches: 4.1875,
1152
+ inches: 4.21875,
1148
1153
  source: "measured",
1149
- note: "Will Gage, physical Atlas 2052 (#7) \u2014 tie end to the apex of the V"
1154
+ note: "Will Gage, physical Atlas 2052 (#7) \u2014 4\u2077\u2044\u2083\u2082\u2033, tie end to the apex of the V. Supersedes an initial 4\xB3\u2044\u2081\u2086\u2033. Worth noting for provenance: he was told beforehand that the clearance hypothesis predicted 4\xBC\u2033 and did NOT read 4\xBC\u2033 \u2014 so this number is not a confirmation artefact, and it sits \xB9\u2044\u2083\u2082\u2033 (one tape division) from the predicted value."
1150
1155
  },
1151
1156
  overallLength: {
1152
1157
  inches: 6,
@@ -1232,10 +1237,24 @@ function turnoutPartForSize(size, library = BUILT_IN_TRACK_PARTS) {
1232
1237
  (best, p) => Math.abs(p.frogNumber - size) < Math.abs(best.frogNumber - size) ? p : best
1233
1238
  );
1234
1239
  }
1240
+ function measuredLeadPoints(library) {
1241
+ return library.filter(
1242
+ (p) => p.kind === "turnout" && p.frogNumber != null && p.lead?.source === "measured"
1243
+ ).map((p) => ({ n: p.frogNumber, lead: p.lead.inches })).sort((a, b) => a.n - b.n);
1244
+ }
1235
1245
  function leadInchesForSize(size, library = BUILT_IN_TRACK_PARTS) {
1236
1246
  const part = turnoutPartForSize(size, library);
1237
1247
  if (part?.lead && part.frogNumber === size) return part.lead.inches;
1238
- return size * TURNOUT_LEAD_INCHES_PER_FROG;
1248
+ const pts = measuredLeadPoints(library);
1249
+ if (!pts.length) return size * TURNOUT_LEAD_INCHES_PER_FROG;
1250
+ if (pts.length === 1) return size / pts[0].n * pts[0].lead;
1251
+ let i;
1252
+ if (size >= pts[pts.length - 1].n) i = pts.length - 2;
1253
+ else i = Math.max(0, pts.findIndex((p) => p.n >= size) - 1);
1254
+ const lo = pts[i];
1255
+ const hi = pts[i + 1];
1256
+ const t = (size - lo.n) / (hi.n - lo.n);
1257
+ return lo.lead + t * (hi.lead - lo.lead);
1239
1258
  }
1240
1259
  function parseXtpLibrary(text) {
1241
1260
  const parts = [];