vehicle-path2 2.0.0 → 2.1.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/core/index.d.ts +1 -0
- package/dist/core/snapshot.d.ts +39 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +52 -33
- package/dist/index-D8o0W80x.js +732 -0
- package/dist/index-DfPg-M5u.cjs +1 -0
- package/dist/vehicle-path.cjs +1 -1
- package/dist/vehicle-path.js +31 -730
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { buildGraph, findPath, calculateBezierArcLength, resolveFromLineOffset,
|
|
|
19
19
|
export { initializeMovingVehicle, createInitialMovementState, initializeAllVehicles, calculateInitialAxlePositions, type InitializationResult, updateAxlePosition, calculatePositionOnLine, calculatePositionOnCurve, calculateFrontAxlePosition, getCumulativeArcLength, arcLengthToSegmentPosition, prepareCommandPath, type PreparedPath, handleArrival, type SegmentCompletionContext, type SegmentCompletionResult, type SegmentVehicleState, moveVehicle, getPositionFromOffset, getLineLength } from './algorithms/vehicleMovement';
|
|
20
20
|
export { PathEngine, type PathEngineConfig, type VehiclePathState, type PathExecution } from './engine';
|
|
21
21
|
export { distance, normalize, getPointOnLine, getPointOnLineByOffset, getPointOnBezier, createBezierCurve, buildArcLengthTable, distanceToT, getArcLength, calculateTangentLength, isPointNearPoint, type ArcLengthEntry, type CurveOffsetOptions } from './algorithms/math';
|
|
22
|
+
export { serializeScene, type SceneSnapshot } from './snapshot';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Line } from './types/geometry';
|
|
2
|
+
export interface SceneSnapshot {
|
|
3
|
+
lines: Line[];
|
|
4
|
+
curves: Array<{
|
|
5
|
+
id: string;
|
|
6
|
+
fromLineId: string;
|
|
7
|
+
toLineId: string;
|
|
8
|
+
fromOffset: number;
|
|
9
|
+
toOffset: number;
|
|
10
|
+
}>;
|
|
11
|
+
vehicles: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
axles: Array<{
|
|
14
|
+
lineId: string;
|
|
15
|
+
offset: number;
|
|
16
|
+
}>;
|
|
17
|
+
axleSpacings: number[];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Serialize scene state to a JSON string suitable for clipboard or storage.
|
|
22
|
+
* Strips derived fields (bezier curves, axle positions) — only source-of-truth
|
|
23
|
+
* data is included.
|
|
24
|
+
*/
|
|
25
|
+
export declare function serializeScene(lines: Line[], curves: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
fromLineId: string;
|
|
28
|
+
toLineId: string;
|
|
29
|
+
fromOffset: number;
|
|
30
|
+
toOffset: number;
|
|
31
|
+
}>, vehicles: Array<{
|
|
32
|
+
id: string;
|
|
33
|
+
axles: Array<{
|
|
34
|
+
lineId: string;
|
|
35
|
+
offset: number;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
axleSpacings: number[];
|
|
39
|
+
}>): string;
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DfPg-M5u.cjs");function r(n,a,o){const l={lines:n,curves:a.map(i=>({id:i.id,fromLineId:i.fromLineId,toLineId:i.toLineId,fromOffset:i.fromOffset,toOffset:i.toOffset})),vehicles:o.map(i=>({id:i.id,axles:i.axles.map(t=>({lineId:t.lineId,offset:t.offset})),axleSpacings:i.axleSpacings}))};return JSON.stringify(l,null,2)}exports.PathEngine=e.PathEngine;exports.arcLengthToSegmentPosition=e.arcLengthToSegmentPosition;exports.buildArcLengthTable=e.buildArcLengthTable;exports.buildGraph=e.buildGraph;exports.calculateBezierArcLength=e.calculateBezierArcLength;exports.calculateFrontAxlePosition=e.calculateFrontAxlePosition;exports.calculateInitialAxlePositions=e.calculateInitialAxlePositions;exports.calculatePositionOnCurve=e.calculatePositionOnCurve;exports.calculatePositionOnLine=e.calculatePositionOnLine;exports.calculateTangentLength=e.calculateTangentLength;exports.createBezierCurve=e.createBezierCurve;exports.createInitialMovementState=e.createInitialMovementState;exports.distance=e.distance;exports.distanceToT=e.distanceToT;exports.findPath=e.findPath;exports.getArcLength=e.getArcLength;exports.getCumulativeArcLength=e.getCumulativeArcLength;exports.getLineLength=e.getLineLength;exports.getPointOnBezier=e.getPointOnBezier;exports.getPointOnLine=e.getPointOnLine;exports.getPointOnLineByOffset=e.getPointOnLineByOffset;exports.getPositionFromOffset=e.getPositionFromOffset;exports.handleArrival=e.handleArrival;exports.initializeAllVehicles=e.initializeAllVehicles;exports.initializeMovingVehicle=e.initializeMovingVehicle;exports.isPointNearPoint=e.isPointNearPoint;exports.moveVehicle=e.moveVehicle;exports.normalize=e.normalize;exports.prepareCommandPath=e.prepareCommandPath;exports.resolveFromLineOffset=e.resolveFromLineOffset;exports.resolveToLineOffset=e.resolveToLineOffset;exports.updateAxlePosition=e.updateAxlePosition;exports.serializeScene=r;
|
package/dist/core.js
CHANGED
|
@@ -1,35 +1,54 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as f, a as c, b as g, c as d, d as h, e as m, f as u, g as L, h as P, i as O, j as p, k as v, l as x, m as A, n as z, o as I, p as S, q as T, r as B, s as C, t as b, u as y, v as F, w as V, x as E, y as M, z as N, A as j, B as k, C as q, D as w, E as D } from "./index-D8o0W80x.js";
|
|
2
|
+
function o(i, t, s) {
|
|
3
|
+
const n = {
|
|
4
|
+
lines: i,
|
|
5
|
+
curves: t.map((e) => ({
|
|
6
|
+
id: e.id,
|
|
7
|
+
fromLineId: e.fromLineId,
|
|
8
|
+
toLineId: e.toLineId,
|
|
9
|
+
fromOffset: e.fromOffset,
|
|
10
|
+
toOffset: e.toOffset
|
|
11
|
+
})),
|
|
12
|
+
vehicles: s.map((e) => ({
|
|
13
|
+
id: e.id,
|
|
14
|
+
axles: e.axles.map((a) => ({ lineId: a.lineId, offset: a.offset })),
|
|
15
|
+
axleSpacings: e.axleSpacings
|
|
16
|
+
}))
|
|
17
|
+
};
|
|
18
|
+
return JSON.stringify(n, null, 2);
|
|
19
|
+
}
|
|
2
20
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
f as PathEngine,
|
|
22
|
+
c as arcLengthToSegmentPosition,
|
|
23
|
+
g as buildArcLengthTable,
|
|
24
|
+
d as buildGraph,
|
|
25
|
+
h as calculateBezierArcLength,
|
|
26
|
+
m as calculateFrontAxlePosition,
|
|
27
|
+
u as calculateInitialAxlePositions,
|
|
28
|
+
L as calculatePositionOnCurve,
|
|
29
|
+
P as calculatePositionOnLine,
|
|
30
|
+
O as calculateTangentLength,
|
|
31
|
+
p as createBezierCurve,
|
|
32
|
+
v as createInitialMovementState,
|
|
33
|
+
x as distance,
|
|
34
|
+
A as distanceToT,
|
|
35
|
+
z as findPath,
|
|
36
|
+
I as getArcLength,
|
|
37
|
+
S as getCumulativeArcLength,
|
|
38
|
+
T as getLineLength,
|
|
39
|
+
B as getPointOnBezier,
|
|
40
|
+
C as getPointOnLine,
|
|
41
|
+
b as getPointOnLineByOffset,
|
|
42
|
+
y as getPositionFromOffset,
|
|
43
|
+
F as handleArrival,
|
|
44
|
+
V as initializeAllVehicles,
|
|
45
|
+
E as initializeMovingVehicle,
|
|
46
|
+
M as isPointNearPoint,
|
|
47
|
+
N as moveVehicle,
|
|
48
|
+
j as normalize,
|
|
49
|
+
k as prepareCommandPath,
|
|
50
|
+
q as resolveFromLineOffset,
|
|
51
|
+
w as resolveToLineOffset,
|
|
52
|
+
o as serializeScene,
|
|
53
|
+
D as updateAxlePosition
|
|
35
54
|
};
|