@willcgage/module-schematic 0.32.0 → 0.33.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 +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -211,6 +211,24 @@ function sectionBreaksFromSections(doc) {
|
|
|
211
211
|
const spans = sectionSpans(doc);
|
|
212
212
|
return spans.slice(0, -1).map((sp) => sp.toPos);
|
|
213
213
|
}
|
|
214
|
+
function sectionedEndPose(doc) {
|
|
215
|
+
const secs = moduleSections(doc).filter(
|
|
216
|
+
(sec) => typeof sec.lengthInches === "number" && sec.lengthInches > 0
|
|
217
|
+
);
|
|
218
|
+
if (!secs.length) return null;
|
|
219
|
+
let ox = 0;
|
|
220
|
+
let oy = 0;
|
|
221
|
+
let heading = 0;
|
|
222
|
+
for (const sec of secs) {
|
|
223
|
+
const local = sectionCenterlineLocal(sec);
|
|
224
|
+
const c = Math.cos(heading * DEG_FP);
|
|
225
|
+
const sn = Math.sin(heading * DEG_FP);
|
|
226
|
+
ox += local.endX * c - local.endY * sn;
|
|
227
|
+
oy += local.endX * sn + local.endY * c;
|
|
228
|
+
heading += local.endHeadingDeg;
|
|
229
|
+
}
|
|
230
|
+
return { x: ox, y: oy, heading };
|
|
231
|
+
}
|
|
214
232
|
function sectionedCenterline(doc) {
|
|
215
233
|
const secs = moduleSections(doc).filter(
|
|
216
234
|
(sec) => typeof sec.lengthInches === "number" && sec.lengthInches > 0
|
|
@@ -1283,7 +1301,19 @@ function deriveEndplatePoses(geo) {
|
|
|
1283
1301
|
})
|
|
1284
1302
|
);
|
|
1285
1303
|
const noB = geo.geometryType === "dead_end";
|
|
1286
|
-
|
|
1304
|
+
const end = sectionedEndPose({ sections: geo.sections });
|
|
1305
|
+
if (!noB && end) {
|
|
1306
|
+
poses.push(
|
|
1307
|
+
withOverride({
|
|
1308
|
+
id: "B",
|
|
1309
|
+
x: end.x,
|
|
1310
|
+
y: end.y,
|
|
1311
|
+
heading: norm360(end.heading),
|
|
1312
|
+
trackConfig: cfg(1),
|
|
1313
|
+
trackOffsets: offsetsFor(cfg(1), half)
|
|
1314
|
+
})
|
|
1315
|
+
);
|
|
1316
|
+
} else if (!noB) {
|
|
1287
1317
|
const turn = geometryTurnDegrees(geo.geometryType, geo.geometryDegrees);
|
|
1288
1318
|
let bx;
|
|
1289
1319
|
let by;
|
|
@@ -1391,6 +1421,7 @@ exports.sectionFootprints = sectionFootprints;
|
|
|
1391
1421
|
exports.sectionNeighbours = sectionNeighbours;
|
|
1392
1422
|
exports.sectionSpans = sectionSpans;
|
|
1393
1423
|
exports.sectionedCenterline = sectionedCenterline;
|
|
1424
|
+
exports.sectionedEndPose = sectionedEndPose;
|
|
1394
1425
|
exports.sliceCenterline = sliceCenterline;
|
|
1395
1426
|
exports.stateToDoc = stateToDoc;
|
|
1396
1427
|
exports.trackPath = trackPath;
|