@willcgage/module-schematic 0.54.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.d.cts CHANGED
@@ -1035,28 +1035,35 @@ interface ModuleFeatures {
1035
1035
  /** N-scale track gauge, inches (9 mm). */
1036
1036
  declare const RAIL_GAUGE_INCHES = 0.354;
1037
1037
  /**
1038
- * ⚠️ **REFUTED AS A GENERAL RULE LAST RESORT ONLY.** Points→frog for a #1
1039
- * frog, i.e. a turnout's LEAD if lead were proportional to frog number. From an
1040
- * Atlas code 55 #7 measuring 3⅜″ (Steve Branton, #173) ⇒ 3.375 / 7.
1038
+ * ⚠️⚠️ **DEAD REFUTED *AND* BASELESS. NOTHING SHOULD REACH THIS.** Kept only
1039
+ * so a library with no measured leads at all still returns a number, and as a
1040
+ * record of how the mistake was made.
1041
1041
  *
1042
- * It is NOT proportional, and the error CHANGES SIGN. Measured lead ÷ N:
1043
- * **#5 = 0.600, #7 = 0.482, #10 = 0.419** it falls monotonically. This rule
1044
- * reads **20% SHORT at N=5** (2.41″ vs a measured 3.00″) and **13% LONG at
1045
- * N=10** (4.82″ vs 4³⁄₁₆″). There is no safe direction to be wrong in.
1042
+ * It was points→frog for a #1 frog: a turnout's LEAD if lead were proportional
1043
+ * to frog number, from an Atlas #7 measuring 3⅜″ (Steve Branton, #173)
1044
+ * 3.375 / 7.
1046
1045
  *
1047
- * Prefer {@link leadInchesForSize}, which returns a real part's measurement when
1048
- * one exists and only falls back here for sizes nothing in the library covers.
1049
- * ⚠️ The remaining fallback user is the #2.5 wye at 1.21″; since per-frog RISES
1050
- * as N falls, that is very likely SHORT. Treat it as a placeholder.
1046
+ * TWO independent things are wrong with it:
1047
+ * 1. **Lead is not proportional to N.** Measured lead ÷ N: #5 = 0.600,
1048
+ * #7 = 0.513, #10 = 0.494. It reads ~20% SHORT at N=5.
1049
+ * 2. **Its founding measurement was superseded.** Will Gage re-measured the same
1050
+ * part at 3¹⁹⁄₃₂″, ⁷⁄₃₂″ longer, confirmed against his own points and frog
1051
+ * positions. So 0.482 is not even the right constant for the wrong model.
1052
+ *
1053
+ * {@link leadInchesForSize} now INTERPOLATES across the measured parts instead.
1054
+ * A single measurement can only ever be scaled — which is this rule — so the
1055
+ * lesson is that one data point cannot support a shape, only a value.
1051
1056
  *
1052
1057
  * A constant-switch-angle model was also proposed here and is likewise REFUTED:
1053
- * inverting {@link turnoutClosure} gives α = 0.036 (#5), 0.067 (#7), 0.069
1054
- * (#10). It was floated when only the #7 and #10 were known, which agreed to
1055
- * 3%; the #5 killed it. Kept as a warning two agreeing parts are not a law,
1056
- * and this library has now watched three separate rules die that way.
1058
+ * inverting {@link turnoutClosure} gives α = 0.036 (#5), 0.067 (#7), 0.043
1059
+ * (#10). Kept as a warning — it was floated when the #7 and #10 agreed to 3%,
1060
+ * on a #10 figure that later turned out to be measured to the wrong landmark.
1061
+ * TWO AGREEING PARTS ARE NOT A LAW, and neither is a coincidence you haven't
1062
+ * checked the provenance of.
1057
1063
  *
1058
- * The pattern that DOES fit both fully-measured parts is on {@link
1059
- * ATLAS_CODE55_N}: the frog sits at a fixed 4.75and the points move.
1064
+ * The pattern that currently fits is on {@link ATLAS_CODE55_N}: the moulding
1065
+ * runs past the frog far enough to gain a constant 0.25of separation. Note it
1066
+ * predicts the FROG POSITION, not the lead — this constant has no successor.
1060
1067
  */
1061
1068
  declare const TURNOUT_LEAD_INCHES_PER_FROG = 0.482;
1062
1069
  /** Where a dimension came from. `derived` = we computed it from another part or
@@ -1105,6 +1112,13 @@ interface TrackPart {
1105
1112
  * inside its moulding; the rest of that end is plain approach track. Needed to
1106
1113
  * fit a part into a space, and by any renderer drawing the real outline. */
1107
1114
  pointsOffset?: PartDimension;
1115
+ /** End of the tie strip → the APEX OF THE FROG V, measured from the same end
1116
+ * as {@link pointsOffset}. ⚠️ The apex, NOT the end of the frog casting — on a
1117
+ * shallow #10 those are ¾″ apart, which is how this library recorded a wrong
1118
+ * #10 lead through two releases. `lead` is the difference of the two, so
1119
+ * prefer these when both are known: they're what someone can actually put a
1120
+ * rule against. */
1121
+ frogOffset?: PartDimension;
1108
1122
  /** End-to-end length of the part. */
1109
1123
  overallLength?: PartDimension;
1110
1124
  /** Diverging route radius (straight turnouts). */
@@ -1125,32 +1139,47 @@ declare const CODE55_RAIL_HEIGHT_INCHES = 0.055;
1125
1139
  * (3⅜″ points→frog, #173) and Will Gage's #5/#7/#10 overall lengths plus the
1126
1140
  * #10's lead and points offset. The #5's lead and the wye's are still derived.
1127
1141
  *
1128
- * ⭐⭐ **THE FROG SITS AT 4.75″ FROM THE TIE END ON BOTH MEASURED PARTS.**
1142
+ * MEASURED GEOMETRY (all Will Gage's, off physical parts, frog taken at the V):
1129
1143
  *
1130
- * part points FROG overall lead
1131
- * #5 1¾″ 4.75″ 6.00″ 3.0000
1132
- * #10 ⁹⁄₁₆″ 4.75″ 8.00″ 4.1875
1144
+ * part points frog V overall lead past frog ÷N
1145
+ * #5 1¾″ 4.75″ 6.00″ 3.00000 1.25″ 0.2500
1146
+ * #7 ⁵⁄₈″ 4⁷⁄₃₂″ 6.00″ 3.59375 1.78125″ 0.2545
1147
+ * #10 ⁹⁄₁₆″ 5.50″ 8.00″ 4.93750″ 2.50″ 0.2500
1133
1148
  *
1134
- * Atlas appear to FIX where the frog casting sits in the moulding and move the
1135
- * POINTS to change the frog number. That single fact explains every failed rule
1136
- * below at once: lead was never a property of N — it is just
1137
- * `4.75 wherever the points landed`.
1149
+ * Every one of these is Will Gage's, off a physical part, frog taken at the V.
1150
+ * ⚠️ The #7 lead SUPERSEDES Steve Branton's 3⅜″ (#173) the library's founding
1151
+ * measurement, ⁷⁄₃₂″ short. Will's single-span reading and his two positions
1152
+ * agree exactly, which is why it wins. Steve's number was also the sole basis of
1153
+ * {@link TURNOUT_LEAD_INCHES_PER_FROG}; that constant is now baseless as well as
1154
+ * refuted, and {@link leadInchesForSize} interpolates across this table instead.
1138
1155
  *
1139
- * ⚠️ TESTABLE, AND CHEAP: Steve's #7 lead of 3⅜″ was measured independently, by
1140
- * someone else, on a different part. If the frog really is fixed at 4.75″, that
1141
- * part's POINTS must sit at 4.75 3.375 = **1⅜″**. Measure a physical 2052 and
1142
- * this model is confirmed or dead. Nobody has measured the #7's points offset.
1156
+ * **THE PART RUNS PAST THE FROG FAR ENOUGH TO GAIN 0.25″ OF SEPARATION.**
1157
+ * Past-frog run ÷ N is 0.2500 / 0.2545 / 0.2500 — the #5 and #10 EXACT, the #7
1158
+ * within ¹⁄₃₂″ of the tie end (a 4¼″ frog would make it exact too, one tape
1159
+ * division away). Provenance note: the measurer was told that prediction BEFORE
1160
+ * re-reading and did not return 4¼″, so this is not a confirmation artefact. At the frog
1161
+ * the routes are one gauge apart; at the end of the moulding they are
1162
+ * 0.354 + 0.25 ≈ 0.6″ apart. So Atlas size the moulding for a constant
1163
+ * CLEARANCE, not a constant length — which is what a manufacturer would
1164
+ * sensibly do, and why overall length looks arbitrary until you divide by N.
1165
+ * ⚠️ It predicts the FROG POSITION from the overall length. It does NOT predict
1166
+ * the lead — the points offset is independent and must still be measured.
1167
+ * ⚠️ HYPOTHESIS. It is the FOURTH rule fitted to this data; the first three all
1168
+ * died. Two exact hits and a near miss is not a law.
1143
1169
  *
1144
1170
  * NOTHING HERE IS PROPORTIONAL TO FROG NUMBER. Three rules assumed otherwise;
1145
1171
  * all three were tested against a physical part and FAILED:
1146
- * - ❌ **Lead ∝ N.** Measured lead ÷ N: #5 = 0.600, #7 = 0.482, #10 = 0.419 —
1147
- * falls monotonically. {@link TURNOUT_LEAD_INCHES_PER_FROG} reads 13% LONG at
1148
- * N=10 and 20% SHORT at N=5, so its error even changes sign.
1172
+ * - ❌ **Lead ∝ N.** Measured lead ÷ N: #5 = 0.600, #7 = 0.513, #10 = 0.494.
1173
+ * {@link TURNOUT_LEAD_INCHES_PER_FROG} reads ~20% SHORT at N=5 — and its
1174
+ * founding measurement has since been superseded, so it is baseless too.
1149
1175
  * - ❌ **Constant switch angle.** Inverting {@link turnoutClosure} gives α =
1150
- * 0.036 (#5), 0.067 (#7), 0.069 (#10). The #7 and #10 agreed to 3% and the #5
1151
- * killed it. Two agreeing parts are not a law.
1176
+ * 0.036 (#5), 0.055 (#7), 0.043 (#10). Not constant.
1152
1177
  * - ❌ **Overall length ∝ N.** #5 = 6.00″ and #7 = 6.00″ — same moulding, two
1153
1178
  * frog numbers.
1179
+ * - ❌ **Frog fixed at 4.75″** (shipped in 0.54.0, retracted in 0.55.0). It
1180
+ * rested on the #5 and #10 both reading 4.75″, but the #10's was the END OF
1181
+ * THE FROG CASTING, not the V. Measured consistently the frogs are at 4.75″,
1182
+ * 4³⁄₁₆″ and 5.5″ — all different.
1154
1183
  *
1155
1184
  * The definition is the reason: #N fixes the DIVERGENCE RATE AT THE FROG (1
1156
1185
  * across per N along) and says NOTHING about how much tie strip the manufacturer
@@ -1165,9 +1194,19 @@ declare function trackPart(id: string, library?: TrackPart[]): TrackPart | null;
1165
1194
  /** The closest built-in turnout for a frog number — what a bare `size` maps to
1166
1195
  * when a turnout names no part. Exact match wins; otherwise the nearest frog. */
1167
1196
  declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackPart | null;
1168
- /** The lead to draw a turnout of this size with — a real part's measurement when
1169
- * we have one, else the per-frog rule. Keeps `frogLegOf` honest without it
1170
- * needing to know the library exists. */
1197
+ /**
1198
+ * The lead to draw a turnout of this size with. Keeps `frogLegOf` honest without
1199
+ * it needing to know the library exists.
1200
+ *
1201
+ * 1. An exact part match wins — a #7's measurement says nothing about a #4.
1202
+ * 2. Otherwise INTERPOLATE piecewise-linearly across the measured parts. This
1203
+ * replaced `size × TURNOUT_LEAD_INCHES_PER_FROG`, which was refuted (its
1204
+ * error changes sign across the measured range) and is now baseless besides,
1205
+ * its founding #7 measurement having been superseded.
1206
+ * 3. ⚠️ Outside the measured range the end segments EXTRAPOLATE. Measured leads
1207
+ * span N = 5…10, so a #4 or #12 is a projection, not a reading, and the #2.5
1208
+ * wye is a long way out. Treat those as placeholders until a part is measured.
1209
+ */
1171
1210
  declare function leadInchesForSize(size: number, library?: TrackPart[]): number;
1172
1211
  /** One drawn piece of a part's geometry, in the part's own local frame. */
1173
1212
  type PartSegment = {
package/dist/index.d.ts CHANGED
@@ -1035,28 +1035,35 @@ interface ModuleFeatures {
1035
1035
  /** N-scale track gauge, inches (9 mm). */
1036
1036
  declare const RAIL_GAUGE_INCHES = 0.354;
1037
1037
  /**
1038
- * ⚠️ **REFUTED AS A GENERAL RULE LAST RESORT ONLY.** Points→frog for a #1
1039
- * frog, i.e. a turnout's LEAD if lead were proportional to frog number. From an
1040
- * Atlas code 55 #7 measuring 3⅜″ (Steve Branton, #173) ⇒ 3.375 / 7.
1038
+ * ⚠️⚠️ **DEAD REFUTED *AND* BASELESS. NOTHING SHOULD REACH THIS.** Kept only
1039
+ * so a library with no measured leads at all still returns a number, and as a
1040
+ * record of how the mistake was made.
1041
1041
  *
1042
- * It is NOT proportional, and the error CHANGES SIGN. Measured lead ÷ N:
1043
- * **#5 = 0.600, #7 = 0.482, #10 = 0.419** it falls monotonically. This rule
1044
- * reads **20% SHORT at N=5** (2.41″ vs a measured 3.00″) and **13% LONG at
1045
- * N=10** (4.82″ vs 4³⁄₁₆″). There is no safe direction to be wrong in.
1042
+ * It was points→frog for a #1 frog: a turnout's LEAD if lead were proportional
1043
+ * to frog number, from an Atlas #7 measuring 3⅜″ (Steve Branton, #173)
1044
+ * 3.375 / 7.
1046
1045
  *
1047
- * Prefer {@link leadInchesForSize}, which returns a real part's measurement when
1048
- * one exists and only falls back here for sizes nothing in the library covers.
1049
- * ⚠️ The remaining fallback user is the #2.5 wye at 1.21″; since per-frog RISES
1050
- * as N falls, that is very likely SHORT. Treat it as a placeholder.
1046
+ * TWO independent things are wrong with it:
1047
+ * 1. **Lead is not proportional to N.** Measured lead ÷ N: #5 = 0.600,
1048
+ * #7 = 0.513, #10 = 0.494. It reads ~20% SHORT at N=5.
1049
+ * 2. **Its founding measurement was superseded.** Will Gage re-measured the same
1050
+ * part at 3¹⁹⁄₃₂″, ⁷⁄₃₂″ longer, confirmed against his own points and frog
1051
+ * positions. So 0.482 is not even the right constant for the wrong model.
1052
+ *
1053
+ * {@link leadInchesForSize} now INTERPOLATES across the measured parts instead.
1054
+ * A single measurement can only ever be scaled — which is this rule — so the
1055
+ * lesson is that one data point cannot support a shape, only a value.
1051
1056
  *
1052
1057
  * A constant-switch-angle model was also proposed here and is likewise REFUTED:
1053
- * inverting {@link turnoutClosure} gives α = 0.036 (#5), 0.067 (#7), 0.069
1054
- * (#10). It was floated when only the #7 and #10 were known, which agreed to
1055
- * 3%; the #5 killed it. Kept as a warning two agreeing parts are not a law,
1056
- * and this library has now watched three separate rules die that way.
1058
+ * inverting {@link turnoutClosure} gives α = 0.036 (#5), 0.067 (#7), 0.043
1059
+ * (#10). Kept as a warning — it was floated when the #7 and #10 agreed to 3%,
1060
+ * on a #10 figure that later turned out to be measured to the wrong landmark.
1061
+ * TWO AGREEING PARTS ARE NOT A LAW, and neither is a coincidence you haven't
1062
+ * checked the provenance of.
1057
1063
  *
1058
- * The pattern that DOES fit both fully-measured parts is on {@link
1059
- * ATLAS_CODE55_N}: the frog sits at a fixed 4.75and the points move.
1064
+ * The pattern that currently fits is on {@link ATLAS_CODE55_N}: the moulding
1065
+ * runs past the frog far enough to gain a constant 0.25of separation. Note it
1066
+ * predicts the FROG POSITION, not the lead — this constant has no successor.
1060
1067
  */
1061
1068
  declare const TURNOUT_LEAD_INCHES_PER_FROG = 0.482;
1062
1069
  /** Where a dimension came from. `derived` = we computed it from another part or
@@ -1105,6 +1112,13 @@ interface TrackPart {
1105
1112
  * inside its moulding; the rest of that end is plain approach track. Needed to
1106
1113
  * fit a part into a space, and by any renderer drawing the real outline. */
1107
1114
  pointsOffset?: PartDimension;
1115
+ /** End of the tie strip → the APEX OF THE FROG V, measured from the same end
1116
+ * as {@link pointsOffset}. ⚠️ The apex, NOT the end of the frog casting — on a
1117
+ * shallow #10 those are ¾″ apart, which is how this library recorded a wrong
1118
+ * #10 lead through two releases. `lead` is the difference of the two, so
1119
+ * prefer these when both are known: they're what someone can actually put a
1120
+ * rule against. */
1121
+ frogOffset?: PartDimension;
1108
1122
  /** End-to-end length of the part. */
1109
1123
  overallLength?: PartDimension;
1110
1124
  /** Diverging route radius (straight turnouts). */
@@ -1125,32 +1139,47 @@ declare const CODE55_RAIL_HEIGHT_INCHES = 0.055;
1125
1139
  * (3⅜″ points→frog, #173) and Will Gage's #5/#7/#10 overall lengths plus the
1126
1140
  * #10's lead and points offset. The #5's lead and the wye's are still derived.
1127
1141
  *
1128
- * ⭐⭐ **THE FROG SITS AT 4.75″ FROM THE TIE END ON BOTH MEASURED PARTS.**
1142
+ * MEASURED GEOMETRY (all Will Gage's, off physical parts, frog taken at the V):
1129
1143
  *
1130
- * part points FROG overall lead
1131
- * #5 1¾″ 4.75″ 6.00″ 3.0000
1132
- * #10 ⁹⁄₁₆″ 4.75″ 8.00″ 4.1875
1144
+ * part points frog V overall lead past frog ÷N
1145
+ * #5 1¾″ 4.75″ 6.00″ 3.00000 1.25″ 0.2500
1146
+ * #7 ⁵⁄₈″ 4⁷⁄₃₂″ 6.00″ 3.59375 1.78125″ 0.2545
1147
+ * #10 ⁹⁄₁₆″ 5.50″ 8.00″ 4.93750″ 2.50″ 0.2500
1133
1148
  *
1134
- * Atlas appear to FIX where the frog casting sits in the moulding and move the
1135
- * POINTS to change the frog number. That single fact explains every failed rule
1136
- * below at once: lead was never a property of N — it is just
1137
- * `4.75 wherever the points landed`.
1149
+ * Every one of these is Will Gage's, off a physical part, frog taken at the V.
1150
+ * ⚠️ The #7 lead SUPERSEDES Steve Branton's 3⅜″ (#173) the library's founding
1151
+ * measurement, ⁷⁄₃₂″ short. Will's single-span reading and his two positions
1152
+ * agree exactly, which is why it wins. Steve's number was also the sole basis of
1153
+ * {@link TURNOUT_LEAD_INCHES_PER_FROG}; that constant is now baseless as well as
1154
+ * refuted, and {@link leadInchesForSize} interpolates across this table instead.
1138
1155
  *
1139
- * ⚠️ TESTABLE, AND CHEAP: Steve's #7 lead of 3⅜″ was measured independently, by
1140
- * someone else, on a different part. If the frog really is fixed at 4.75″, that
1141
- * part's POINTS must sit at 4.75 3.375 = **1⅜″**. Measure a physical 2052 and
1142
- * this model is confirmed or dead. Nobody has measured the #7's points offset.
1156
+ * **THE PART RUNS PAST THE FROG FAR ENOUGH TO GAIN 0.25″ OF SEPARATION.**
1157
+ * Past-frog run ÷ N is 0.2500 / 0.2545 / 0.2500 — the #5 and #10 EXACT, the #7
1158
+ * within ¹⁄₃₂″ of the tie end (a 4¼″ frog would make it exact too, one tape
1159
+ * division away). Provenance note: the measurer was told that prediction BEFORE
1160
+ * re-reading and did not return 4¼″, so this is not a confirmation artefact. At the frog
1161
+ * the routes are one gauge apart; at the end of the moulding they are
1162
+ * 0.354 + 0.25 ≈ 0.6″ apart. So Atlas size the moulding for a constant
1163
+ * CLEARANCE, not a constant length — which is what a manufacturer would
1164
+ * sensibly do, and why overall length looks arbitrary until you divide by N.
1165
+ * ⚠️ It predicts the FROG POSITION from the overall length. It does NOT predict
1166
+ * the lead — the points offset is independent and must still be measured.
1167
+ * ⚠️ HYPOTHESIS. It is the FOURTH rule fitted to this data; the first three all
1168
+ * died. Two exact hits and a near miss is not a law.
1143
1169
  *
1144
1170
  * NOTHING HERE IS PROPORTIONAL TO FROG NUMBER. Three rules assumed otherwise;
1145
1171
  * all three were tested against a physical part and FAILED:
1146
- * - ❌ **Lead ∝ N.** Measured lead ÷ N: #5 = 0.600, #7 = 0.482, #10 = 0.419 —
1147
- * falls monotonically. {@link TURNOUT_LEAD_INCHES_PER_FROG} reads 13% LONG at
1148
- * N=10 and 20% SHORT at N=5, so its error even changes sign.
1172
+ * - ❌ **Lead ∝ N.** Measured lead ÷ N: #5 = 0.600, #7 = 0.513, #10 = 0.494.
1173
+ * {@link TURNOUT_LEAD_INCHES_PER_FROG} reads ~20% SHORT at N=5 — and its
1174
+ * founding measurement has since been superseded, so it is baseless too.
1149
1175
  * - ❌ **Constant switch angle.** Inverting {@link turnoutClosure} gives α =
1150
- * 0.036 (#5), 0.067 (#7), 0.069 (#10). The #7 and #10 agreed to 3% and the #5
1151
- * killed it. Two agreeing parts are not a law.
1176
+ * 0.036 (#5), 0.055 (#7), 0.043 (#10). Not constant.
1152
1177
  * - ❌ **Overall length ∝ N.** #5 = 6.00″ and #7 = 6.00″ — same moulding, two
1153
1178
  * frog numbers.
1179
+ * - ❌ **Frog fixed at 4.75″** (shipped in 0.54.0, retracted in 0.55.0). It
1180
+ * rested on the #5 and #10 both reading 4.75″, but the #10's was the END OF
1181
+ * THE FROG CASTING, not the V. Measured consistently the frogs are at 4.75″,
1182
+ * 4³⁄₁₆″ and 5.5″ — all different.
1154
1183
  *
1155
1184
  * The definition is the reason: #N fixes the DIVERGENCE RATE AT THE FROG (1
1156
1185
  * across per N along) and says NOTHING about how much tie strip the manufacturer
@@ -1165,9 +1194,19 @@ declare function trackPart(id: string, library?: TrackPart[]): TrackPart | null;
1165
1194
  /** The closest built-in turnout for a frog number — what a bare `size` maps to
1166
1195
  * when a turnout names no part. Exact match wins; otherwise the nearest frog. */
1167
1196
  declare function turnoutPartForSize(size: number, library?: TrackPart[]): TrackPart | null;
1168
- /** The lead to draw a turnout of this size with — a real part's measurement when
1169
- * we have one, else the per-frog rule. Keeps `frogLegOf` honest without it
1170
- * needing to know the library exists. */
1197
+ /**
1198
+ * The lead to draw a turnout of this size with. Keeps `frogLegOf` honest without
1199
+ * it needing to know the library exists.
1200
+ *
1201
+ * 1. An exact part match wins — a #7's measurement says nothing about a #4.
1202
+ * 2. Otherwise INTERPOLATE piecewise-linearly across the measured parts. This
1203
+ * replaced `size × TURNOUT_LEAD_INCHES_PER_FROG`, which was refuted (its
1204
+ * error changes sign across the measured range) and is now baseless besides,
1205
+ * its founding #7 measurement having been superseded.
1206
+ * 3. ⚠️ Outside the measured range the end segments EXTRAPOLATE. Measured leads
1207
+ * span N = 5…10, so a #4 or #12 is a projection, not a reading, and the #2.5
1208
+ * wye is a long way out. Treat those as placeholders until a part is measured.
1209
+ */
1171
1210
  declare function leadInchesForSize(size: number, library?: TrackPart[]): number;
1172
1211
  /** One drawn piece of a part's geometry, in the part's own local frame. */
1173
1212
  type PartSegment = {
package/dist/index.js CHANGED
@@ -1111,6 +1111,11 @@ var ATLAS_CODE55_N = [
1111
1111
  source: "measured",
1112
1112
  note: "Will Gage, physical Atlas 2050 (#5 LH) \u2014 end of tie strip to point tips"
1113
1113
  },
1114
+ frogOffset: {
1115
+ inches: 4.75,
1116
+ source: "measured",
1117
+ note: "Will Gage, physical Atlas 2050 (#5 LH) \u2014 tie end to the apex of the V"
1118
+ },
1114
1119
  overallLength: {
1115
1120
  inches: 6,
1116
1121
  source: "measured",
@@ -1132,9 +1137,19 @@ var ATLAS_CODE55_N = [
1132
1137
  partNumbers: { left: "2052", right: "2053" },
1133
1138
  frogNumber: 7,
1134
1139
  lead: {
1135
- inches: 3.375,
1140
+ inches: 3.59375,
1141
+ source: "measured",
1142
+ 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."
1143
+ },
1144
+ pointsOffset: {
1145
+ inches: 0.625,
1136
1146
  source: "measured",
1137
- note: "Steve Branton, physical Atlas code 55 #7, 3\u215C\u2033 points\u2192frog (#173)"
1147
+ note: "Will Gage, physical Atlas 2052 (#7) \u2014 \xB9\u2070\u2044\u2081\u2086\u2033 tie end to point tips"
1148
+ },
1149
+ frogOffset: {
1150
+ inches: 4.21875,
1151
+ source: "measured",
1152
+ 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."
1138
1153
  },
1139
1154
  overallLength: {
1140
1155
  inches: 6,
@@ -1157,15 +1172,20 @@ var ATLAS_CODE55_N = [
1157
1172
  partNumbers: { left: "2054", right: "2055" },
1158
1173
  frogNumber: 10,
1159
1174
  lead: {
1160
- inches: 4.1875,
1175
+ inches: 4.9375,
1161
1176
  source: "measured",
1162
- note: "Will Gage, physical Atlas 2054 (#10): points at 9/16\u2033 from the end, frog at 4.75\u2033 \u21D2 4\xB3\u2044\u2081\u2086\u2033. THIS IS THE MEASUREMENT THAT REFUTED the lead-per-frog rule \u2014 it predicted 4.82\u2033, 13% over."
1177
+ note: "Will Gage, physical Atlas 2054 (#10): 5.5\u2033 frog \u2212 9/16\u2033 points = 4\xB9\u2075\u2044\u2081\u2086\u2033. \u26A0\uFE0F CORRECTED from 4\xB3\u2044\u2081\u2086\u2033 (0.53.0\u20130.54.0), which used a 4.75\u2033 frog reading taken before we'd agreed the landmark. That earlier figure was the END OF THE FROG CASTING; a #10's V is shallow, so the apex is \xBE\u2033 back from it."
1163
1178
  },
1164
1179
  pointsOffset: {
1165
1180
  inches: 0.5625,
1166
1181
  source: "measured",
1167
1182
  note: "Will Gage, physical Atlas 2054 (#10) \u2014 end of tie strip to point tips"
1168
1183
  },
1184
+ frogOffset: {
1185
+ inches: 5.5,
1186
+ source: "measured",
1187
+ note: "Will Gage, physical Atlas 2054 (#10) \u2014 tie end to the apex of the V"
1188
+ },
1169
1189
  overallLength: {
1170
1190
  inches: 8,
1171
1191
  source: "measured",
@@ -1215,10 +1235,24 @@ function turnoutPartForSize(size, library = BUILT_IN_TRACK_PARTS) {
1215
1235
  (best, p) => Math.abs(p.frogNumber - size) < Math.abs(best.frogNumber - size) ? p : best
1216
1236
  );
1217
1237
  }
1238
+ function measuredLeadPoints(library) {
1239
+ return library.filter(
1240
+ (p) => p.kind === "turnout" && p.frogNumber != null && p.lead?.source === "measured"
1241
+ ).map((p) => ({ n: p.frogNumber, lead: p.lead.inches })).sort((a, b) => a.n - b.n);
1242
+ }
1218
1243
  function leadInchesForSize(size, library = BUILT_IN_TRACK_PARTS) {
1219
1244
  const part = turnoutPartForSize(size, library);
1220
1245
  if (part?.lead && part.frogNumber === size) return part.lead.inches;
1221
- return size * TURNOUT_LEAD_INCHES_PER_FROG;
1246
+ const pts = measuredLeadPoints(library);
1247
+ if (!pts.length) return size * TURNOUT_LEAD_INCHES_PER_FROG;
1248
+ if (pts.length === 1) return size / pts[0].n * pts[0].lead;
1249
+ let i;
1250
+ if (size >= pts[pts.length - 1].n) i = pts.length - 2;
1251
+ else i = Math.max(0, pts.findIndex((p) => p.n >= size) - 1);
1252
+ const lo = pts[i];
1253
+ const hi = pts[i + 1];
1254
+ const t = (size - lo.n) / (hi.n - lo.n);
1255
+ return lo.lead + t * (hi.lead - lo.lead);
1222
1256
  }
1223
1257
  function parseXtpLibrary(text) {
1224
1258
  const parts = [];