@willcgage/module-schematic 0.91.0 → 0.92.1
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 +48 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -100,6 +100,17 @@ declare const FREEMO_TRACK_SPACING_INCHES = 1.125;
|
|
|
100
100
|
/** Free-moN §2.0 **standard**: track crossing an endplate must be "not less than
|
|
101
101
|
* 4 inches from either fascia" (and perpendicular, straight and level for 4″). */
|
|
102
102
|
declare const FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES = 4;
|
|
103
|
+
/**
|
|
104
|
+
* Free-moN **standard**: minimum MAIN-LINE radius, 22″.
|
|
105
|
+
*
|
|
106
|
+
* ⚠️ The main line only. A spur, a yard lead or an industrial track may be
|
|
107
|
+
* tighter, and telling an owner their yard is out of spec because it is not a
|
|
108
|
+
* main would be worse than saying nothing.
|
|
109
|
+
*/
|
|
110
|
+
declare const FREEMO_MAIN_MIN_RADIUS_INCHES = 22;
|
|
111
|
+
/** Free-moN **standard**: at least 6″ of straight track between REVERSE curves,
|
|
112
|
+
* so a train is never asked to change hands instantly. */
|
|
113
|
+
declare const FREEMO_REVERSE_CURVE_STRAIGHT_INCHES = 6;
|
|
103
114
|
/**
|
|
104
115
|
* A stretch where a pair of parallel tracks runs at something other than the
|
|
105
116
|
* standard spacing, because a rigid assembly built to another spacing sits in
|
|
@@ -2465,8 +2476,27 @@ interface TrackPiece {
|
|
|
2465
2476
|
rotationDeg: number;
|
|
2466
2477
|
/** Mirrored across its own through route — a left-hand turnout from a right. */
|
|
2467
2478
|
flipped?: boolean;
|
|
2468
|
-
/** FLEX ONLY: how long this run is. The one piece a builder cuts (ADR 0001).
|
|
2479
|
+
/** FLEX ONLY: how long this run is. The one piece a builder cuts (ADR 0001).
|
|
2480
|
+
* ⚠️ ARC length when the run is bent — the rail, not the chord across it. */
|
|
2469
2481
|
lengthInches?: number;
|
|
2482
|
+
/**
|
|
2483
|
+
* FLEX ONLY: the radius this run is bent to, inches. Absent = straight.
|
|
2484
|
+
*
|
|
2485
|
+
* ⭐ It lives on the PIECE, not the part, because bending flex is what a
|
|
2486
|
+
* builder does to it — the product is the same product either way. That is
|
|
2487
|
+
* the same reason `lengthInches` is here.
|
|
2488
|
+
*
|
|
2489
|
+
* ⭐ SIGNED, and the sign IS the side: positive curves toward +y in the
|
|
2490
|
+
* piece's own frame, negative the other way. One number, no separate
|
|
2491
|
+
* "direction" field to disagree with it — the same reasoning that keeps a
|
|
2492
|
+
* hand off turnouts, where the side is simply where the piece is.
|
|
2493
|
+
*
|
|
2494
|
+
* ⚠️ {@link lengthInches} stays the ARC length. `pos` is arc length
|
|
2495
|
+
* everywhere in this model, a curve's rail is genuinely longer than the chord
|
|
2496
|
+
* it spans (a 90° corner at R30 runs 47.1″ across a 42.4″ chord), and it is
|
|
2497
|
+
* the rail a train travels.
|
|
2498
|
+
*/
|
|
2499
|
+
radiusInches?: number;
|
|
2470
2500
|
/** Owner's label, carried onto whatever route this piece ends up in. */
|
|
2471
2501
|
name?: string;
|
|
2472
2502
|
}
|
|
@@ -2519,6 +2549,19 @@ interface TrackGraph {
|
|
|
2519
2549
|
* tight enough that nothing joins by accident, loose enough to absorb the
|
|
2520
2550
|
* rounding of a drag. */
|
|
2521
2551
|
declare const JOINT_SNAP_INCHES = 0.01;
|
|
2552
|
+
/**
|
|
2553
|
+
* Where a bent run's far end lands, and which way it points — in the piece's own
|
|
2554
|
+
* frame, starting at its origin heading +x.
|
|
2555
|
+
*
|
|
2556
|
+
* ONE definition, called by both {@link placedJoints} and
|
|
2557
|
+
* {@link pieceRoutePaths}, so the drawn rail cannot arrive anywhere other than
|
|
2558
|
+
* the joint at the end of it.
|
|
2559
|
+
*/
|
|
2560
|
+
declare function flexRunEnd(lengthInches: number, radiusInches?: number): {
|
|
2561
|
+
x: number;
|
|
2562
|
+
y: number;
|
|
2563
|
+
headingDeg: number;
|
|
2564
|
+
};
|
|
2522
2565
|
/** Every piece's joints, transformed onto the board. */
|
|
2523
2566
|
declare function placedJoints(pieces: TrackPiece[], library?: TrackPart[]): PlacedJoint[];
|
|
2524
2567
|
/**
|
|
@@ -2986,4 +3029,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
2986
3029
|
heading: number;
|
|
2987
3030
|
}>;
|
|
2988
3031
|
|
|
2989
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, 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 EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, 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 OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3032
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, 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 EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, 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 OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,17 @@ declare const FREEMO_TRACK_SPACING_INCHES = 1.125;
|
|
|
100
100
|
/** Free-moN §2.0 **standard**: track crossing an endplate must be "not less than
|
|
101
101
|
* 4 inches from either fascia" (and perpendicular, straight and level for 4″). */
|
|
102
102
|
declare const FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES = 4;
|
|
103
|
+
/**
|
|
104
|
+
* Free-moN **standard**: minimum MAIN-LINE radius, 22″.
|
|
105
|
+
*
|
|
106
|
+
* ⚠️ The main line only. A spur, a yard lead or an industrial track may be
|
|
107
|
+
* tighter, and telling an owner their yard is out of spec because it is not a
|
|
108
|
+
* main would be worse than saying nothing.
|
|
109
|
+
*/
|
|
110
|
+
declare const FREEMO_MAIN_MIN_RADIUS_INCHES = 22;
|
|
111
|
+
/** Free-moN **standard**: at least 6″ of straight track between REVERSE curves,
|
|
112
|
+
* so a train is never asked to change hands instantly. */
|
|
113
|
+
declare const FREEMO_REVERSE_CURVE_STRAIGHT_INCHES = 6;
|
|
103
114
|
/**
|
|
104
115
|
* A stretch where a pair of parallel tracks runs at something other than the
|
|
105
116
|
* standard spacing, because a rigid assembly built to another spacing sits in
|
|
@@ -2465,8 +2476,27 @@ interface TrackPiece {
|
|
|
2465
2476
|
rotationDeg: number;
|
|
2466
2477
|
/** Mirrored across its own through route — a left-hand turnout from a right. */
|
|
2467
2478
|
flipped?: boolean;
|
|
2468
|
-
/** FLEX ONLY: how long this run is. The one piece a builder cuts (ADR 0001).
|
|
2479
|
+
/** FLEX ONLY: how long this run is. The one piece a builder cuts (ADR 0001).
|
|
2480
|
+
* ⚠️ ARC length when the run is bent — the rail, not the chord across it. */
|
|
2469
2481
|
lengthInches?: number;
|
|
2482
|
+
/**
|
|
2483
|
+
* FLEX ONLY: the radius this run is bent to, inches. Absent = straight.
|
|
2484
|
+
*
|
|
2485
|
+
* ⭐ It lives on the PIECE, not the part, because bending flex is what a
|
|
2486
|
+
* builder does to it — the product is the same product either way. That is
|
|
2487
|
+
* the same reason `lengthInches` is here.
|
|
2488
|
+
*
|
|
2489
|
+
* ⭐ SIGNED, and the sign IS the side: positive curves toward +y in the
|
|
2490
|
+
* piece's own frame, negative the other way. One number, no separate
|
|
2491
|
+
* "direction" field to disagree with it — the same reasoning that keeps a
|
|
2492
|
+
* hand off turnouts, where the side is simply where the piece is.
|
|
2493
|
+
*
|
|
2494
|
+
* ⚠️ {@link lengthInches} stays the ARC length. `pos` is arc length
|
|
2495
|
+
* everywhere in this model, a curve's rail is genuinely longer than the chord
|
|
2496
|
+
* it spans (a 90° corner at R30 runs 47.1″ across a 42.4″ chord), and it is
|
|
2497
|
+
* the rail a train travels.
|
|
2498
|
+
*/
|
|
2499
|
+
radiusInches?: number;
|
|
2470
2500
|
/** Owner's label, carried onto whatever route this piece ends up in. */
|
|
2471
2501
|
name?: string;
|
|
2472
2502
|
}
|
|
@@ -2519,6 +2549,19 @@ interface TrackGraph {
|
|
|
2519
2549
|
* tight enough that nothing joins by accident, loose enough to absorb the
|
|
2520
2550
|
* rounding of a drag. */
|
|
2521
2551
|
declare const JOINT_SNAP_INCHES = 0.01;
|
|
2552
|
+
/**
|
|
2553
|
+
* Where a bent run's far end lands, and which way it points — in the piece's own
|
|
2554
|
+
* frame, starting at its origin heading +x.
|
|
2555
|
+
*
|
|
2556
|
+
* ONE definition, called by both {@link placedJoints} and
|
|
2557
|
+
* {@link pieceRoutePaths}, so the drawn rail cannot arrive anywhere other than
|
|
2558
|
+
* the joint at the end of it.
|
|
2559
|
+
*/
|
|
2560
|
+
declare function flexRunEnd(lengthInches: number, radiusInches?: number): {
|
|
2561
|
+
x: number;
|
|
2562
|
+
y: number;
|
|
2563
|
+
headingDeg: number;
|
|
2564
|
+
};
|
|
2522
2565
|
/** Every piece's joints, transformed onto the board. */
|
|
2523
2566
|
declare function placedJoints(pieces: TrackPiece[], library?: TrackPart[]): PlacedJoint[];
|
|
2524
2567
|
/**
|
|
@@ -2986,4 +3029,4 @@ declare function poseOverridesFromDoc(doc: ModuleSchematicDoc): Record<string, {
|
|
|
2986
3029
|
heading: number;
|
|
2987
3030
|
}>;
|
|
2988
3031
|
|
|
2989
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, 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 EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, 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 OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3032
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, type BenchworkPoint, type BranchConnector, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, 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 EndplateEdge, type EndplateEdgePose, type EndplatePose, type EndplateTrackIssue, type EndplateWidthIssue, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, type FlexPiece, type FlexPieceEnd, type FrogCasting, type GeometryType, type GraphAnchor, type GraphConflict, type GraphConnection, type GraphDocInput, type GraphDocResult, type GraphRoute, type GraphTurnout, type GraphWalk, type ImportedPart, type IndustryLabelMode, type IndustrySpot, JOINT_SNAP_INCHES, type LanePinch, 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 OccupiedSpan, type OutlineFace, PINCH_EASE_INCHES, type PartAngle, type PartDimension, type PartEnd, type PartExtent, type PartGeometry, type PartJoint, type PartJointRole, type PartSegment, type PieceSnap, type PlacedJoint, RAIL_GAUGE_INCHES, type ResolvedAnchor, type ReturnLoopGeometry, type ReturnLoopShape, type RouteSpan, type SchematicBlock, type SchematicControlPoint, type SchematicCrossing, type SchematicEndplate, type SchematicEndplateTrack, type SchematicIndustry, type SchematicSection, type SchematicSignal, type SchematicTrack, type SchematicTurnout, type SectionAdjacency, type SectionEnd, type SectionEndAssessment, type SectionFootprint, type SectionJointAssessment, type SectionRelativePos, type SignalFacing, type SignalSide, type SpanOverhang, type StoredTrackPart, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, type TrackConfig, type TrackGraph, type TrackPart, type TrackPiece, type TrackRole, type TurnoutClosure, type TurnoutKind, type UsableCapacity, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ var FREEMO_ENDPLATE_WIDTH_MIN_INCHES = 12;
|
|
|
3
3
|
var FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES = 24;
|
|
4
4
|
var FREEMO_TRACK_SPACING_INCHES = 1.125;
|
|
5
5
|
var FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES = 4;
|
|
6
|
+
var FREEMO_MAIN_MIN_RADIUS_INCHES = 22;
|
|
7
|
+
var FREEMO_REVERSE_CURVE_STRAIGHT_INCHES = 6;
|
|
6
8
|
var PINCH_EASE_INCHES = 3;
|
|
7
9
|
function laneOffsetAt(lane, pos, pinches, spacingInches = FREEMO_TRACK_SPACING_INCHES) {
|
|
8
10
|
const base = (lane ?? 0) * spacingInches;
|
|
@@ -2266,8 +2268,16 @@ function pieceRoutePaths(piece, library = BUILT_IN_TRACK_PARTS) {
|
|
|
2266
2268
|
const b = at(route[1]);
|
|
2267
2269
|
if (!a || !b) continue;
|
|
2268
2270
|
const ends = [{ x: a.x, y: a.y }, { x: b.x, y: b.y }];
|
|
2271
|
+
if (part.kind === "flex") {
|
|
2272
|
+
const pts2 = flexRunPoints(piece.lengthInches ?? 0, piece.radiusInches).map(
|
|
2273
|
+
(q) => place(q.x, q.y)
|
|
2274
|
+
);
|
|
2275
|
+
pts2[pts2.length - 1] = { x: b.x, y: b.y };
|
|
2276
|
+
out.push({ route, points: pts2 });
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2269
2279
|
const diverging = route.some((r) => r === "diverge" || r === "legA" || r === "legB");
|
|
2270
|
-
if (!diverging
|
|
2280
|
+
if (!diverging) {
|
|
2271
2281
|
out.push({ route, points: ends });
|
|
2272
2282
|
continue;
|
|
2273
2283
|
}
|
|
@@ -2306,6 +2316,25 @@ function partsPlaceable(library = BUILT_IN_TRACK_PARTS) {
|
|
|
2306
2316
|
return { placeable, blocked };
|
|
2307
2317
|
}
|
|
2308
2318
|
var JOINT_SNAP_INCHES = 0.01;
|
|
2319
|
+
function flexRunEnd(lengthInches, radiusInches) {
|
|
2320
|
+
const L = lengthInches;
|
|
2321
|
+
const R = radiusInches;
|
|
2322
|
+
if (!R || !Number.isFinite(R) || Math.abs(R) < 1e-6)
|
|
2323
|
+
return { x: L, y: 0, headingDeg: 0 };
|
|
2324
|
+
const theta = L / R;
|
|
2325
|
+
return {
|
|
2326
|
+
x: Math.abs(R) * Math.sin(Math.abs(theta)) * Math.sign(L || 1),
|
|
2327
|
+
y: R * (1 - Math.cos(theta)),
|
|
2328
|
+
headingDeg: theta * 180 / Math.PI
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
function flexRunPoints(lengthInches, radiusInches, steps = 16) {
|
|
2332
|
+
if (!radiusInches || !Number.isFinite(radiusInches) || Math.abs(radiusInches) < 1e-6)
|
|
2333
|
+
return [{ x: 0, y: 0 }, { x: lengthInches, y: 0 }];
|
|
2334
|
+
const out = [];
|
|
2335
|
+
for (let i = 0; i <= steps; i++) out.push(flexRunEnd(lengthInches * i / steps, radiusInches));
|
|
2336
|
+
return out.map((p) => ({ x: p.x, y: p.y }));
|
|
2337
|
+
}
|
|
2309
2338
|
function placedJoints(pieces, library = BUILT_IN_TRACK_PARTS) {
|
|
2310
2339
|
const out = [];
|
|
2311
2340
|
const RAD = Math.PI / 180;
|
|
@@ -2316,10 +2345,13 @@ function placedJoints(pieces, library = BUILT_IN_TRACK_PARTS) {
|
|
|
2316
2345
|
if (!geo) continue;
|
|
2317
2346
|
const c = Math.cos(p.rotationDeg * RAD);
|
|
2318
2347
|
const s = Math.sin(p.rotationDeg * RAD);
|
|
2348
|
+
const run = part.kind === "flex" ? flexRunEnd(p.lengthInches ?? 0, p.radiusInches) : null;
|
|
2319
2349
|
for (const j of geo.joints) {
|
|
2320
|
-
const
|
|
2321
|
-
const
|
|
2322
|
-
const
|
|
2350
|
+
const far = run && j.id === "b";
|
|
2351
|
+
const lx = far ? run.x : j.x;
|
|
2352
|
+
const ly = p.flipped ? -(far ? run.y : j.y) : far ? run.y : j.y;
|
|
2353
|
+
const local = far ? run.headingDeg : j.angleDeg;
|
|
2354
|
+
const h = (p.flipped ? -local : local) + p.rotationDeg;
|
|
2323
2355
|
out.push({
|
|
2324
2356
|
key: `${p.id}.${j.id}`,
|
|
2325
2357
|
piece: p.id,
|
|
@@ -2425,7 +2457,15 @@ function walkTrackGraph(graph, pieces, startAt, library = BUILT_IN_TRACK_PARTS)
|
|
|
2425
2457
|
const part = partOf(pid);
|
|
2426
2458
|
return part ? partGeometry(part, library) : null;
|
|
2427
2459
|
};
|
|
2428
|
-
const gap = (a, b) =>
|
|
2460
|
+
const gap = (a, b) => {
|
|
2461
|
+
if (!a || !b) return 0;
|
|
2462
|
+
if (a.piece === b.piece) {
|
|
2463
|
+
const piece = pieceById.get(a.piece);
|
|
2464
|
+
const part = piece ? partOf(a.piece) : void 0;
|
|
2465
|
+
if (piece && part?.kind === "flex") return piece.lengthInches ?? 0;
|
|
2466
|
+
}
|
|
2467
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
2468
|
+
};
|
|
2429
2469
|
const routes = [];
|
|
2430
2470
|
const turnouts = [];
|
|
2431
2471
|
const warnings = [];
|
|
@@ -3325,6 +3365,6 @@ function poseOverridesFromDoc(doc) {
|
|
|
3325
3365
|
return out;
|
|
3326
3366
|
}
|
|
3327
3367
|
|
|
3328
|
-
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_TRACK_SPACING_INCHES, JOINT_SNAP_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, PINCH_EASE_INCHES, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3368
|
+
export { ATLAS_CODE55_N, BUILT_IN_TRACK_PARTS, CLEARANCE_SPACING_INCHES, CODE55_RAIL_HEIGHT_INCHES, DEFAULT_FLEX_PART_ID, ENDPLATE_FASCIA_CLEAR_INCHES, ENDPLATE_LEAD_INCHES, FAST_TRACKS_N_ME55, FAST_TRACKS_N_ME55_CROSSOVERS, FLEX_TRACK_PARTS, FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES, FREEMO_ENDPLATE_WIDTH_MIN_INCHES, FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES, FREEMO_MAIN_MIN_RADIUS_INCHES, FREEMO_REVERSE_CURVE_STRAIGHT_INCHES, FREEMO_TRACK_SPACING_INCHES, JOINT_SNAP_INCHES, MAIN2_TRACK_ID, MAIN_TRACK_ID, N_CAR_LENGTH_INCHES, N_SCALE_RATIO, PINCH_EASE_INCHES, RAIL_GAUGE_INCHES, TIE_HALF_LENGTH_INCHES, TURNOUT_LEAD_INCHES_PER_FROG, WHOLE_MODULE_SECTION_ID, asModuleSchematic, assessSectionEnd, assessSectionJoint, benchworkBand, benchworkOutline, buildCrossover, buildPassingSiding, buildTrackGraph, buildTransition, carCapacity, checkEndplateWidth, clearancePointPastFrogInches, crossoverPinches, deriveEndplatePoses, deriveGraphDoc, divergeSideForHand, docToState, emptyEditorState, endplateCentreOffsetInches, endplateEdgePose, endplateFaceSegments, endplateLead, endplateTrackOffsetInches, endplateWidthInches, flexPartFor, flexParts, flexPieces, flexRunEnd, flexUsage, frogCasting, frogNumberFromName, fromSectionRelative, geometryTurnDegrees, graphToDoc, hasNoFarEndplate, importedPartToTrackPart, inchesToScaleFeet, isLoopDoc, isTransitionTurnout, laneOffsetAt, leadInchesForSize, maxFlexPieceInches, mergeImportedParts, mergeStoredParts, moduleCenterline, moduleFeatures, moduleFootprint, moduleLengthFromSections, moduleSections, nextId, parseXtpLibrary, partExtent, partExtentForSize, partGeometry, partGeometryGap, partOutlineAtFrog, partsPlaceable, pastFrogInchesForSize, pathLengthInches, pieceRoutePaths, placedJoints, poseNeedsManual, poseOverridesFromDoc, remapPos, resizeFlexPiece, resolveGraphAnchor, returnLoop, sampleBenchworkOutline, samplePartSegments, samplePath, scaleFeetToInches, sectionAdjacency, sectionBand, sectionBreaksFromSections, sectionComponents, sectionFootprints, sectionNeighbours, sectionSpans, sectionSpansOrWhole, sectionedCenterline, sectionedEndPose, sliceCenterline, snapPiece, spanOverhang, stateToDoc, storedPartToTrackPart, toSectionRelative, trackMeetsEndplateIssues, trackPart, trackPath, turnoutClosure, turnoutFacing, turnoutOccupiedSpan, turnoutPartForSize, usableCapacity, walkTrackGraph };
|
|
3329
3369
|
//# sourceMappingURL=index.js.map
|
|
3330
3370
|
//# sourceMappingURL=index.js.map
|