@drawtonomy/sdk 0.8.0 → 0.10.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.
Files changed (46) hide show
  1. package/dist/exporter/index.d.ts +5 -2
  2. package/dist/exporter/index.d.ts.map +1 -1
  3. package/dist/exporter/index.js +3 -0
  4. package/dist/exporter/index.js.map +1 -1
  5. package/dist/exporter/lanelet2.d.ts.map +1 -1
  6. package/dist/exporter/lanelet2.js +434 -2
  7. package/dist/exporter/lanelet2.js.map +1 -1
  8. package/dist/exporter/odrCarryThrough.d.ts +89 -0
  9. package/dist/exporter/odrCarryThrough.d.ts.map +1 -0
  10. package/dist/exporter/odrCarryThrough.js +186 -0
  11. package/dist/exporter/odrCarryThrough.js.map +1 -0
  12. package/dist/exporter/odrGeometry.d.ts +64 -0
  13. package/dist/exporter/odrGeometry.d.ts.map +1 -0
  14. package/dist/exporter/odrGeometry.js +324 -0
  15. package/dist/exporter/odrGeometry.js.map +1 -0
  16. package/dist/exporter/odrGeometryFit.d.ts +37 -0
  17. package/dist/exporter/odrGeometryFit.d.ts.map +1 -0
  18. package/dist/exporter/odrGeometryFit.js +476 -0
  19. package/dist/exporter/odrGeometryFit.js.map +1 -0
  20. package/dist/exporter/odrToShapes.d.ts +53 -0
  21. package/dist/exporter/odrToShapes.d.ts.map +1 -0
  22. package/dist/exporter/odrToShapes.js +1696 -0
  23. package/dist/exporter/odrToShapes.js.map +1 -0
  24. package/dist/exporter/opendrive.d.ts +14 -1
  25. package/dist/exporter/opendrive.d.ts.map +1 -1
  26. package/dist/exporter/opendrive.js +1813 -163
  27. package/dist/exporter/opendrive.js.map +1 -1
  28. package/dist/exporter/opendriveParser.d.ts +194 -0
  29. package/dist/exporter/opendriveParser.d.ts.map +1 -0
  30. package/dist/exporter/opendriveParser.js +429 -0
  31. package/dist/exporter/opendriveParser.js.map +1 -0
  32. package/dist/exporter/osmToShapes.d.ts +52 -3
  33. package/dist/exporter/osmToShapes.d.ts.map +1 -1
  34. package/dist/exporter/osmToShapes.js +208 -5
  35. package/dist/exporter/osmToShapes.js.map +1 -1
  36. package/dist/exporter/projection.d.ts +1 -1
  37. package/dist/exporter/projection.d.ts.map +1 -1
  38. package/dist/exporter/projection.js +2 -3
  39. package/dist/exporter/projection.js.map +1 -1
  40. package/dist/exporter/units.d.ts +7 -0
  41. package/dist/exporter/units.d.ts.map +1 -1
  42. package/dist/exporter/units.js +11 -0
  43. package/dist/exporter/units.js.map +1 -1
  44. package/dist/types.d.ts +27 -1
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +1 -1
@@ -0,0 +1,476 @@
1
+ // Plan-view geometry fitting: turns a discrete reference-line polyline into a
2
+ // compact sequence of analytic OpenDRIVE primitives (<line>, <arc>,
3
+ // <paramPoly3 pRange="arcLength">).
4
+ //
5
+ // Approach (first principles, no external references):
6
+ // - Discrete headings are estimated by central differences and de-noised with
7
+ // a small moving-median filter (robust to single-sample outliers from
8
+ // hand-drawn input).
9
+ // - Segments are grown greedily (exponential probing + binary search for the
10
+ // longest fitting span). For each candidate span the simplest primitive
11
+ // wins: a line when all samples stay within the position tolerance of the
12
+ // start ray, else an arc through both endpoints (curvature from the
13
+ // chord/heading geometry of a circle), else a cubic Hermite emitted as
14
+ // paramPoly3. Every accepted fit is verified against the original samples:
15
+ // maximum position deviation <= posTol and end-heading deviation <= hdgTol.
16
+ // - C1 continuity is guaranteed by construction: each primitive starts at the
17
+ // analytic end pose of the previous one, and end headings are constrained
18
+ // to the sampled tangents. When no primitive fits even a single step (sharp
19
+ // corner), the span degrades to the plain chord <line> — the same output
20
+ // the previous line-decomposition exporter produced — which keeps position
21
+ // continuity and confines the heading break to the corner itself.
22
+ //
23
+ // No external dependencies.
24
+ import { evalGeometry } from './odrGeometry';
25
+ const MIN_SEG_LENGTH = 1e-6;
26
+ /**
27
+ * Input points closer than this (m) are merged. Sub-2cm spacing carries no
28
+ * road-geometry information at the 5 cm position tolerance — merging shifts
29
+ * the polyline by less than half the tolerance — but its chord directions are
30
+ * noise (snap/weld artifacts at lane ends produce millimeter chords pointing
31
+ * sideways or backwards) that would corrupt the heading estimates.
32
+ */
33
+ const DEDUPE_EPS = 0.02;
34
+ /** Shortest fallback chord worth emitting; closer points snap to the chain. */
35
+ const MIN_EMIT_LENGTH = 1e-3;
36
+ /**
37
+ * Maximum lateral miss allowed for a <line> that ends the whole plan view.
38
+ * Road endpoints are contact points with neighbouring roads (welded in the
39
+ * drawing), so the fitted curve must land on the final input point almost
40
+ * exactly — arcs and Hermites interpolate it by construction, but a line only
41
+ * projects it onto the start ray. Beyond this tolerance the line candidate is
42
+ * rejected and an (endpoint-exact) arc or paramPoly3 takes the span instead.
43
+ */
44
+ const LINE_FINAL_LATERAL_TOL = 1e-3;
45
+ /** Largest |chord-to-heading angle| a single arc / Hermite span may subtend. */
46
+ const MAX_TURN_RAD = 1.45;
47
+ function wrapAngle(a) {
48
+ while (a > Math.PI)
49
+ a -= 2 * Math.PI;
50
+ while (a < -Math.PI)
51
+ a += 2 * Math.PI;
52
+ return a;
53
+ }
54
+ function median(values) {
55
+ const sorted = [...values].sort((a, b) => a - b);
56
+ const mid = sorted.length >> 1;
57
+ return sorted.length % 2 === 1 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
58
+ }
59
+ /** Distance from p to the polyline pts[i0..i1] (projection onto segments). */
60
+ function distToPolyline(p, pts, i0, i1) {
61
+ let best = Infinity;
62
+ for (let i = i0; i < i1; i++) {
63
+ const a = pts[i];
64
+ const b = pts[i + 1];
65
+ const dx = b.x - a.x;
66
+ const dy = b.y - a.y;
67
+ const len2 = dx * dx + dy * dy;
68
+ let t = len2 > 1e-18 ? ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2 : 0;
69
+ if (t < 0)
70
+ t = 0;
71
+ if (t > 1)
72
+ t = 1;
73
+ const d = Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));
74
+ if (d < best)
75
+ best = d;
76
+ }
77
+ return best;
78
+ }
79
+ /**
80
+ * Fit a plan-view primitive sequence to a polyline of reference-line samples.
81
+ *
82
+ * The returned geometries are C1-continuous (each starts at the previous
83
+ * one's analytic end pose) except across degraded sharp-corner chords, and
84
+ * deviate from the input samples by at most the position tolerance.
85
+ */
86
+ export function fitPlanView(points, options = {}) {
87
+ const posTol = options.maxPosErrorMeters ?? 0.05;
88
+ const hdgTol = options.maxHdgErrorRad ?? (0.5 * Math.PI) / 180;
89
+ const medianWindow = options.headingMedianWindow ?? 3;
90
+ // --- Dedupe coincident input points (duplicates share the same station). --
91
+ const pts = [];
92
+ const dedupIndex = [];
93
+ for (const p of points) {
94
+ const last = pts[pts.length - 1];
95
+ if (!last || Math.hypot(p.x - last.x, p.y - last.y) > DEDUPE_EPS) {
96
+ pts.push({ x: p.x, y: p.y });
97
+ }
98
+ dedupIndex.push(pts.length - 1);
99
+ }
100
+ // The final input point is a contact point with the neighbouring road and
101
+ // must survive exactly: when the dedupe pass merged it into the previous
102
+ // vertex, move that vertex onto it (a sub-DEDUPE_EPS shift, well inside the
103
+ // position tolerance) instead of dropping the true endpoint.
104
+ if (pts.length >= 2) {
105
+ const lastIn = points[points.length - 1];
106
+ const lastKept = pts[pts.length - 1];
107
+ if (lastKept.x !== lastIn.x || lastKept.y !== lastIn.y) {
108
+ lastKept.x = lastIn.x;
109
+ lastKept.y = lastIn.y;
110
+ }
111
+ }
112
+ const m = pts.length;
113
+ if (m < 2) {
114
+ const pose = m === 1 ? { s: 0, x: pts[0].x, y: pts[0].y, hdg: 0 } : { s: 0, x: 0, y: 0, hdg: 0 };
115
+ return { geometries: [], samplePoses: points.map(() => ({ ...pose })), length: 0 };
116
+ }
117
+ // --- Cumulative chord length. ---------------------------------------------
118
+ const u = [0];
119
+ for (let i = 1; i < m; i++) {
120
+ u.push(u[i - 1] + Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y));
121
+ }
122
+ // --- Discrete headings: weighted chord blend + unwrap + moving median. ----
123
+ // On any smooth curve, a chord's direction is the tangent at the chord's
124
+ // arc-length midpoint (second order, exact on a circular arc). The tangent
125
+ // at vertex i is therefore the linear (in arc length) interpolation of the
126
+ // two adjacent chord directions, evaluated at u[i]:
127
+ // hdg(i) = a(i-1,i) + Δa · len(i-1) / (len(i-1) + len(i))
128
+ // which stays circle-exact for arbitrarily uneven spacing — resampled
129
+ // polylines routinely mix metre chords with centimetre slivers, where the
130
+ // uniform-spacing forms (symmetric chord / 1.5·a01 − 0.5·a12) pick up
131
+ // heading errors of κ·Δlen/2 (well past tolerance on curved roads).
132
+ // Endpoints extrapolate the same linear model to u[0] / u[m-1].
133
+ // Sub-tolerance jogs that would corrupt these estimates were already merged
134
+ // away by the dedupe pass above.
135
+ const chordAngle = (i) => Math.atan2(pts[i + 1].y - pts[i].y, pts[i + 1].x - pts[i].x);
136
+ const chordLen = (i) => Math.hypot(pts[i + 1].x - pts[i].x, pts[i + 1].y - pts[i].y);
137
+ const rawHdg = new Array(m);
138
+ if (m === 2) {
139
+ rawHdg[0] = chordAngle(0);
140
+ rawHdg[1] = rawHdg[0];
141
+ }
142
+ else {
143
+ for (let i = 1; i < m - 1; i++) {
144
+ const a1 = chordAngle(i - 1);
145
+ const a2 = chordAngle(i);
146
+ const l1 = chordLen(i - 1);
147
+ const l2 = chordLen(i);
148
+ rawHdg[i] = a1 + (wrapAngle(a2 - a1) * l1) / (l1 + l2);
149
+ }
150
+ // Endpoint tangents extrapolate the constant-curvature model — but only
151
+ // when the data is actually curving there. Real roads end with straight
152
+ // tips (line+arc+line corner roads are everywhere in OpenDRIVE maps), and
153
+ // for a tip whose first chord lies on the straight piece the chord IS the
154
+ // tangent; blending in the next chord (already inside the arc) would
155
+ // rotate the contact cross-section off the neighbouring road's. The tip
156
+ // counts as straight when its lead turn is at most half the following
157
+ // turn (plus tolerance): a uniform arc shows equal turns and extrapolates,
158
+ // a line-into-arc tip shows a doubled second turn and keeps its chord.
159
+ const tipTangent = (aTip, aNext, lTip, lNext, turnBeyond) => {
160
+ const turnTip = wrapAngle(aNext - aTip);
161
+ if (turnBeyond !== null && Math.abs(turnTip) <= Math.abs(turnBeyond) / 2 + hdgTol) {
162
+ return aTip;
163
+ }
164
+ return aTip - (turnTip * lTip) / (lTip + lNext);
165
+ };
166
+ const a01 = chordAngle(0);
167
+ const a12 = chordAngle(1);
168
+ rawHdg[0] = tipTangent(a01, a12, chordLen(0), chordLen(1), m >= 4 ? wrapAngle(chordAngle(2) - a12) : null);
169
+ const aLast = chordAngle(m - 2);
170
+ const aPrev = chordAngle(m - 3);
171
+ rawHdg[m - 1] = tipTangent(aLast, aPrev, chordLen(m - 2), chordLen(m - 3), m >= 4 ? wrapAngle(chordAngle(m - 4) - aPrev) : null);
172
+ }
173
+ // Unwrap so the sequence is continuous (no 2π jumps) before filtering.
174
+ for (let i = 1; i < m; i++) {
175
+ rawHdg[i] = rawHdg[i - 1] + wrapAngle(rawHdg[i] - rawHdg[i - 1]);
176
+ }
177
+ // Median-filter interior headings only: a truncated window at the ends
178
+ // degenerates to an average, which would re-bias the carefully built
179
+ // second-order endpoint estimates.
180
+ const hdg = new Array(m);
181
+ const half = Math.max(0, (medianWindow - 1) >> 1);
182
+ for (let i = 0; i < m; i++) {
183
+ if (half === 0 || i < half || i >= m - half) {
184
+ hdg[i] = rawHdg[i];
185
+ continue;
186
+ }
187
+ hdg[i] = median(rawHdg.slice(i - half, i + half + 1));
188
+ }
189
+ // --- Corner flags -----------------------------------------------------------
190
+ // A polyline vertex whose adjacent chords turn sharply is a deliberate
191
+ // corner, not a sampled smooth curve; its "tangent" is meaningless, so
192
+ // end-heading constraints are waived there (the segmentation naturally
193
+ // breaks at the corner and the heading discontinuity stays on it).
194
+ const CORNER_TURN_RAD = 0.3;
195
+ const corner = new Array(m).fill(false);
196
+ for (let i = 1; i < m - 1; i++) {
197
+ corner[i] = Math.abs(wrapAngle(chordAngle(i) - chordAngle(i - 1))) > CORNER_TURN_RAD;
198
+ }
199
+ /**
200
+ * End-heading acceptance for a segment ending at sample j. Corners carry no
201
+ * reliable tangent; C1 continuity is unaffected (it is enforced by chaining
202
+ * start poses, not by this check). The very last sample IS constrained: its
203
+ * heading defines the contact cross-section shared with the successor road,
204
+ * so a primitive may not land there pointing off the data tangent.
205
+ */
206
+ const headingOk = (j, endHdg) => corner[j] || Math.abs(wrapAngle(hdg[j] - endHdg)) <= hdgTol;
207
+ /**
208
+ * Line; passes when all samples hug the ray. Chained segments must follow
209
+ * the chain heading; the very first segment has no incoming tangent to
210
+ * honor, so its direction is the (noise-robust) endpoint chord instead of
211
+ * the local heading estimate at sample 0.
212
+ */
213
+ const tryLine = (pose, i, j, chained) => {
214
+ const lineHdg = chained ? pose.hdg : Math.atan2(pts[j].y - pose.y, pts[j].x - pose.x);
215
+ const dirX = Math.cos(lineHdg);
216
+ const dirY = Math.sin(lineHdg);
217
+ const length = (pts[j].x - pose.x) * dirX + (pts[j].y - pose.y) * dirY;
218
+ if (length < MIN_SEG_LENGTH)
219
+ return null;
220
+ if (!headingOk(j, lineHdg))
221
+ return null;
222
+ for (let k = i; k <= j; k++) {
223
+ const dx = pts[k].x - pose.x;
224
+ const dy = pts[k].y - pose.y;
225
+ const lateral = -dx * dirY + dy * dirX;
226
+ // The final input point is a contact point with the neighbouring road;
227
+ // it must sit on the line (not merely within the band), or an
228
+ // endpoint-exact primitive must take the span instead.
229
+ const tol = k === j && j === m - 1 ? Math.min(posTol, LINE_FINAL_LATERAL_TOL) : posTol;
230
+ if (Math.abs(lateral) > tol)
231
+ return null;
232
+ const longitudinal = dx * dirX + dy * dirY;
233
+ if (longitudinal < -posTol || longitudinal > length + posTol)
234
+ return null;
235
+ }
236
+ return { kind: 'line', s: 0, x: pose.x, y: pose.y, hdg: lineHdg, length };
237
+ };
238
+ /**
239
+ * Arc through the chain pose and the end sample. With chord direction φ and
240
+ * deflection α = φ − hdg, the circle through both endpoints tangent to the
241
+ * start heading has curvature κ = 2·sin(α)/chord and sweeps 2α (classic
242
+ * inscribed-angle relation), so length = 2α/κ.
243
+ */
244
+ const tryArc = (pose, i, j) => {
245
+ const dx = pts[j].x - pose.x;
246
+ const dy = pts[j].y - pose.y;
247
+ const chord = Math.hypot(dx, dy);
248
+ if (chord < MIN_SEG_LENGTH)
249
+ return null;
250
+ const alpha = wrapAngle(Math.atan2(dy, dx) - pose.hdg);
251
+ if (Math.abs(alpha) < 1e-12 || Math.abs(alpha) > MAX_TURN_RAD)
252
+ return null;
253
+ const curvature = (2 * Math.sin(alpha)) / chord;
254
+ if (Math.abs(curvature) < 1e-12)
255
+ return null;
256
+ const length = (alpha * chord) / Math.sin(alpha);
257
+ if (!headingOk(j, pose.hdg + 2 * alpha))
258
+ return null;
259
+ // Center / radius checks for the interior samples.
260
+ const cx = pose.x - Math.sin(pose.hdg) / curvature;
261
+ const cy = pose.y + Math.cos(pose.hdg) / curvature;
262
+ const radius = 1 / Math.abs(curvature);
263
+ const startAngle = Math.atan2(pose.y - cy, pose.x - cx);
264
+ const sweep = curvature * length * Math.sign(curvature); // = |2α|
265
+ const angTol = posTol * Math.abs(curvature) + 1e-9;
266
+ for (let k = i + 1; k < j; k++) {
267
+ const radial = Math.hypot(pts[k].x - cx, pts[k].y - cy) - radius;
268
+ if (Math.abs(radial) > posTol)
269
+ return null;
270
+ // The sample must lie inside the swept sector (guards against samples
271
+ // that are near the circle but on the opposite side).
272
+ const rel = wrapAngle(Math.atan2(pts[k].y - cy, pts[k].x - cx) - startAngle) * Math.sign(curvature);
273
+ if (rel < -angTol || rel > sweep + angTol)
274
+ return null;
275
+ }
276
+ return { kind: 'arc', s: 0, x: pose.x, y: pose.y, hdg: pose.hdg, length, curvature };
277
+ };
278
+ /**
279
+ * Cubic Hermite from the chain pose to the end sample + sampled tangent,
280
+ * expressed in the start-pose frame and emitted as paramPoly3 with
281
+ * pRange="arcLength". The parameter domain is iterated to the curve's
282
+ * actual arc length so evaluating at ds stays close to true arc length;
283
+ * a unit-speed band check rejects fits where that approximation degrades.
284
+ */
285
+ const tryParamPoly3 = (pose, i, j) => {
286
+ const cosH = Math.cos(pose.hdg);
287
+ const sinH = Math.sin(pose.hdg);
288
+ const ex = pts[j].x - pose.x;
289
+ const ey = pts[j].y - pose.y;
290
+ const u1 = ex * cosH + ey * sinH;
291
+ const v1 = -ex * sinH + ey * cosH;
292
+ const theta1 = wrapAngle(hdg[j] - pose.hdg);
293
+ if (u1 < MIN_SEG_LENGTH)
294
+ return null;
295
+ if (Math.abs(theta1) > MAX_TURN_RAD)
296
+ return null;
297
+ // Spans shorter than a few tolerances never need a cubic: the chord line
298
+ // already sits within tolerance, and a Hermite squeezed into a tiny span
299
+ // can only produce huge, meaningless coefficients.
300
+ if (Math.hypot(ex, ey) < 4 * posTol)
301
+ return null;
302
+ const cosT = Math.cos(theta1);
303
+ const sinT = Math.sin(theta1);
304
+ // Hermite boundary conditions with parameter domain [0, L]:
305
+ // u(0)=0, u'(0)=1, u(L)=u1, u'(L)=cosθ1 (aU=0, bU=1)
306
+ // v(0)=0, v'(0)=0, v(L)=v1, v'(L)=sinθ1 (aV=0, bV=0)
307
+ let L = Math.max(u[j] - u[i], Math.hypot(ex, ey));
308
+ if (L < MIN_SEG_LENGTH)
309
+ return null;
310
+ let cU = 0;
311
+ let dU = 0;
312
+ let cV = 0;
313
+ let dV = 0;
314
+ const solve = (dom) => {
315
+ const A = u1 - dom;
316
+ const B = cosT - 1;
317
+ cU = (3 * A - B * dom) / (dom * dom);
318
+ dU = (B * dom - 2 * A) / (dom * dom * dom);
319
+ cV = (3 * v1 - sinT * dom) / (dom * dom);
320
+ dV = (sinT * dom - 2 * v1) / (dom * dom * dom);
321
+ };
322
+ const arcLength = (dom) => {
323
+ const n = Math.max(16, Math.min(512, Math.ceil(dom / 0.25)));
324
+ let acc = 0;
325
+ let px = 0;
326
+ let py = 0;
327
+ for (let k = 1; k <= n; k++) {
328
+ const p = (dom * k) / n;
329
+ const x = p * (1 + p * (cU + p * dU));
330
+ const y = p * p * (cV + p * dV);
331
+ acc += Math.hypot(x - px, y - py);
332
+ px = x;
333
+ py = y;
334
+ }
335
+ return acc;
336
+ };
337
+ for (let iter = 0; iter < 3; iter++) {
338
+ solve(L);
339
+ const actual = arcLength(L);
340
+ if (!(actual > MIN_SEG_LENGTH))
341
+ return null;
342
+ if (Math.abs(actual - L) < 1e-6)
343
+ break;
344
+ L = actual;
345
+ }
346
+ solve(L);
347
+ // Verification sampling of the candidate in inertial coordinates.
348
+ const n = Math.max(8, Math.min(512, Math.ceil(L / 0.5)));
349
+ const curve = [];
350
+ for (let k = 0; k <= n; k++) {
351
+ const p = (L * k) / n;
352
+ const lu = p * (1 + p * (cU + p * dU));
353
+ const lv = p * p * (cV + p * dV);
354
+ curve.push({ x: pose.x + lu * cosH - lv * sinH, y: pose.y + lu * sinH + lv * cosH });
355
+ // Unit-speed band: |r'(p)| must stay near 1 for arcLength pRange.
356
+ const du = 1 + p * (2 * cU + p * 3 * dU);
357
+ const dv = p * (2 * cV + p * 3 * dV);
358
+ const speed = Math.hypot(du, dv);
359
+ if (speed < 0.5 || speed > 1.6)
360
+ return null;
361
+ }
362
+ // Samples -> curve and curve -> samples (the latter catches wiggles
363
+ // between sample stations).
364
+ for (let k = i + 1; k < j; k++) {
365
+ if (distToPolyline(pts[k], curve, 0, curve.length - 1) > posTol)
366
+ return null;
367
+ }
368
+ for (const cp of curve) {
369
+ if (distToPolyline(cp, pts, i, j) > posTol)
370
+ return null;
371
+ }
372
+ return {
373
+ kind: 'paramPoly3',
374
+ s: 0,
375
+ x: pose.x,
376
+ y: pose.y,
377
+ hdg: pose.hdg,
378
+ length: L,
379
+ aU: 0,
380
+ bU: 1,
381
+ cU,
382
+ dU,
383
+ aV: 0,
384
+ bV: 0,
385
+ cV,
386
+ dV,
387
+ pRange: 'arcLength',
388
+ };
389
+ };
390
+ /** Simplest passing primitive for the span [i..j]. */
391
+ const bestFit = (pose, i, j, chained) => tryLine(pose, i, j, chained) ?? tryArc(pose, i, j) ?? tryParamPoly3(pose, i, j);
392
+ // --- Greedy chained segmentation. ------------------------------------------
393
+ const geometries = [];
394
+ const stations = new Array(m);
395
+ stations[0] = 0;
396
+ let pose = { x: pts[0].x, y: pts[0].y, hdg: hdg[0] };
397
+ let sCum = 0;
398
+ let i = 0;
399
+ while (i < m - 1) {
400
+ const chained = geometries.length > 0;
401
+ let fit = bestFit(pose, i, i + 1, chained);
402
+ let j = i + 1;
403
+ if (fit) {
404
+ // Exponential probing for the longest fitting span, then binary search
405
+ // between the last success and the first failure.
406
+ let step = 1;
407
+ while (j < m - 1) {
408
+ step *= 2;
409
+ const probe = Math.min(j + step, m - 1);
410
+ const f = bestFit(pose, i, probe, chained);
411
+ if (f) {
412
+ j = probe;
413
+ fit = f;
414
+ continue;
415
+ }
416
+ let lo = j;
417
+ let hi = probe;
418
+ while (hi - lo > 1) {
419
+ const mid = (lo + hi) >> 1;
420
+ const fm = bestFit(pose, i, mid, chained);
421
+ if (fm) {
422
+ lo = mid;
423
+ fit = fm;
424
+ }
425
+ else {
426
+ hi = mid;
427
+ }
428
+ }
429
+ j = lo;
430
+ break;
431
+ }
432
+ }
433
+ else {
434
+ // Sharp corner / pathological step: degrade to the plain chord line
435
+ // (position-continuous; the heading break stays at the corner).
436
+ const cdx = pts[i + 1].x - pose.x;
437
+ const cdy = pts[i + 1].y - pose.y;
438
+ const chord = Math.hypot(cdx, cdy);
439
+ if (chord < MIN_EMIT_LENGTH) {
440
+ // A sub-millimeter leftover (e.g. chain drift at the very end) is not
441
+ // worth a geometry record; snap the point onto the chain instead.
442
+ stations[i + 1] = sCum;
443
+ i++;
444
+ continue;
445
+ }
446
+ const chordHdg = Math.atan2(cdy, cdx);
447
+ fit = { kind: 'line', s: 0, x: pose.x, y: pose.y, hdg: chordHdg, length: chord };
448
+ }
449
+ fit.s = sCum;
450
+ geometries.push(fit);
451
+ const span = u[j] - u[i];
452
+ for (let k = i + 1; k <= j; k++) {
453
+ stations[k] = span > 0 ? sCum + (fit.length * (u[k] - u[i])) / span : sCum;
454
+ }
455
+ pose = evalGeometry(fit, fit.length);
456
+ sCum += fit.length;
457
+ i = j;
458
+ }
459
+ // --- Poses on the fitted curve for every input sample. ---------------------
460
+ const posesByDedup = new Array(m);
461
+ let gIdx = 0;
462
+ for (let k = 0; k < m; k++) {
463
+ const s = Math.min(stations[k], sCum);
464
+ while (gIdx < geometries.length - 1 && geometries[gIdx + 1].s <= s + 1e-12)
465
+ gIdx++;
466
+ const g = geometries[gIdx];
467
+ const p = evalGeometry(g, Math.min(Math.max(s - g.s, 0), g.length));
468
+ posesByDedup[k] = { s, x: p.x, y: p.y, hdg: p.hdg };
469
+ }
470
+ return {
471
+ geometries,
472
+ samplePoses: dedupIndex.map(d => posesByDedup[d]),
473
+ length: sCum,
474
+ };
475
+ }
476
+ //# sourceMappingURL=odrGeometryFit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odrGeometryFit.js","sourceRoot":"","sources":["../../src/exporter/odrGeometryFit.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oEAAoE;AACpE,oCAAoC;AACpC,EAAE;AACF,uDAAuD;AACvD,8EAA8E;AAC9E,wEAAwE;AACxE,uBAAuB;AACvB,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,sEAAsE;AACtE,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,oEAAoE;AACpE,EAAE;AACF,4BAA4B;AAG5B,OAAO,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAA;AAiC3D,MAAM,cAAc,GAAG,IAAI,CAAA;AAC3B;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,IAAI,CAAA;AACvB,+EAA+E;AAC/E,MAAM,eAAe,GAAG,IAAI,CAAA;AAC5B;;;;;;;GAOG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAA;AACnC,gFAAgF;AAChF,MAAM,YAAY,GAAG,I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AE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAA;IACrD,CAAC;IAED,OAAO;QACL,UAAU;QACV,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,EAAE,IAAI;KACb,CAAA;AACH,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { OdrMap } from './opendriveParser';
2
+ import { type ImportedShapes, type ShapeIdAllocator } from './osmToShapes';
3
+ import { type OdrRoadRecord } from './odrCarryThrough';
4
+ export type { OdrRoadRecord } from './odrCarryThrough';
5
+ /** Sidecar captured at OpenDRIVE import time (for verbatim round-trip export). */
6
+ export interface OdrSidecar {
7
+ rawXml: string;
8
+ originLat: number | null;
9
+ originLon: number | null;
10
+ /**
11
+ * Per source road: the lane shape ids it materialized and a hash of their
12
+ * editable state at import time. `exportToOpenDrive({ sidecar })` re-emits
13
+ * roads whose hash still matches verbatim from `rawXml` (carry-through).
14
+ */
15
+ roadRecords?: Record<string, OdrRoadRecord>;
16
+ }
17
+ export interface OdrImportResult extends ImportedShapes {
18
+ sidecar: OdrSidecar;
19
+ /** Human-readable notes about unsupported features (flattened elevation, etc.). */
20
+ warnings: string[];
21
+ }
22
+ export interface OdrToShapesOptions {
23
+ /** Custom id allocator. A fresh `createShapeIdAllocator()` is used when omitted. */
24
+ idAllocator?: ShapeIdAllocator;
25
+ /** Restrict conversion to the given road ids. When omitted, all roads are converted. */
26
+ selectedRoadIds?: readonly string[];
27
+ /** Maximum chord error for reference-line sampling (m). Default 0.05. */
28
+ maxChordErrorMeters?: number;
29
+ /** Maximum station spacing for reference-line sampling (m). Default 5. */
30
+ maxStepMeters?: number;
31
+ }
32
+ /**
33
+ * Derive a WGS84 origin from an OpenDRIVE <geoReference> PROJ string.
34
+ *
35
+ * Supports `+proj=tmerc +lat_0=.. +lon_0=..` (exact: the projection origin is
36
+ * the local (0, 0)) and `+proj=utm +zone=..` (approximate: the zone's central
37
+ * meridian on the equator; UTM's false easting/northing is not compensated).
38
+ * Returns null when the origin cannot be derived.
39
+ */
40
+ export declare function parseGeoReferenceOrigin(geoReference: string | null): {
41
+ lat: number;
42
+ lon: number;
43
+ approximate: boolean;
44
+ } | null;
45
+ /**
46
+ * Convert a parsed OpenDRIVE map into editor-ready point/linestring/lane
47
+ * records plus a sidecar for round-trip export.
48
+ *
49
+ * Pass `selectedRoadIds` to restrict the conversion to a subset of roads
50
+ * (selective import); leave it `undefined` to import every road.
51
+ */
52
+ export declare function odrToShapes(map: OdrMap, options?: OdrToShapesOptions): OdrImportResult;
53
+ //# sourceMappingURL=odrToShapes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odrToShapes.d.ts","sourceRoot":"","sources":["../../src/exporter/odrToShapes.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAGV,MAAM,EAIP,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAOL,KAAK,cAAc,EAEnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAA;AAE1B,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,OAAO,EAAE,UAAU,CAAA;IACnB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,w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