vehicle-path2 4.0.0 → 4.0.2
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/README.md +289 -289
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/index-BQoeJKCj.cjs +1 -0
- package/dist/{index-okJUn3WJ.js → index-DUYG8fxI.js} +135 -133
- package/dist/vehicle-path.cjs +1 -1
- package/dist/vehicle-path.js +1 -1
- package/package.json +83 -83
- package/dist/index-DQbf63_R.cjs +0 -1
|
@@ -15,8 +15,8 @@ function q(t, e, s, n) {
|
|
|
15
15
|
n?.fromOffset !== void 0 ? c = z(t, n.fromOffset, n.fromIsPercentage ?? !1) : c = t.end;
|
|
16
16
|
let o;
|
|
17
17
|
n?.toOffset !== void 0 ? o = z(e, n.toOffset, n.toIsPercentage ?? !1) : o = e.start;
|
|
18
|
-
const r = V(t.start, t.end),
|
|
19
|
-
return { p0: c, p1:
|
|
18
|
+
const r = V(t.start, t.end), u = V(e.start, e.end), h = y(c, o), a = F(i, h), l = { x: c.x + r.x * a, y: c.y + r.y * a }, d = { x: o.x - u.x * a, y: o.y - u.y * a };
|
|
19
|
+
return { p0: c, p1: l, p2: d, p3: o };
|
|
20
20
|
}
|
|
21
21
|
function K(t, e) {
|
|
22
22
|
return {
|
|
@@ -30,10 +30,10 @@ function z(t, e, s) {
|
|
|
30
30
|
return s ? i = e : i = n > 0 ? e / n : 0, i = Math.max(0, Math.min(1, i)), K(t, i);
|
|
31
31
|
}
|
|
32
32
|
function A(t, e) {
|
|
33
|
-
const { p0: s, p1: n, p2: i, p3: c } = t, o = 1 - e, r = o * o,
|
|
33
|
+
const { p0: s, p1: n, p2: i, p3: c } = t, o = 1 - e, r = o * o, u = r * o, h = e * e, a = h * e;
|
|
34
34
|
return {
|
|
35
|
-
x:
|
|
36
|
-
y:
|
|
35
|
+
x: u * s.x + 3 * r * e * n.x + 3 * o * h * i.x + a * c.x,
|
|
36
|
+
y: u * s.y + 3 * r * e * n.y + 3 * o * h * i.y + a * c.y
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
function ne(t, e, s = 10) {
|
|
@@ -48,7 +48,7 @@ function N(t, e = 100) {
|
|
|
48
48
|
}
|
|
49
49
|
return s;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function R(t, e) {
|
|
52
52
|
if (e <= 0) return 0;
|
|
53
53
|
const s = t[t.length - 1].distance;
|
|
54
54
|
if (e >= s) return 1;
|
|
@@ -57,15 +57,15 @@ function G(t, e) {
|
|
|
57
57
|
const a = Math.floor((n + i) / 2);
|
|
58
58
|
t[a].distance < e ? n = a : i = a;
|
|
59
59
|
}
|
|
60
|
-
const c = t[n].distance, o = t[i].distance, r = t[n].t,
|
|
60
|
+
const c = t[n].distance, o = t[i].distance, r = t[n].t, u = t[i].t;
|
|
61
61
|
if (o === c) return r;
|
|
62
|
-
const
|
|
63
|
-
return r +
|
|
62
|
+
const h = (e - c) / (o - c);
|
|
63
|
+
return r + h * (u - r);
|
|
64
64
|
}
|
|
65
65
|
function se(t) {
|
|
66
66
|
return t[t.length - 1].distance;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function G(t, e = 100) {
|
|
69
69
|
let s = 0, n = t.p0;
|
|
70
70
|
for (let i = 1; i <= e; i++) {
|
|
71
71
|
const c = i / e, o = A(t, c);
|
|
@@ -86,25 +86,25 @@ function I(t, e, s) {
|
|
|
86
86
|
for (const o of t)
|
|
87
87
|
i.set(o.id, o), c.set(o.id, y(o.start, o.end)), n.set(o.id, []);
|
|
88
88
|
for (let o = 0; o < e.length; o++) {
|
|
89
|
-
const r = e[o],
|
|
90
|
-
if (!
|
|
91
|
-
const a = E(
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const r = e[o], u = i.get(r.fromLineId), h = i.get(r.toLineId);
|
|
90
|
+
if (!u || !h) continue;
|
|
91
|
+
const a = E(u, r.fromOffset, r.fromIsPercentage, 1), l = B(h, r.toOffset, r.toIsPercentage, 0), d = q(
|
|
92
|
+
u,
|
|
93
|
+
h,
|
|
94
94
|
s,
|
|
95
95
|
{
|
|
96
96
|
fromOffset: a,
|
|
97
97
|
fromIsPercentage: !1,
|
|
98
|
-
toOffset:
|
|
98
|
+
toOffset: l,
|
|
99
99
|
toIsPercentage: !1
|
|
100
100
|
}
|
|
101
|
-
),
|
|
101
|
+
), g = G(d), v = {
|
|
102
102
|
curveIndex: o,
|
|
103
103
|
fromLineId: r.fromLineId,
|
|
104
104
|
toLineId: r.toLineId,
|
|
105
105
|
fromOffset: a,
|
|
106
|
-
toOffset:
|
|
107
|
-
curveLength:
|
|
106
|
+
toOffset: l,
|
|
107
|
+
curveLength: g
|
|
108
108
|
};
|
|
109
109
|
n.get(r.fromLineId).push(v);
|
|
110
110
|
}
|
|
@@ -113,79 +113,79 @@ function I(t, e, s) {
|
|
|
113
113
|
function b(t, e) {
|
|
114
114
|
return t.curveCount !== e.curveCount ? t.curveCount - e.curveCount : t.totalDistance - e.totalDistance;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Q(t, e, s, n, i = !1) {
|
|
117
117
|
const { adjacency: c, lines: o, lineLengths: r } = t;
|
|
118
118
|
if (!o.get(s)) return null;
|
|
119
|
-
const
|
|
119
|
+
const h = r.get(s), a = i ? n / 100 * h : n, l = [], d = /* @__PURE__ */ new Map(), g = (f, p) => `${f}:${Math.round(p)}`;
|
|
120
120
|
if (e.lineId === s && a >= e.offset) {
|
|
121
|
-
const
|
|
121
|
+
const f = a - e.offset;
|
|
122
122
|
return {
|
|
123
123
|
segments: [{
|
|
124
124
|
type: "line",
|
|
125
125
|
lineId: e.lineId,
|
|
126
126
|
startOffset: e.offset,
|
|
127
127
|
endOffset: a,
|
|
128
|
-
length:
|
|
128
|
+
length: f
|
|
129
129
|
}],
|
|
130
|
-
totalDistance:
|
|
130
|
+
totalDistance: f,
|
|
131
131
|
curveCount: 0
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
const v = c.get(e.lineId) || [];
|
|
135
|
-
for (const
|
|
136
|
-
if (
|
|
137
|
-
const p =
|
|
135
|
+
for (const f of v) {
|
|
136
|
+
if (f.fromOffset < e.offset) continue;
|
|
137
|
+
const p = f.fromOffset - e.offset, x = p + f.curveLength, L = {
|
|
138
138
|
type: "line",
|
|
139
139
|
lineId: e.lineId,
|
|
140
140
|
startOffset: e.offset,
|
|
141
|
-
endOffset:
|
|
141
|
+
endOffset: f.fromOffset,
|
|
142
142
|
length: p
|
|
143
143
|
}, m = {
|
|
144
144
|
type: "curve",
|
|
145
|
-
curveIndex:
|
|
145
|
+
curveIndex: f.curveIndex,
|
|
146
146
|
startOffset: 0,
|
|
147
|
-
endOffset:
|
|
148
|
-
length:
|
|
147
|
+
endOffset: f.curveLength,
|
|
148
|
+
length: f.curveLength
|
|
149
149
|
};
|
|
150
|
-
|
|
151
|
-
lineId:
|
|
152
|
-
entryOffset:
|
|
150
|
+
l.push({
|
|
151
|
+
lineId: f.toLineId,
|
|
152
|
+
entryOffset: f.toOffset,
|
|
153
153
|
totalDistance: x,
|
|
154
154
|
curveCount: 1,
|
|
155
155
|
path: [L, m]
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
for (
|
|
159
|
-
const
|
|
160
|
-
if (x !== void 0 && (x.curveCount <
|
|
158
|
+
for (l.sort(b); l.length > 0; ) {
|
|
159
|
+
const f = l.shift(), p = g(f.lineId, f.entryOffset), x = d.get(p);
|
|
160
|
+
if (x !== void 0 && (x.curveCount < f.curveCount || x.curveCount === f.curveCount && x.distance <= f.totalDistance))
|
|
161
161
|
continue;
|
|
162
|
-
if (d.set(p, { curveCount:
|
|
163
|
-
const m = Math.abs(a -
|
|
164
|
-
if (a >=
|
|
162
|
+
if (d.set(p, { curveCount: f.curveCount, distance: f.totalDistance }), f.lineId === s) {
|
|
163
|
+
const m = Math.abs(a - f.entryOffset);
|
|
164
|
+
if (a >= f.entryOffset) {
|
|
165
165
|
const C = {
|
|
166
166
|
type: "line",
|
|
167
167
|
lineId: s,
|
|
168
|
-
startOffset:
|
|
168
|
+
startOffset: f.entryOffset,
|
|
169
169
|
endOffset: a,
|
|
170
170
|
length: m
|
|
171
171
|
};
|
|
172
172
|
return {
|
|
173
|
-
segments: [...
|
|
174
|
-
totalDistance:
|
|
175
|
-
curveCount:
|
|
173
|
+
segments: [...f.path, C],
|
|
174
|
+
totalDistance: f.totalDistance + m,
|
|
175
|
+
curveCount: f.curveCount
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const L = c.get(
|
|
179
|
+
const L = c.get(f.lineId) || [];
|
|
180
180
|
for (const m of L) {
|
|
181
|
-
if (m.fromOffset <
|
|
182
|
-
const C = m.fromOffset -
|
|
183
|
-
if (D !== void 0 && (D.curveCount <
|
|
181
|
+
if (m.fromOffset < f.entryOffset) continue;
|
|
182
|
+
const C = m.fromOffset - f.entryOffset, T = f.totalDistance + C + m.curveLength, w = f.curveCount + 1, j = g(m.toLineId, m.toOffset), D = d.get(j);
|
|
183
|
+
if (D !== void 0 && (D.curveCount < w || D.curveCount === w && D.distance <= T))
|
|
184
184
|
continue;
|
|
185
185
|
const $ = {
|
|
186
186
|
type: "line",
|
|
187
|
-
lineId:
|
|
188
|
-
startOffset:
|
|
187
|
+
lineId: f.lineId,
|
|
188
|
+
startOffset: f.entryOffset,
|
|
189
189
|
endOffset: m.fromOffset,
|
|
190
190
|
length: C
|
|
191
191
|
}, k = {
|
|
@@ -195,19 +195,19 @@ function R(t, e, s, n, i = !1) {
|
|
|
195
195
|
endOffset: m.curveLength,
|
|
196
196
|
length: m.curveLength
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
l.push({
|
|
199
199
|
lineId: m.toLineId,
|
|
200
200
|
entryOffset: m.toOffset,
|
|
201
201
|
totalDistance: T,
|
|
202
|
-
curveCount:
|
|
203
|
-
path: [...
|
|
202
|
+
curveCount: w,
|
|
203
|
+
path: [...f.path, $, k]
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
l.sort(b);
|
|
207
207
|
}
|
|
208
208
|
return null;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function S(t, e) {
|
|
211
211
|
const s = Math.sqrt(
|
|
212
212
|
Math.pow(t.end.x - t.start.x, 2) + Math.pow(t.end.y - t.start.y, 2)
|
|
213
213
|
), n = s > 0 ? e / s : 0;
|
|
@@ -261,14 +261,14 @@ function H(t, e, s, n) {
|
|
|
261
261
|
o[c - 1] = {
|
|
262
262
|
lineId: t,
|
|
263
263
|
absoluteOffset: e,
|
|
264
|
-
position:
|
|
264
|
+
position: S(n, e)
|
|
265
265
|
};
|
|
266
266
|
let r = e;
|
|
267
|
-
for (let
|
|
268
|
-
r = Math.min(r + s[
|
|
267
|
+
for (let u = c - 2; u >= 0; u--)
|
|
268
|
+
r = Math.min(r + s[u], i), o[u] = {
|
|
269
269
|
lineId: t,
|
|
270
270
|
absoluteOffset: r,
|
|
271
|
-
position:
|
|
271
|
+
position: S(n, r)
|
|
272
272
|
};
|
|
273
273
|
return o;
|
|
274
274
|
}
|
|
@@ -296,28 +296,28 @@ function re(t, e) {
|
|
|
296
296
|
return { movingVehicles: s, stateMap: n };
|
|
297
297
|
}
|
|
298
298
|
function M(t, e) {
|
|
299
|
-
return { position:
|
|
299
|
+
return { position: S(t, e), lineId: t.id, absoluteOffset: e };
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
const s =
|
|
301
|
+
function P(t, e) {
|
|
302
|
+
const s = R(t.arcLengthTable, e);
|
|
303
303
|
return { position: A(t.bezier, s) };
|
|
304
304
|
}
|
|
305
305
|
function X(t, e, s, n, i, c, o) {
|
|
306
|
-
const r = s.segments[e.currentSegmentIndex],
|
|
307
|
-
if (
|
|
308
|
-
const a =
|
|
309
|
-
if (
|
|
306
|
+
const r = s.segments[e.currentSegmentIndex], u = e.segmentDistance + n;
|
|
307
|
+
if (u >= r.length) {
|
|
308
|
+
const a = u - r.length, l = e.currentSegmentIndex + 1;
|
|
309
|
+
if (l >= s.segments.length) {
|
|
310
310
|
if (o !== void 0 && r.type === "line") {
|
|
311
|
-
const
|
|
311
|
+
const f = i.get(r.lineId), p = r.startOffset + u;
|
|
312
312
|
if (p <= o) {
|
|
313
|
-
const L = M(
|
|
313
|
+
const L = M(f, p);
|
|
314
314
|
return {
|
|
315
315
|
axleState: { ...t, ...L },
|
|
316
|
-
execution: { ...e, segmentDistance:
|
|
316
|
+
execution: { ...e, segmentDistance: u },
|
|
317
317
|
completed: !1
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
const x = M(
|
|
320
|
+
const x = M(f, o);
|
|
321
321
|
return {
|
|
322
322
|
axleState: { ...t, ...x },
|
|
323
323
|
execution: { ...e, segmentDistance: o - r.startOffset },
|
|
@@ -327,7 +327,7 @@ function X(t, e, s, n, i, c, o) {
|
|
|
327
327
|
const v = r.type === "line" ? M(
|
|
328
328
|
i.get(r.lineId),
|
|
329
329
|
r.endOffset
|
|
330
|
-
) :
|
|
330
|
+
) : P(
|
|
331
331
|
c.get(r.curveIndex),
|
|
332
332
|
r.length
|
|
333
333
|
);
|
|
@@ -337,32 +337,32 @@ function X(t, e, s, n, i, c, o) {
|
|
|
337
337
|
completed: !0
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
const d = s.segments[
|
|
340
|
+
const d = s.segments[l], g = d.type === "line" ? M(
|
|
341
341
|
i.get(d.lineId),
|
|
342
342
|
d.startOffset + a
|
|
343
|
-
) :
|
|
343
|
+
) : P(
|
|
344
344
|
c.get(d.curveIndex),
|
|
345
345
|
a
|
|
346
346
|
);
|
|
347
347
|
return {
|
|
348
|
-
axleState: { ...t, ...
|
|
348
|
+
axleState: { ...t, ...g },
|
|
349
349
|
execution: {
|
|
350
|
-
currentSegmentIndex:
|
|
350
|
+
currentSegmentIndex: l,
|
|
351
351
|
segmentDistance: a
|
|
352
352
|
},
|
|
353
353
|
completed: !1
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
const
|
|
356
|
+
const h = r.type === "line" ? M(
|
|
357
357
|
i.get(r.lineId),
|
|
358
|
-
r.startOffset +
|
|
359
|
-
) :
|
|
358
|
+
r.startOffset + u
|
|
359
|
+
) : P(
|
|
360
360
|
c.get(r.curveIndex),
|
|
361
|
-
|
|
361
|
+
u
|
|
362
362
|
);
|
|
363
363
|
return {
|
|
364
|
-
axleState: { ...t, ...
|
|
365
|
-
execution: { ...e, segmentDistance:
|
|
364
|
+
axleState: { ...t, ...h },
|
|
365
|
+
execution: { ...e, segmentDistance: u },
|
|
366
366
|
completed: !1
|
|
367
367
|
};
|
|
368
368
|
}
|
|
@@ -372,30 +372,30 @@ function Y(t, e, s, n) {
|
|
|
372
372
|
if (c.type === "curve" && c.curveIndex !== void 0) {
|
|
373
373
|
const o = e[c.curveIndex];
|
|
374
374
|
if (o) {
|
|
375
|
-
const r = s.get(o.fromLineId),
|
|
376
|
-
if (r &&
|
|
377
|
-
const
|
|
375
|
+
const r = s.get(o.fromLineId), u = s.get(o.toLineId);
|
|
376
|
+
if (r && u) {
|
|
377
|
+
const h = E(
|
|
378
378
|
r,
|
|
379
379
|
o.fromOffset,
|
|
380
380
|
o.fromIsPercentage,
|
|
381
381
|
1
|
|
382
382
|
), a = B(
|
|
383
|
-
|
|
383
|
+
u,
|
|
384
384
|
o.toOffset,
|
|
385
385
|
o.toIsPercentage,
|
|
386
386
|
0
|
|
387
|
-
),
|
|
387
|
+
), l = q(
|
|
388
388
|
r,
|
|
389
|
-
|
|
389
|
+
u,
|
|
390
390
|
n,
|
|
391
391
|
{
|
|
392
|
-
fromOffset:
|
|
392
|
+
fromOffset: h,
|
|
393
393
|
fromIsPercentage: !1,
|
|
394
394
|
toOffset: a,
|
|
395
395
|
toIsPercentage: !1
|
|
396
396
|
}
|
|
397
|
-
), d = N(
|
|
398
|
-
i.set(c.curveIndex, { bezier:
|
|
397
|
+
), d = N(l);
|
|
398
|
+
i.set(c.curveIndex, { bezier: l, arcLengthTable: d });
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -404,18 +404,18 @@ function Y(t, e, s, n) {
|
|
|
404
404
|
function Z(t, e, s) {
|
|
405
405
|
const { graph: n, linesMap: i, curves: c, config: o } = s, r = i.get(e.targetLineId);
|
|
406
406
|
if (!r) return null;
|
|
407
|
-
const
|
|
407
|
+
const u = t.axleSpacings.reduce((f, p) => f + p, 0), a = O(r) - u;
|
|
408
408
|
if (a <= 0) return null;
|
|
409
|
-
const
|
|
409
|
+
const l = e.isPercentage ? e.targetOffset * a : Math.min(e.targetOffset, a), d = t.axles[t.axles.length - 1], g = Q(
|
|
410
410
|
n,
|
|
411
411
|
{ lineId: d.lineId, offset: d.absoluteOffset },
|
|
412
412
|
e.targetLineId,
|
|
413
|
-
|
|
413
|
+
l,
|
|
414
414
|
!1
|
|
415
415
|
);
|
|
416
|
-
if (!
|
|
417
|
-
const v = Y(
|
|
418
|
-
return { path:
|
|
416
|
+
if (!g) return null;
|
|
417
|
+
const v = Y(g, c, i, o);
|
|
418
|
+
return { path: g, curveDataMap: v };
|
|
419
419
|
}
|
|
420
420
|
function oe(t, e) {
|
|
421
421
|
const s = t.execution, i = e.vehicleQueues.get(t.vehicle.id)?.[s.currentCommandIndex];
|
|
@@ -437,23 +437,25 @@ function oe(t, e) {
|
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
439
|
function ee(t, e, s, n, i, c) {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
440
|
+
const o = t.map((r, u) => {
|
|
441
|
+
const h = u === t.length - 1;
|
|
442
|
+
let a;
|
|
443
|
+
if (!h) {
|
|
444
|
+
const l = e[u];
|
|
445
|
+
if (l.currentSegmentIndex < s.segments.length) {
|
|
446
|
+
const d = s.segments[l.currentSegmentIndex];
|
|
447
|
+
if (d.type === "line") {
|
|
448
|
+
const g = i.get(d.lineId);
|
|
449
|
+
g && (a = O(g));
|
|
450
|
+
}
|
|
451
|
+
}
|
|
447
452
|
}
|
|
448
|
-
|
|
449
|
-
const f = t.map((l, a) => {
|
|
450
|
-
const g = a === 0 ? o : void 0;
|
|
451
|
-
return X(l, e[a], s, n, i, c, g);
|
|
453
|
+
return X(r, e[u], s, n, i, c, a);
|
|
452
454
|
});
|
|
453
455
|
return {
|
|
454
|
-
axles:
|
|
455
|
-
axleExecutions:
|
|
456
|
-
arrived:
|
|
456
|
+
axles: o.map((r) => r.axleState),
|
|
457
|
+
axleExecutions: o.map((r) => r.execution),
|
|
458
|
+
arrived: o[o.length - 1].completed
|
|
457
459
|
// axles[N-1] = rearmost menentukan arrived
|
|
458
460
|
};
|
|
459
461
|
}
|
|
@@ -567,9 +569,9 @@ class ce {
|
|
|
567
569
|
const { axleSpacings: c } = n;
|
|
568
570
|
if (c.length === 0)
|
|
569
571
|
throw new Error("initializeVehicle: axleSpacings must have at least one entry (vehicle needs ≥2 axles)");
|
|
570
|
-
const o = c.reduce((a,
|
|
572
|
+
const o = c.reduce((a, l) => a + l, 0), r = O(i), u = Math.min(s, r - o);
|
|
571
573
|
return {
|
|
572
|
-
axles: H(e,
|
|
574
|
+
axles: H(e, u, c, i).map((a) => ({ lineId: a.lineId, offset: a.absoluteOffset, position: a.position })),
|
|
573
575
|
axleSpacings: c
|
|
574
576
|
};
|
|
575
577
|
}
|
|
@@ -585,16 +587,16 @@ class ce {
|
|
|
585
587
|
*/
|
|
586
588
|
preparePath(e, s, n, i = !1) {
|
|
587
589
|
if (!this.graph) return null;
|
|
588
|
-
const c = e.axleSpacings.reduce((
|
|
590
|
+
const c = e.axleSpacings.reduce((g, v) => g + v, 0), o = e.axles[e.axles.length - 1], r = {
|
|
589
591
|
lineId: o.lineId,
|
|
590
592
|
offset: o.offset,
|
|
591
|
-
axles: e.axles.map((
|
|
592
|
-
lineId:
|
|
593
|
-
position:
|
|
594
|
-
absoluteOffset:
|
|
593
|
+
axles: e.axles.map((g) => ({
|
|
594
|
+
lineId: g.lineId,
|
|
595
|
+
position: g.position,
|
|
596
|
+
absoluteOffset: g.offset
|
|
595
597
|
})),
|
|
596
598
|
axleSpacings: e.axleSpacings
|
|
597
|
-
},
|
|
599
|
+
}, u = Z(r, {
|
|
598
600
|
targetLineId: s,
|
|
599
601
|
targetOffset: n,
|
|
600
602
|
isPercentage: i
|
|
@@ -604,26 +606,26 @@ class ce {
|
|
|
604
606
|
curves: this.curves,
|
|
605
607
|
config: this.config
|
|
606
608
|
});
|
|
607
|
-
if (!
|
|
608
|
-
let
|
|
609
|
+
if (!u) return null;
|
|
610
|
+
let h = n;
|
|
609
611
|
const a = this.linesMap.get(s);
|
|
610
612
|
if (a) {
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
+
const g = Math.max(0, O(a) - c);
|
|
614
|
+
h = i ? n * g : Math.min(n, g);
|
|
613
615
|
}
|
|
614
|
-
let
|
|
616
|
+
let l = 0;
|
|
615
617
|
const d = [
|
|
616
618
|
{ segmentIndex: 0, segmentDistance: c }
|
|
617
619
|
// axles[0] = front
|
|
618
620
|
];
|
|
619
|
-
for (let
|
|
620
|
-
|
|
621
|
+
for (let g = 0; g < e.axleSpacings.length; g++)
|
|
622
|
+
l += e.axleSpacings[g], d.push({ segmentIndex: 0, segmentDistance: c - l });
|
|
621
623
|
return {
|
|
622
|
-
path:
|
|
623
|
-
curveDataMap:
|
|
624
|
+
path: u.path,
|
|
625
|
+
curveDataMap: u.curveDataMap,
|
|
624
626
|
axleExecutions: d,
|
|
625
627
|
targetLineId: s,
|
|
626
|
-
targetOffset:
|
|
628
|
+
targetOffset: h
|
|
627
629
|
};
|
|
628
630
|
}
|
|
629
631
|
/**
|
|
@@ -672,24 +674,24 @@ export {
|
|
|
672
674
|
_ as b,
|
|
673
675
|
N as c,
|
|
674
676
|
I as d,
|
|
675
|
-
|
|
677
|
+
G as e,
|
|
676
678
|
ie as f,
|
|
677
679
|
W as g,
|
|
678
680
|
H as h,
|
|
679
|
-
|
|
681
|
+
P as i,
|
|
680
682
|
M as j,
|
|
681
683
|
F as k,
|
|
682
684
|
q as l,
|
|
683
685
|
ee as m,
|
|
684
686
|
U as n,
|
|
685
687
|
y as o,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
+
R as p,
|
|
689
|
+
Q as q,
|
|
688
690
|
se as r,
|
|
689
691
|
A as s,
|
|
690
692
|
K as t,
|
|
691
693
|
z as u,
|
|
692
|
-
|
|
694
|
+
S as v,
|
|
693
695
|
oe as w,
|
|
694
696
|
re as x,
|
|
695
697
|
J as y,
|
package/dist/vehicle-path.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BQoeJKCj.cjs");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.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.moveVehicle=e.moveVehicle;exports.normalize=e.normalize;exports.prepareCommandPath=e.prepareCommandPath;exports.resolveFromLineOffset=e.resolveFromLineOffset;exports.resolveToLineOffset=e.resolveToLineOffset;exports.updateAxlePosition=e.updateAxlePosition;
|
package/dist/vehicle-path.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as i, b as t, c as s, d as n, e as o, f as l, h as r, i as c, j as g, l as h, n as P, o as u, p as L, q as f, r as m, g as v, a as A, s as d, t as O, u as p, v as z, w as x, x as B, y as C, m as T, A as b, B as F, C as V, D as y, E } from "./index-
|
|
1
|
+
import { P as i, b as t, c as s, d as n, e as o, f as l, h as r, i as c, j as g, l as h, n as P, o as u, p as L, q as f, r as m, g as v, a as A, s as d, t as O, u as p, v as z, w as x, x as B, y as C, m as T, A as b, B as F, C as V, D as y, E } from "./index-DUYG8fxI.js";
|
|
2
2
|
export {
|
|
3
3
|
i as PathEngine,
|
|
4
4
|
t as arcLengthToSegmentPosition,
|