@willcgage/module-schematic 0.58.0 → 0.60.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 +51 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +51 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1354,11 +1354,77 @@ interface TurnoutClosure {
|
|
|
1354
1354
|
switchSlope: number;
|
|
1355
1355
|
/** Slope at and beyond the frog — the frog angle, 1/N. */
|
|
1356
1356
|
frogSlope: number;
|
|
1357
|
+
/** Total run from the points to where the route arrives PARALLEL at
|
|
1358
|
+
* `arriveAtInches`. Infinity when no target was given (the legacy
|
|
1359
|
+
* straight-forever behaviour). Use this rather than solving for the offset:
|
|
1360
|
+
* solving finds where the route REACHES the lane, not where it arrives
|
|
1361
|
+
* parallel, and the difference is a visible kink. */
|
|
1362
|
+
span: number;
|
|
1363
|
+
/** Length of the easing curve, 0 when not easing. */
|
|
1364
|
+
easeInches: number;
|
|
1357
1365
|
}
|
|
1358
1366
|
declare function turnoutClosure(size: number, opts?: {
|
|
1359
1367
|
leadInches?: number;
|
|
1360
1368
|
gaugeInches?: number;
|
|
1369
|
+
/**
|
|
1370
|
+
* Lateral offset the diverging route must ARRIVE AT, PARALLEL — normally
|
|
1371
|
+
* one lane spacing, i.e. the track it feeds.
|
|
1372
|
+
*
|
|
1373
|
+
* ⚠️ Without this the route runs straight at the frog angle forever, and a
|
|
1374
|
+
* caller can only solve for where it first REACHES the offset. Reaching is
|
|
1375
|
+
* not arriving: it gets there still climbing at 1/N while the track it
|
|
1376
|
+
* joins runs parallel, so the two meet with an instantaneous change of
|
|
1377
|
+
* direction. That KINK is what reads as "the rails don't line up" — each
|
|
1378
|
+
* rail is offset perpendicular to its own heading, so at a kink the two
|
|
1379
|
+
* rails meet at different points.
|
|
1380
|
+
*/
|
|
1381
|
+
arriveAtInches?: number;
|
|
1382
|
+
/** Length of the easing curve. Defaults to one lead, which puts the radius
|
|
1383
|
+
* around 25″ on a #7 — clear of the Free-moN 22″ minimum. */
|
|
1384
|
+
easeInches?: number;
|
|
1361
1385
|
}): TurnoutClosure;
|
|
1386
|
+
/** A frog casting's parts, in TURNOUT-LOCAL inches: `x` = distance past the
|
|
1387
|
+
* points, `y` = lateral offset from the through route. */
|
|
1388
|
+
interface FrogCasting {
|
|
1389
|
+
/** The point rail — the acute V, apex at the crossing, opening toward the
|
|
1390
|
+
* diverging end. Three points: through leg, apex, diverging leg. */
|
|
1391
|
+
point: Array<{
|
|
1392
|
+
x: number;
|
|
1393
|
+
y: number;
|
|
1394
|
+
}>;
|
|
1395
|
+
/** The two wing rails flanking the point, each a short polyline. */
|
|
1396
|
+
wings: Array<Array<{
|
|
1397
|
+
x: number;
|
|
1398
|
+
y: number;
|
|
1399
|
+
}>>;
|
|
1400
|
+
/** The apex — where the two inner rails actually cross. */
|
|
1401
|
+
apex: {
|
|
1402
|
+
x: number;
|
|
1403
|
+
y: number;
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* The frog casting at a turnout's crossing.
|
|
1408
|
+
*
|
|
1409
|
+
* The apex is where the two INNER rails cross, which is HALF a gauge off the
|
|
1410
|
+
* through centre-line (the through inner rail sits at +g/2, the diverging inner
|
|
1411
|
+
* rail at d−g/2, and d = g at the frog). Not one full gauge — that is the
|
|
1412
|
+
* diverging CENTRE-line, and putting the casting there floats it clear of the
|
|
1413
|
+
* rails it is made of.
|
|
1414
|
+
*
|
|
1415
|
+
* ⚠️ **The flangeway is EXAGGERATED and that is deliberate.** True scale in N is
|
|
1416
|
+
* about 0.011″ (prototype 1¾″ ÷ 160) — one pixel in a close-up render and
|
|
1417
|
+
* invisible at module zoom. Drawn to scale the wing rails would sit exactly on
|
|
1418
|
+
* the running rails and add nothing. `flangewayInches` defaults to a readable
|
|
1419
|
+
* fraction of the gauge instead; pass the true figure if you ever need it.
|
|
1420
|
+
*/
|
|
1421
|
+
declare function frogCasting(cl: TurnoutClosure, opts?: {
|
|
1422
|
+
gaugeInches?: number;
|
|
1423
|
+
/** How far the casting runs either side of the apex. */
|
|
1424
|
+
reachInches?: number;
|
|
1425
|
+
/** See the warning above — exaggerated for legibility by default. */
|
|
1426
|
+
flangewayInches?: number;
|
|
1427
|
+
}): FrogCasting;
|
|
1362
1428
|
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number,
|
|
1363
1429
|
/** The turnout is installed the other way round — the points face the far
|
|
1364
1430
|
* direction, which swaps the side the diverging route leaves on. */
|
|
@@ -1517,4 +1583,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1517
1583
|
heading: number;
|
|
1518
1584
|
}>;
|
|
1519
1585
|
|
|
1520
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
1586
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -1354,11 +1354,77 @@ interface TurnoutClosure {
|
|
|
1354
1354
|
switchSlope: number;
|
|
1355
1355
|
/** Slope at and beyond the frog — the frog angle, 1/N. */
|
|
1356
1356
|
frogSlope: number;
|
|
1357
|
+
/** Total run from the points to where the route arrives PARALLEL at
|
|
1358
|
+
* `arriveAtInches`. Infinity when no target was given (the legacy
|
|
1359
|
+
* straight-forever behaviour). Use this rather than solving for the offset:
|
|
1360
|
+
* solving finds where the route REACHES the lane, not where it arrives
|
|
1361
|
+
* parallel, and the difference is a visible kink. */
|
|
1362
|
+
span: number;
|
|
1363
|
+
/** Length of the easing curve, 0 when not easing. */
|
|
1364
|
+
easeInches: number;
|
|
1357
1365
|
}
|
|
1358
1366
|
declare function turnoutClosure(size: number, opts?: {
|
|
1359
1367
|
leadInches?: number;
|
|
1360
1368
|
gaugeInches?: number;
|
|
1369
|
+
/**
|
|
1370
|
+
* Lateral offset the diverging route must ARRIVE AT, PARALLEL — normally
|
|
1371
|
+
* one lane spacing, i.e. the track it feeds.
|
|
1372
|
+
*
|
|
1373
|
+
* ⚠️ Without this the route runs straight at the frog angle forever, and a
|
|
1374
|
+
* caller can only solve for where it first REACHES the offset. Reaching is
|
|
1375
|
+
* not arriving: it gets there still climbing at 1/N while the track it
|
|
1376
|
+
* joins runs parallel, so the two meet with an instantaneous change of
|
|
1377
|
+
* direction. That KINK is what reads as "the rails don't line up" — each
|
|
1378
|
+
* rail is offset perpendicular to its own heading, so at a kink the two
|
|
1379
|
+
* rails meet at different points.
|
|
1380
|
+
*/
|
|
1381
|
+
arriveAtInches?: number;
|
|
1382
|
+
/** Length of the easing curve. Defaults to one lead, which puts the radius
|
|
1383
|
+
* around 25″ on a #7 — clear of the Free-moN 22″ minimum. */
|
|
1384
|
+
easeInches?: number;
|
|
1361
1385
|
}): TurnoutClosure;
|
|
1386
|
+
/** A frog casting's parts, in TURNOUT-LOCAL inches: `x` = distance past the
|
|
1387
|
+
* points, `y` = lateral offset from the through route. */
|
|
1388
|
+
interface FrogCasting {
|
|
1389
|
+
/** The point rail — the acute V, apex at the crossing, opening toward the
|
|
1390
|
+
* diverging end. Three points: through leg, apex, diverging leg. */
|
|
1391
|
+
point: Array<{
|
|
1392
|
+
x: number;
|
|
1393
|
+
y: number;
|
|
1394
|
+
}>;
|
|
1395
|
+
/** The two wing rails flanking the point, each a short polyline. */
|
|
1396
|
+
wings: Array<Array<{
|
|
1397
|
+
x: number;
|
|
1398
|
+
y: number;
|
|
1399
|
+
}>>;
|
|
1400
|
+
/** The apex — where the two inner rails actually cross. */
|
|
1401
|
+
apex: {
|
|
1402
|
+
x: number;
|
|
1403
|
+
y: number;
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* The frog casting at a turnout's crossing.
|
|
1408
|
+
*
|
|
1409
|
+
* The apex is where the two INNER rails cross, which is HALF a gauge off the
|
|
1410
|
+
* through centre-line (the through inner rail sits at +g/2, the diverging inner
|
|
1411
|
+
* rail at d−g/2, and d = g at the frog). Not one full gauge — that is the
|
|
1412
|
+
* diverging CENTRE-line, and putting the casting there floats it clear of the
|
|
1413
|
+
* rails it is made of.
|
|
1414
|
+
*
|
|
1415
|
+
* ⚠️ **The flangeway is EXAGGERATED and that is deliberate.** True scale in N is
|
|
1416
|
+
* about 0.011″ (prototype 1¾″ ÷ 160) — one pixel in a close-up render and
|
|
1417
|
+
* invisible at module zoom. Drawn to scale the wing rails would sit exactly on
|
|
1418
|
+
* the running rails and add nothing. `flangewayInches` defaults to a readable
|
|
1419
|
+
* fraction of the gauge instead; pass the true figure if you ever need it.
|
|
1420
|
+
*/
|
|
1421
|
+
declare function frogCasting(cl: TurnoutClosure, opts?: {
|
|
1422
|
+
gaugeInches?: number;
|
|
1423
|
+
/** How far the casting runs either side of the apex. */
|
|
1424
|
+
reachInches?: number;
|
|
1425
|
+
/** See the warning above — exaggerated for legibility by default. */
|
|
1426
|
+
flangewayInches?: number;
|
|
1427
|
+
}): FrogCasting;
|
|
1362
1428
|
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number,
|
|
1363
1429
|
/** The turnout is installed the other way round — the points face the far
|
|
1364
1430
|
* direction, which swaps the side the diverging route leaves on. */
|
|
@@ -1517,4 +1583,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
1517
1583
|
heading: number;
|
|
1518
1584
|
}>;
|
|
1519
1585
|
|
|
1520
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
1586
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CODE55_RAIL_HEIGHT_INCHES, type DimensionSource, type DrawCrossing, type DrawCrossover, type DrawIndustry, type DrawSignal, type DrawTrack, type DrawTurnout, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, type EditorBranch, type EditorControlPoint, type EditorCpSignal, type EditorCrossing, type EditorIndustry, type EditorState, type EditorTrack, type EditorTurnout, type EndplateBConfig, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FrogCasting, type GeometryType, type ImportedPart, type IndustryLabelMode, type IndustrySpot, MAIN2_TRACK_ID, MAIN_TRACK_ID, type ModuleFeatures, type ModuleFootprint, type ModuleFootprintInput, type ModuleGeometryInput, type ModuleSchematicDoc, type ModuleTrackRow, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, type OutlineFace, type PartAngle, type PartDimension, type PartEnd, type PartSegment, RAIL_GAUGE_INCHES, type ReturnLoopGeometry, type ReturnLoopShape, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionFootprint, type SectionRelativePos, type SignalFacing, type SignalSide, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackPart, type TrackRole, type TurnoutClosure, type TurnoutKind, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
package/dist/index.js
CHANGED
|
@@ -1444,15 +1444,61 @@ function turnoutClosure(size, opts = {}) {
|
|
|
1444
1444
|
const frogSlope = 1 / N;
|
|
1445
1445
|
const k = (lead / N - g) / (lead * lead);
|
|
1446
1446
|
const switchSlope = Math.max(0, frogSlope - 2 * k * lead);
|
|
1447
|
+
const target = opts.arriveAtInches;
|
|
1448
|
+
let a = Infinity;
|
|
1449
|
+
let b = 0;
|
|
1450
|
+
if (target != null && target > g) {
|
|
1451
|
+
b = Math.max(0.01, opts.easeInches ?? lead);
|
|
1452
|
+
a = (target - g) / frogSlope - b / 2;
|
|
1453
|
+
if (a < 0) {
|
|
1454
|
+
a = 0;
|
|
1455
|
+
b = 2 * (target - g) / frogSlope;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
const span = target != null && target > g ? lead + a + b : Infinity;
|
|
1447
1459
|
return {
|
|
1448
1460
|
lead,
|
|
1449
1461
|
switchSlope,
|
|
1450
1462
|
frogSlope,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
offsetAt: (s) =>
|
|
1463
|
+
span,
|
|
1464
|
+
easeInches: b,
|
|
1465
|
+
offsetAt: (s) => {
|
|
1466
|
+
if (s <= lead) return switchSlope * s + k * s * s;
|
|
1467
|
+
const past = s - lead;
|
|
1468
|
+
if (past <= a) return g + frogSlope * past;
|
|
1469
|
+
if (target == null) return g + frogSlope * past;
|
|
1470
|
+
const u = Math.min(past - a, b);
|
|
1471
|
+
const eased = g + frogSlope * a + frogSlope * u - frogSlope * u * u / (2 * b);
|
|
1472
|
+
return past - a >= b ? target : eased;
|
|
1473
|
+
}
|
|
1454
1474
|
};
|
|
1455
1475
|
}
|
|
1476
|
+
function frogCasting(cl, opts = {}) {
|
|
1477
|
+
const g = opts.gaugeInches ?? RAIL_GAUGE_INCHES;
|
|
1478
|
+
const w = opts.reachInches ?? g * 1.5;
|
|
1479
|
+
const fw = opts.flangewayInches ?? g * 0.12;
|
|
1480
|
+
const m = cl.frogSlope;
|
|
1481
|
+
const lead = cl.lead;
|
|
1482
|
+
const apex = { x: lead, y: g / 2 };
|
|
1483
|
+
const point = [
|
|
1484
|
+
{ x: lead + w, y: g / 2 },
|
|
1485
|
+
apex,
|
|
1486
|
+
{ x: lead + w, y: g / 2 + m * w }
|
|
1487
|
+
];
|
|
1488
|
+
const wings = [
|
|
1489
|
+
[
|
|
1490
|
+
{ x: lead - w, y: g / 2 - fw },
|
|
1491
|
+
{ x: lead - w * 0.35, y: g / 2 - fw },
|
|
1492
|
+
{ x: lead + w * 0.35, y: g / 2 - fw * 0.5 }
|
|
1493
|
+
],
|
|
1494
|
+
[
|
|
1495
|
+
{ x: lead - w, y: g / 2 + m * -w + fw },
|
|
1496
|
+
{ x: lead - w * 0.35, y: g / 2 + m * -w * 0.35 + fw },
|
|
1497
|
+
{ x: lead + w * 0.35, y: g / 2 + m * w * 0.35 + fw * 0.5 }
|
|
1498
|
+
]
|
|
1499
|
+
];
|
|
1500
|
+
return { point, wings, apex };
|
|
1501
|
+
}
|
|
1456
1502
|
function divergeSideForHand(kind, stubDir, flipped) {
|
|
1457
1503
|
if (kind !== "left" && kind !== "right") return 0;
|
|
1458
1504
|
const s = (stubDir >= 0 ? 1 : -1) * (flipped ? -1 : 1);
|
|
@@ -1519,7 +1565,7 @@ function moduleFeatures(doc) {
|
|
|
1519
1565
|
if (parentLane === 0) {
|
|
1520
1566
|
const [from, to] = ext;
|
|
1521
1567
|
const far = Math.abs(to - sw.pos) >= Math.abs(from - sw.pos) ? to : from;
|
|
1522
|
-
const s = divergeSideForHand(sw.kind, far - sw.pos);
|
|
1568
|
+
const s = divergeSideForHand(sw.kind, far - sw.pos, sw.flipped);
|
|
1523
1569
|
sign = s !== 0 ? s : Math.sign(trk.lane) || 1;
|
|
1524
1570
|
} else {
|
|
1525
1571
|
sign = Math.sign(parentLane) || 1;
|
|
@@ -1966,6 +2012,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
1966
2012
|
return out;
|
|
1967
2013
|
}
|
|
1968
2014
|
|
|
1969
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CODE55_RAIL_HEIGHT_INCHES, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, RAIL_GAUGE_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
2015
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CODE55_RAIL_HEIGHT_INCHES, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, RAIL_GAUGE_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTransition, carCapacity, checkEndplateWidth, deriveEndplatePoses, divergeSideForHand, docToState, emptyEditorState, endplateFaceSegments, endplateLead, endplateTrackOffsetFor, endplateTrackOffsetInches, endplateWidthInches, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, leadInchesForSize, mergeImportedParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partOutlineAtFrog, poseNeedsManual, poseOverridesFromDoc, remapPos, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, stateToDoc, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutPartForSize };
|
|
1970
2016
|
//# sourceMappingURL=index.js.map
|
|
1971
2017
|
//# sourceMappingURL=index.js.map
|