@margoengine/road 0.0.0-stage → 0.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +206 -3
- package/dist/banking.d.ts +11 -0
- package/dist/banking.js +45 -0
- package/dist/design-mesh-DpZRXXz0.js +38 -0
- package/dist/design-mesh.d.ts +17 -0
- package/dist/drive-path.d.ts +49 -0
- package/dist/driving.d.ts +4 -0
- package/dist/driving.js +438 -0
- package/dist/errors-CsQwshHA.js +7 -0
- package/dist/frame-AjJIb-k3.js +9 -0
- package/dist/frame.d.ts +3 -0
- package/dist/geojson.d.ts +66 -0
- package/dist/geojson.js +375 -0
- package/dist/graph.d.ts +31 -0
- package/dist/graph.js +29 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +114 -0
- package/dist/intersections.d.ts +38 -0
- package/dist/intersections.js +100 -0
- package/dist/junctions.d.ts +33 -0
- package/dist/junctions.js +68 -0
- package/dist/lanes.d.ts +73 -0
- package/dist/lanes.js +100 -0
- package/dist/markings.d.ts +27 -0
- package/dist/markings.js +53 -0
- package/dist/repair.d.ts +11 -0
- package/dist/repair.js +23 -0
- package/dist/road-driver.d.ts +88 -0
- package/dist/road-surface.d.ts +32 -0
- package/dist/road-vehicle.d.ts +25 -0
- package/dist/shared/errors.d.ts +16 -0
- package/dist/structures.d.ts +91 -0
- package/dist/structures.js +229 -0
- package/dist/terrain.d.ts +16 -0
- package/dist/terrain.js +71 -0
- package/package.json +106 -6
package/dist/geojson.js
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { n as e, r as t } from "./design-mesh-DpZRXXz0.js";
|
|
2
|
+
import { Spline as n } from "@margoengine/splines";
|
|
3
|
+
//#region src/geojson.ts
|
|
4
|
+
var r = (e) => {
|
|
5
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw t("Invalid road document; supply GeoJSON, OSM XML or Overpass elements");
|
|
6
|
+
return e;
|
|
7
|
+
}, i = (e) => {
|
|
8
|
+
if (typeof e != "string" && typeof e != "number" || String(e) === "" || typeof e == "number" && !Number.isSafeInteger(e)) throw t("Invalid OSM identifier; use a nonempty string or safe integer");
|
|
9
|
+
return String(e);
|
|
10
|
+
}, a = (e) => Object.fromEntries(Object.entries(e == null ? {} : r(e)).filter(([, e]) => [
|
|
11
|
+
"string",
|
|
12
|
+
"number",
|
|
13
|
+
"boolean"
|
|
14
|
+
].includes(typeof e)).map(([e, t]) => [e, String(t)])), o = (e) => e !== void 0 && ![
|
|
15
|
+
"no",
|
|
16
|
+
"false",
|
|
17
|
+
"0"
|
|
18
|
+
].includes(e), s = (e) => {
|
|
19
|
+
if (!Array.isArray(e) || e.length !== 2 && e.length !== 3 || !e.every((e) => typeof e == "number" && Number.isFinite(e))) throw t("Road coordinates need finite [longitude,latitude,altitude?] positions");
|
|
20
|
+
return [...e.slice(0, 2), e[2] ?? 0];
|
|
21
|
+
}, c = (e) => {
|
|
22
|
+
if (e === void 0) return;
|
|
23
|
+
let t = /^\s*(\d+(?:\.\d+)?)'\s*(?:(\d+(?:\.\d+)?)"?)?\s*$/.exec(e);
|
|
24
|
+
if (t) return Number(t[1]) * .3048 + Number(t[2] ?? 0) * .0254;
|
|
25
|
+
let n = /^\s*(\d+(?:\.\d+)?)\s*(m|ft|feet|metres|meters)?\s*$/.exec(e);
|
|
26
|
+
return n ? Number(n[1]) * (n[2] === "ft" || n[2] === "feet" ? .3048 : 1) : void 0;
|
|
27
|
+
};
|
|
28
|
+
function l(n, r, i) {
|
|
29
|
+
let a = n.tags, s = a.highway ?? "unclassified", l = [
|
|
30
|
+
"footway",
|
|
31
|
+
"cycleway",
|
|
32
|
+
"path",
|
|
33
|
+
"pedestrian",
|
|
34
|
+
"steps",
|
|
35
|
+
"bridleway"
|
|
36
|
+
].includes(s), u = r.defaults?.[s] ?? {
|
|
37
|
+
lanes: ["service", "track"].includes(s) || l ? 1 : 2,
|
|
38
|
+
laneWidth: l ? 1.5 : ["service", "track"].includes(s) ? 3 : 3.5
|
|
39
|
+
};
|
|
40
|
+
if (!Number.isInteger(u.lanes) || !e(u.lanes, 1, 32) || !e(u.laneWidth, .1, 100)) throw t("Invalid highway defaults; use 1..32 lanes and lane widths 0.1..100 metres");
|
|
41
|
+
let d = (t) => t !== void 0 && /^\d+$/.test(t) && e(Number(t), 1, 32) ? Number(t) : void 0, f = [
|
|
42
|
+
"lanes:forward",
|
|
43
|
+
"lanes:backward",
|
|
44
|
+
"lanes:both_ways"
|
|
45
|
+
].map((e) => d(a[e]) ?? 0).reduce((e, t) => e + t, 0), p = d(a.lanes) ?? (f || u.lanes);
|
|
46
|
+
if (a.lanes !== void 0 && d(a.lanes) === void 0 && i.push(`${n.id}: invalid lanes tag; used fallback`), p > 32) throw t("Road lane count exceeds 32; correct the lane tags");
|
|
47
|
+
let m = a["width:lanes"]?.split("|").map((e) => e.trim() === "" ? u.laneWidth : c(e));
|
|
48
|
+
m && (m.length !== p || m.some((t) => t === void 0 || !e(t, .1, 100))) && (i.push(`${n.id}: invalid width:lanes; used total/default width`), m = void 0);
|
|
49
|
+
let h = c(a.width);
|
|
50
|
+
if (a.width !== void 0 && (h === void 0 || !e(h, .1, 1e3)) && (i.push(`${n.id}: invalid width; used lane widths`), h = void 0), h ??= m?.reduce((e, t) => e + t, 0) ?? p * u.laneWidth, !e(h, .1, 1e3)) throw t("Imported road width exceeds 1000 metres; correct width or lanes");
|
|
51
|
+
let g = m?.reduce((e, t) => e + t, 0) ?? h, _ = m ? m.map((e) => e * h / g) : Array(p).fill(h / p), v = o(a.bridge), y = o(a.tunnel), b = a.layer === void 0 ? v ? 1 : y ? -1 : 0 : Number(a.layer);
|
|
52
|
+
if (!Number.isInteger(b) || !e(b, -100, 100)) throw t("Invalid road layer; use an integer in -100..100");
|
|
53
|
+
let x = "both";
|
|
54
|
+
return [
|
|
55
|
+
"yes",
|
|
56
|
+
"true",
|
|
57
|
+
"1"
|
|
58
|
+
].includes(a.oneway) || a.oneway === void 0 && (a.junction === "roundabout" || s === "motorway") ? x = "forward" : a.oneway === "-1" || a.oneway === "reverse" ? x = "reverse" : a.oneway !== void 0 && ![
|
|
59
|
+
"no",
|
|
60
|
+
"false",
|
|
61
|
+
"0"
|
|
62
|
+
].includes(a.oneway) && i.push(`${n.id}: dynamic/unknown oneway ${a.oneway}; retained both directions`), {
|
|
63
|
+
width: h,
|
|
64
|
+
lanes: p,
|
|
65
|
+
laneWidths: _,
|
|
66
|
+
direction: x,
|
|
67
|
+
layer: b,
|
|
68
|
+
bridge: v,
|
|
69
|
+
tunnel: y
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function u(e, n = {}) {
|
|
73
|
+
n.signal?.throwIfAborted();
|
|
74
|
+
let i = [], o = (e, n = {}, c = "feature", l = 0) => {
|
|
75
|
+
if (l > 32) throw t("GeoJSON nesting exceeds 32 levels; flatten the geometry collections");
|
|
76
|
+
let u = r(e);
|
|
77
|
+
if (u.type === "FeatureCollection") {
|
|
78
|
+
if (!Array.isArray(u.features)) throw t("GeoJSON FeatureCollection needs a features array");
|
|
79
|
+
u.features.forEach((e, t) => o(e, {}, String(t), l + 1));
|
|
80
|
+
} else if (u.type === "Feature") u.geometry !== null && o(u.geometry, {
|
|
81
|
+
...a(u.properties),
|
|
82
|
+
...a(u.properties == null ? void 0 : r(u.properties).tags)
|
|
83
|
+
}, typeof u.id == "string" || typeof u.id == "number" ? String(u.id) : c, l + 1);
|
|
84
|
+
else if (u.type === "GeometryCollection") {
|
|
85
|
+
if (!Array.isArray(u.geometries)) throw t("GeoJSON GeometryCollection needs geometries");
|
|
86
|
+
u.geometries.forEach((e, t) => o(e, n, `${c}/${t}`, l + 1));
|
|
87
|
+
} else if (u.type === "LineString" || u.type === "MultiLineString") {
|
|
88
|
+
let e = u.type === "LineString" ? [u.coordinates] : u.coordinates;
|
|
89
|
+
if (!Array.isArray(e)) throw t("GeoJSON road needs coordinate arrays");
|
|
90
|
+
for (let [o, l] of e.entries()) {
|
|
91
|
+
if (!Array.isArray(l) || l.length < 2) throw t("GeoJSON road needs at least two positions");
|
|
92
|
+
i.push({
|
|
93
|
+
id: u.type === "LineString" ? c : `${c}/${o}`,
|
|
94
|
+
coordinates: l.map(s),
|
|
95
|
+
tags: {
|
|
96
|
+
...n,
|
|
97
|
+
...a(r(u).tags)
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
} else if (![
|
|
102
|
+
"Point",
|
|
103
|
+
"MultiPoint",
|
|
104
|
+
"Polygon",
|
|
105
|
+
"MultiPolygon"
|
|
106
|
+
].includes(String(u.type))) throw t("Unsupported GeoJSON type; supply standard GeoJSON geometries");
|
|
107
|
+
if (i.length > 65536) throw t("Road import exceeds 65536 source lines; split the dataset");
|
|
108
|
+
};
|
|
109
|
+
return o(e), f(i, n, !1);
|
|
110
|
+
}
|
|
111
|
+
function d(n, o = {}) {
|
|
112
|
+
o.signal?.throwIfAborted();
|
|
113
|
+
let c = typeof n == "string" ? m(n) : r(n).elements;
|
|
114
|
+
if (!Array.isArray(c) || c.length > 1e6) throw t("OSM import needs up to one million nodes/ways in XML or Overpass elements");
|
|
115
|
+
let l = /* @__PURE__ */ new Map(), u = [], d = /* @__PURE__ */ new Set();
|
|
116
|
+
for (let e of c) {
|
|
117
|
+
let n = r(e);
|
|
118
|
+
if (n.type !== "node" && n.type !== "way") continue;
|
|
119
|
+
let o = i(n.id), c = `${n.type}/${o}`;
|
|
120
|
+
if (d.has(c)) throw t("Duplicate OSM identity; import one snapshot, not history");
|
|
121
|
+
d.add(c), n.visible !== !1 && n.visible !== "false" && (n.type === "node" ? l.set(o, {
|
|
122
|
+
p: s([n.lon, n.lat]),
|
|
123
|
+
tags: a(n.tags)
|
|
124
|
+
}) : u.push(n));
|
|
125
|
+
}
|
|
126
|
+
let p = [];
|
|
127
|
+
for (let n of u) {
|
|
128
|
+
let r = a(n.tags);
|
|
129
|
+
if (!r.highway || r.area === "yes") continue;
|
|
130
|
+
if (!Array.isArray(n.nodes) || n.nodes.length < 2) throw t("OSM road way needs two or more node references");
|
|
131
|
+
let o = n.nodes.map(i), s = o.map((n) => {
|
|
132
|
+
let r = l.get(n);
|
|
133
|
+
if (!r) throw t(`OSM road references missing node ${n}; download complete ways`);
|
|
134
|
+
let i = r.tags.ele, a = i === void 0 ? 0 : /^[+-]?\d+(?:\.\d+)?(?:\s*m)?$/.test(i.trim()) ? Number(i.replace(/\s*m$/, "")) : NaN;
|
|
135
|
+
if (!e(a, -1e5, 1e5)) throw t("Invalid OSM elevation; supply signed metres within +/-100000");
|
|
136
|
+
return [
|
|
137
|
+
r.p[0],
|
|
138
|
+
r.p[1],
|
|
139
|
+
a
|
|
140
|
+
];
|
|
141
|
+
});
|
|
142
|
+
p.push({
|
|
143
|
+
id: `way/${i(n.id)}`,
|
|
144
|
+
coordinates: s,
|
|
145
|
+
ids: o,
|
|
146
|
+
tags: r
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return f(p, o, !0);
|
|
150
|
+
}
|
|
151
|
+
function f(r, i, a) {
|
|
152
|
+
let { signal: o, project: c, crossingHeight: u = .5 } = i;
|
|
153
|
+
if (!e(u, 0, 100) || c !== void 0 && typeof c != "function") throw t("Invalid import options; use a projector function and crossingHeight 0..100 metres");
|
|
154
|
+
let d = c ? null : s(i.origin ?? r[0]?.coordinates[0] ?? [
|
|
155
|
+
0,
|
|
156
|
+
0,
|
|
157
|
+
0
|
|
158
|
+
]), f = (n) => {
|
|
159
|
+
if (!e(n[0], -180, 180) || !e(n[1], -90, 90) || !e(n[2], -1e5, 1e5)) throw t("Invalid WGS84 position; use lon +/-180, lat +/-90, altitude +/-100000");
|
|
160
|
+
}, m = (e) => {
|
|
161
|
+
f(e);
|
|
162
|
+
let t = e[0] * Math.PI / 180, n = e[1] * Math.PI / 180, r = Math.sin(n), i = 6378137 / Math.sqrt(1 - .0066943799901413165 * r * r);
|
|
163
|
+
return [
|
|
164
|
+
(i + e[2]) * Math.cos(n) * Math.cos(t),
|
|
165
|
+
(i + e[2]) * Math.cos(n) * Math.sin(t),
|
|
166
|
+
(i * .9933056200098587 + e[2]) * r
|
|
167
|
+
];
|
|
168
|
+
}, h = d ? m(d) : [
|
|
169
|
+
0,
|
|
170
|
+
0,
|
|
171
|
+
0
|
|
172
|
+
], g = (d?.[0] ?? 0) * Math.PI / 180, _ = (d?.[1] ?? 0) * Math.PI / 180, v = (n) => {
|
|
173
|
+
let r;
|
|
174
|
+
if (c) r = c([...n]);
|
|
175
|
+
else {
|
|
176
|
+
let e = m(n).map((e, t) => e - h[t]), t = -Math.sin(g) * e[0] + Math.cos(g) * e[1], i = -Math.sin(_) * Math.cos(g) * e[0] - Math.sin(_) * Math.sin(g) * e[1] + Math.cos(_) * e[2];
|
|
177
|
+
r = [
|
|
178
|
+
t,
|
|
179
|
+
Math.cos(_) * Math.cos(g) * e[0] + Math.cos(_) * Math.sin(g) * e[1] + Math.sin(_) * e[2],
|
|
180
|
+
-i
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
if (!Array.isArray(r) || r.length !== 3 || !r.every((t) => e(t, -1e6, 1e6))) throw t("Projected road must stay within +/-1000000 metres; choose a nearby origin");
|
|
184
|
+
return r.map((e) => e + 0);
|
|
185
|
+
}, y = [], b = [], x = (e, t) => `g/${t}/${e.map((e) => e.toFixed(6)).join("/")}`, S = 0;
|
|
186
|
+
for (let e of r) {
|
|
187
|
+
if ((S += e.coordinates.length) > 1e6) throw t("Road import exceeds one million positions; split the dataset");
|
|
188
|
+
let n = l(e, i, y), r = e.coordinates.map(v);
|
|
189
|
+
for (let t = 0; t < r.length - 1; t++) {
|
|
190
|
+
let i = r[t], o = r[t + 1];
|
|
191
|
+
if (i.every((e, t) => e === o[t])) {
|
|
192
|
+
y.push(`${e.id}: omitted zero-length segment ${t}`);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
let s = a ? `n/${e.ids[t]}` : x(i, n.layer), c = a ? `n/${e.ids[t + 1]}` : x(o, n.layer);
|
|
196
|
+
b.push({
|
|
197
|
+
source: e,
|
|
198
|
+
a: i,
|
|
199
|
+
b: o,
|
|
200
|
+
ka: s,
|
|
201
|
+
kb: c,
|
|
202
|
+
meta: n,
|
|
203
|
+
cuts: [{
|
|
204
|
+
t: 0,
|
|
205
|
+
p: i,
|
|
206
|
+
key: s
|
|
207
|
+
}, {
|
|
208
|
+
t: 1,
|
|
209
|
+
p: o,
|
|
210
|
+
key: c
|
|
211
|
+
}]
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
a || p(b, u, x);
|
|
216
|
+
let C = [], w = [], T = /* @__PURE__ */ new Map(), E = (e, n) => {
|
|
217
|
+
let r = T.get(e);
|
|
218
|
+
if (r === void 0) {
|
|
219
|
+
if (C.length >= 65536) throw t("Road network exceeds 65536 nodes; split the dataset");
|
|
220
|
+
r = C.length, T.set(e, r), C.push([...n]);
|
|
221
|
+
}
|
|
222
|
+
return r;
|
|
223
|
+
};
|
|
224
|
+
for (let e of b) {
|
|
225
|
+
e.cuts.sort((e, t) => e.t - t.t);
|
|
226
|
+
for (let r = 0; r < e.cuts.length - 1; r++) {
|
|
227
|
+
let i = e.cuts[r], a = e.cuts[r + 1];
|
|
228
|
+
if (i.key === a.key || i.t === a.t) continue;
|
|
229
|
+
let o = E(i.key, i.p), s = E(a.key, a.p), c = [[...C[o]], [...C[s]]];
|
|
230
|
+
if (w.length >= 65536) throw t("Road network exceeds 65536 edges; split the dataset");
|
|
231
|
+
w.push({
|
|
232
|
+
...e.meta,
|
|
233
|
+
laneWidths: [...e.meta.laneWidths],
|
|
234
|
+
sourceId: e.source.id,
|
|
235
|
+
from: o,
|
|
236
|
+
to: s,
|
|
237
|
+
points: c,
|
|
238
|
+
curve: new n(c),
|
|
239
|
+
tags: { ...e.source.tags }
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return o?.throwIfAborted(), {
|
|
244
|
+
nodes: C,
|
|
245
|
+
roads: w,
|
|
246
|
+
origin: r.length ? d : null,
|
|
247
|
+
warnings: y
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function p(e, n, r) {
|
|
251
|
+
let i = e.slice().sort((e, t) => Math.min(e.a[0], e.b[0]) - Math.min(t.a[0], t.b[0])), a = 0, o = /* @__PURE__ */ new Map(), s = (e) => {
|
|
252
|
+
let t = [];
|
|
253
|
+
for (; o.has(e);) t.push(e), e = o.get(e);
|
|
254
|
+
for (let n of t) o.set(n, e);
|
|
255
|
+
return e;
|
|
256
|
+
}, c = (e, t) => e.a.map((n, r) => n + (e.b[r] - n) * t), l = (e, t) => {
|
|
257
|
+
let n = 1e-6 / Math.hypot(e.b[0] - e.a[0], e.b[2] - e.a[2]);
|
|
258
|
+
return Math.abs(t) <= n ? 0 : Math.abs(t - 1) <= n ? 1 : t;
|
|
259
|
+
}, u = (e, t, i, a) => {
|
|
260
|
+
if (i = l(e, i), a = l(t, a), i < 0 || i > 1 || a < 0 || a > 1) return;
|
|
261
|
+
let u = c(e, i), d = c(t, a);
|
|
262
|
+
if (Math.abs(u[1] - d[1]) > n) return;
|
|
263
|
+
let f = i === 0 ? e.ka : i === 1 ? e.kb : void 0, p = a === 0 ? t.ka : a === 1 ? t.kb : void 0, m = s(f ?? p ?? r(u, e.meta.layer)), h = i === 0 ? e.a : i === 1 ? e.b : a === 0 ? t.a : a === 1 ? t.b : u;
|
|
264
|
+
f && s(f) !== m && o.set(s(f), m), p && s(p) !== m && o.set(s(p), m), e.cuts.push({
|
|
265
|
+
t: i,
|
|
266
|
+
p: h,
|
|
267
|
+
key: m
|
|
268
|
+
}), t.cuts.push({
|
|
269
|
+
t: a,
|
|
270
|
+
p: h,
|
|
271
|
+
key: m
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
for (let e = 0; e < i.length; e++) {
|
|
275
|
+
let n = i[e], r = Math.max(n.a[0], n.b[0]);
|
|
276
|
+
for (let o = e + 1; o < i.length; o++) {
|
|
277
|
+
let e = i[o];
|
|
278
|
+
if (Math.min(e.a[0], e.b[0]) > r) break;
|
|
279
|
+
if (++a > 2e6) throw t("GeoJSON crossing search exceeds two million candidates; spatially tile the input");
|
|
280
|
+
if (n.meta.layer !== e.meta.layer || Math.max(n.a[2], n.b[2]) < Math.min(e.a[2], e.b[2]) || Math.max(e.a[2], e.b[2]) < Math.min(n.a[2], n.b[2])) continue;
|
|
281
|
+
let s = n.b[0] - n.a[0], l = n.b[2] - n.a[2], d = e.b[0] - e.a[0], f = e.b[2] - e.a[2], p = e.a[0] - n.a[0], m = e.a[2] - n.a[2], h = s * f - l * d;
|
|
282
|
+
if (h !== 0) u(n, e, (p * f - m * d) / h, (p * l - m * s) / h);
|
|
283
|
+
else if (p * l - m * s === 0) {
|
|
284
|
+
let t = s * s + l * l, r = d * d + f * f;
|
|
285
|
+
if (!t || !r) continue;
|
|
286
|
+
for (let t of [0, 1]) {
|
|
287
|
+
let i = c(n, t);
|
|
288
|
+
u(n, e, t, ((i[0] - e.a[0]) * d + (i[2] - e.a[2]) * f) / r);
|
|
289
|
+
}
|
|
290
|
+
for (let r of [0, 1]) {
|
|
291
|
+
let i = c(e, r);
|
|
292
|
+
u(n, e, ((i[0] - n.a[0]) * s + (i[2] - n.a[2]) * l) / t, r);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
for (let t of e) for (let e of t.cuts) e.key = s(e.key);
|
|
298
|
+
}
|
|
299
|
+
function m(e) {
|
|
300
|
+
if (e.length > 33554432 || /<!DOCTYPE|<!ENTITY/i.test(e)) throw t("OSM XML exceeds 32 MiB or contains a DTD; use a bounded plain OSM snapshot");
|
|
301
|
+
let n = [], r = [], i = /<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<(?:"[^"]*"|'[^']*'|[^'">])*>|[^<]+/g, a, o = 0, s = !1, c = (e) => {
|
|
302
|
+
if (/&(?![^&;]+;)/.test(e)) throw t("Unescaped XML ampersand; use an XML entity");
|
|
303
|
+
return e.replace(/&([^;]+);/g, (e, n) => {
|
|
304
|
+
let r = {
|
|
305
|
+
amp: "&",
|
|
306
|
+
lt: "<",
|
|
307
|
+
gt: ">",
|
|
308
|
+
quot: "\"",
|
|
309
|
+
apos: "'"
|
|
310
|
+
};
|
|
311
|
+
if (Object.hasOwn(r, n)) return r[n];
|
|
312
|
+
if (/^#(?:\d+|x[\da-f]+)$/i.test(n)) {
|
|
313
|
+
let e = n[1].toLowerCase() === "x" ? parseInt(n.slice(2), 16) : Number(n.slice(1));
|
|
314
|
+
if (e > 0 && e <= 1114111 && !(e >= 55296 && e <= 57343)) return String.fromCodePoint(e);
|
|
315
|
+
}
|
|
316
|
+
throw t("Invalid XML entity; use standard or numeric entities");
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
for (let l of e.matchAll(i)) {
|
|
320
|
+
if (l.index !== o) throw t("Malformed OSM XML; fix incomplete markup");
|
|
321
|
+
o = l.index + l[0].length;
|
|
322
|
+
let e = l[0];
|
|
323
|
+
if (e.startsWith("<!--") || e.startsWith("<?")) continue;
|
|
324
|
+
if (!e.startsWith("<")) {
|
|
325
|
+
if (!r.length && e.trim()) throw t("OSM XML has text outside its root");
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (e.startsWith("</")) {
|
|
329
|
+
let n = e.slice(2, -1).trim();
|
|
330
|
+
if (r.pop() !== n) throw t("OSM XML closing tag mismatch; supply well-formed XML");
|
|
331
|
+
(n === "node" || n === "way") && (a = void 0);
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
let i = /^<([\w:.-]+)([\s\S]*?)(\/?)>$/.exec(e);
|
|
335
|
+
if (!i) throw t("Invalid OSM XML tag; supply well-formed XML");
|
|
336
|
+
let [, u, d, f] = i, p = Object.create(null), m = /\s+([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gy, h = 0;
|
|
337
|
+
for (; h < d.length;) {
|
|
338
|
+
m.lastIndex = h;
|
|
339
|
+
let e = m.exec(d);
|
|
340
|
+
if (!e) {
|
|
341
|
+
if (d.slice(h).trim() === "") break;
|
|
342
|
+
throw t("Invalid OSM XML attributes; quote each value");
|
|
343
|
+
}
|
|
344
|
+
if (Object.hasOwn(p, e[1])) throw t("Duplicate XML attribute; supply well-formed XML");
|
|
345
|
+
p[e[1]] = c(e[2] ?? e[3]), h = m.lastIndex;
|
|
346
|
+
}
|
|
347
|
+
if (!r.length) {
|
|
348
|
+
if (s || u !== "osm") throw t("OSM XML needs one osm root");
|
|
349
|
+
s = !0;
|
|
350
|
+
}
|
|
351
|
+
let g = r.at(-1);
|
|
352
|
+
if (g === "osm" && (u === "node" || u === "way")) {
|
|
353
|
+
if (a = {
|
|
354
|
+
...p,
|
|
355
|
+
type: u,
|
|
356
|
+
tags: Object.create(null)
|
|
357
|
+
}, u === "node") {
|
|
358
|
+
if (!p.lon?.trim() || !p.lat?.trim()) throw t("OSM node needs numeric longitude and latitude");
|
|
359
|
+
a.lon = Number(p.lon), a.lat = Number(p.lat);
|
|
360
|
+
} else a.nodes = [];
|
|
361
|
+
n.push(a);
|
|
362
|
+
} else if (a && g === a.type && u === "tag") {
|
|
363
|
+
if (p.k === void 0 || p.v === void 0) throw t("OSM tag needs k and v");
|
|
364
|
+
a.tags[p.k] = p.v;
|
|
365
|
+
} else if (a && g === "way" && u === "nd") {
|
|
366
|
+
if (p.ref === void 0) throw t("OSM nd needs a ref");
|
|
367
|
+
a.nodes.push(p.ref);
|
|
368
|
+
}
|
|
369
|
+
if (f ? (u === "node" || u === "way") && (a = void 0) : r.push(u), n.length > 1e6) throw t("OSM XML exceeds one million elements; split the dataset");
|
|
370
|
+
}
|
|
371
|
+
if (o !== e.length || r.length || !s) throw t("Truncated OSM XML; supply a complete osm document");
|
|
372
|
+
return n;
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
export { u as importGeoJSON, d as importOSM };
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComputeContext } from '@margoengine/compute';
|
|
2
|
+
import type { CsrMatrix } from '@margoengine/compute/sparse';
|
|
3
|
+
import type { Spline } from '@margoengine/splines';
|
|
4
|
+
/** One road between explicitly authored junction vertices. Units are metres and seconds. */
|
|
5
|
+
export interface RoadLink {
|
|
6
|
+
/** Junction at the spline start, an integer vertex index. */
|
|
7
|
+
from: number;
|
|
8
|
+
/** Junction at the spline end, an integer vertex index. */
|
|
9
|
+
to: number;
|
|
10
|
+
/** Centre line; its existing arc length determines travel time. */
|
|
11
|
+
curve: Spline;
|
|
12
|
+
/** Metres per second, finite and positive. Default 50 / 3.6 (50 km/h). */
|
|
13
|
+
speed?: number;
|
|
14
|
+
/** Allowed travel relative to from/to. Default 'both'. */
|
|
15
|
+
direction?: 'both' | 'forward' | 'reverse';
|
|
16
|
+
/** Travel time multiplier, finite and at least 1. Default 1. */
|
|
17
|
+
traffic?: number;
|
|
18
|
+
/** Additional finite nonnegative seconds, applied in each allowed direction. Default 0. */
|
|
19
|
+
delay?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Explicit topology and road costs. No spatial welding or intersection detection occurs. */
|
|
22
|
+
export interface RoadGraphOptions {
|
|
23
|
+
/** Number of junction vertices, an integer 0..65536. Includes isolated vertices. */
|
|
24
|
+
vertices: number;
|
|
25
|
+
/** At most 65536 roads; omit closed roads. Empty by default. */
|
|
26
|
+
roads?: readonly RoadLink[];
|
|
27
|
+
/** Checks before input reading and before synchronous upload. Default none. */
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
/** Build a caller-owned compute graph with travel seconds as weights; reuse compute/graph for routing. */
|
|
31
|
+
export declare function roadGraph(gpu: ComputeContext, { vertices, roads, signal }: RoadGraphOptions): CsrMatrix;
|
package/dist/graph.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as e } from "./errors-CsQwshHA.js";
|
|
2
|
+
import { graph as t } from "@margoengine/compute/graph";
|
|
3
|
+
//#region src/graph.ts
|
|
4
|
+
function n(n, { vertices: r, roads: i = [], signal: a }) {
|
|
5
|
+
a?.throwIfAborted();
|
|
6
|
+
let o = () => e("failed", "Road graph needs 0..65536 vertices/roads, valid junction indices, positive finite lengths/speeds and normal float32 travel seconds", "road");
|
|
7
|
+
if (!Number.isInteger(r) || r < 0 || r > 65536 || !Array.isArray(i) || i.length > 65536) throw o();
|
|
8
|
+
let s = [], c = [], l = [];
|
|
9
|
+
for (let e of i) {
|
|
10
|
+
if (!e) throw o();
|
|
11
|
+
let { from: t, to: n, curve: i, speed: a = 50 / 3.6, direction: u = "both", traffic: d = 1, delay: f = 0 } = e, p = i?.length;
|
|
12
|
+
if (![t, n].every((e) => Number.isInteger(e) && e >= 0 && e < r) || ![p, a].every((e) => Number.isFinite(e) && e > 0) || !Number.isFinite(d) || d < 1 || !Number.isFinite(f) || f < 0 || ![
|
|
13
|
+
"both",
|
|
14
|
+
"forward",
|
|
15
|
+
"reverse"
|
|
16
|
+
].includes(u)) throw o();
|
|
17
|
+
let m = Math.fround(p / a * d + f);
|
|
18
|
+
if (!(m >= 2 ** -126 && m <= 2 ** 127 / Math.max(1, r))) throw o();
|
|
19
|
+
u !== "reverse" && (s.push(t), c.push(n), l.push(m)), u !== "forward" && (s.push(n), c.push(t), l.push(m));
|
|
20
|
+
}
|
|
21
|
+
return a?.throwIfAborted(), t(n, {
|
|
22
|
+
vertices: r,
|
|
23
|
+
sources: s,
|
|
24
|
+
targets: c,
|
|
25
|
+
weights: l
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n as roadGraph };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Geometry } from '@margoengine/core';
|
|
2
|
+
import type { Spline } from '@margoengine/splines';
|
|
3
|
+
/** Options for `road`. Lengths are world units; invalid values throw a RangeError. */
|
|
4
|
+
export interface RoadOptions {
|
|
5
|
+
/** Driving surface width, positive. Default 6. */
|
|
6
|
+
width?: number;
|
|
7
|
+
/** Width of each curb, positive. Default 0.2. */
|
|
8
|
+
curbWidth?: number;
|
|
9
|
+
/** Curb height above the surface, positive. Default 0.15. */
|
|
10
|
+
curbHeight?: number;
|
|
11
|
+
/** Samples along the spline, an integer 1..4096. Default 128. */
|
|
12
|
+
segments?: number;
|
|
13
|
+
/** World units per UV repeat, across and along the road. Default 5. */
|
|
14
|
+
uvMeters?: number;
|
|
15
|
+
/** Lateral offset and height pairs (2..32, no consecutive duplicates) replacing the default curbed profile built from the widths above. Positive offsets lie on the driver's left (up x tangent, Y-up right-handed), as in `lanes`. */
|
|
16
|
+
crossSection?: readonly (readonly [number, number])[];
|
|
17
|
+
}
|
|
18
|
+
/** Result of `road`. */
|
|
19
|
+
export interface RoadMesh {
|
|
20
|
+
/** Swept surface with per-strip normals. */
|
|
21
|
+
geometry: Geometry;
|
|
22
|
+
/** u, v per vertex: distance across the section and along the spline, divided by `uvMeters`. */
|
|
23
|
+
uvs: Float32Array;
|
|
24
|
+
/** Copy of the cross-section used. */
|
|
25
|
+
section: readonly (readonly [number, number])[];
|
|
26
|
+
}
|
|
27
|
+
/** Options of {@link roadPath}: the road's own options, plus a clear margin each side. */
|
|
28
|
+
export interface RoadPathOptions extends Pick<RoadOptions, 'width' | 'curbWidth' | 'crossSection' | 'segments'> {
|
|
29
|
+
/** Extra ground kept clear on each side, world units, 0 or more. Default 0.5. */
|
|
30
|
+
margin?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A road's centreline as XZ points with the width it covers (both curbs and `margin` each side), the shape
|
|
34
|
+
* `Scatter`'s `paths` option from `@margoengine/scatter` takes, so grass, trees and rocks keep off the road:
|
|
35
|
+
* `Scatter.attach(engine, tree, { paths: [roadPath(curve, { width: 6 })] })`. Sampled by arc length like `road`;
|
|
36
|
+
* an asymmetric `crossSection` keeps its wider side clear on both.
|
|
37
|
+
*/
|
|
38
|
+
export declare function roadPath(curve: Spline, { width, curbWidth, crossSection, segments, margin }?: RoadPathOptions): {
|
|
39
|
+
points: [number, number][];
|
|
40
|
+
width: number;
|
|
41
|
+
};
|
|
42
|
+
/** Sweep lateral offset/height pairs along an arc-length sampled, Y-up spline. */
|
|
43
|
+
export declare function road(curve: Spline, { width, curbWidth, curbHeight, segments, uvMeters, crossSection }?: RoadOptions): RoadMesh;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as e } from "./frame-AjJIb-k3.js";
|
|
2
|
+
import { t } from "./errors-CsQwshHA.js";
|
|
3
|
+
import { Geometry as n } from "@margoengine/core";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
function r(e, { width: t = 6, curbWidth: n = .2, crossSection: r, segments: i = 128, margin: a = .5 } = {}) {
|
|
6
|
+
if (![
|
|
7
|
+
t,
|
|
8
|
+
n,
|
|
9
|
+
e.length
|
|
10
|
+
].every((e) => Number.isFinite(e) && e > 0) || !(Number.isFinite(a) && a >= 0) || !Number.isInteger(i) || i < 1 || i > 4096 || r !== void 0 && (r.length < 2 || r.some((e) => e.length !== 2 || !e.every(Number.isFinite)))) throw RangeError("Road path width, curbWidth and the curve length must be finite and above 0, margin 0 or more, segments an integer from 1 to 4096 and crossSection finite [x, y] points; fix the options.");
|
|
11
|
+
let o = r ? Math.max(...r.map((e) => Math.abs(e[0]))) : t / 2 + n, s = /* @__PURE__ */ new Float64Array(3), c = [];
|
|
12
|
+
for (let t = 0; t <= i; t++) e.atDistance(e.length * t / i, s), c.push([s[0], s[2]]);
|
|
13
|
+
return {
|
|
14
|
+
points: c,
|
|
15
|
+
width: 2 * (o + a)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function i(r, { width: i = 6, curbWidth: a = .2, curbHeight: o = .15, segments: s = 128, uvMeters: c = 5, crossSection: l } = {}) {
|
|
19
|
+
if (![
|
|
20
|
+
i,
|
|
21
|
+
a,
|
|
22
|
+
o,
|
|
23
|
+
c,
|
|
24
|
+
r.length
|
|
25
|
+
].every((e) => Number.isFinite(e) && e > 0) || !Number.isInteger(s) || s < 1 || s > 4096) throw RangeError("Road width, curbWidth, curbHeight, uvMeters and the curve length must be finite and above 0, and segments an integer from 1 to 4096; fix the road options.");
|
|
26
|
+
let u = l ?? [
|
|
27
|
+
[-i / 2 - a, 0],
|
|
28
|
+
[-i / 2 - a, o],
|
|
29
|
+
[-i / 2, o],
|
|
30
|
+
[-i / 2, 0],
|
|
31
|
+
[i / 2, 0],
|
|
32
|
+
[i / 2, o],
|
|
33
|
+
[i / 2 + a, o],
|
|
34
|
+
[i / 2 + a, 0]
|
|
35
|
+
];
|
|
36
|
+
if (u.length < 2 || u.length > 32 || u.some((e) => e.length !== 2 || !e.every(Number.isFinite))) throw RangeError("Road crossSection needs 2 to 32 [x, y] points with finite numbers; pass fewer, finite points.");
|
|
37
|
+
let d = u.length - 1, f = d * 2, p = (s + 1) * f, m = new Float32Array(p * 3), h = new Float32Array(p * 3), g = new Float32Array(p * 2), _ = new Uint32Array(s * d * 6), v = new Float64Array(u.length);
|
|
38
|
+
for (let e = 1; e < u.length; e++) {
|
|
39
|
+
let t = Math.hypot(u[e][0] - u[e - 1][0], u[e][1] - u[e - 1][1]);
|
|
40
|
+
if (!t) throw RangeError("Road crossSection has two equal neighbouring points; remove the duplicate point.");
|
|
41
|
+
v[e] = v[e - 1] + t;
|
|
42
|
+
}
|
|
43
|
+
let y = /* @__PURE__ */ new Float64Array(3), b = /* @__PURE__ */ new Float64Array(3), x = /* @__PURE__ */ new Float64Array(3), S = r.length / s * .01, C = new Float64Array((s + 1) * 8), w = new Float64Array((s + 1) * 2).fill(1), T = Math.max(0, ...u.map((e) => -e[0])), E = Math.max(0, ...u.map((e) => e[0]));
|
|
44
|
+
for (let n = 0; n <= s; n++) {
|
|
45
|
+
let i = r.length * n / s;
|
|
46
|
+
e(r, i, S, y, b, x);
|
|
47
|
+
let a = x[0] - b[0], o = x[1] - b[1], c = x[2] - b[2], l = Math.hypot(a, c), u = Math.hypot(a, o, c);
|
|
48
|
+
if (l < 1e-10 || !u) throw t("unsupported", "Road spline needs a nonvertical tangent; use a nonvertical Y-up road", "geometry");
|
|
49
|
+
let d = c / l, f = -a / l;
|
|
50
|
+
a /= u, o /= u, c /= u, C.set([
|
|
51
|
+
y[0],
|
|
52
|
+
y[1],
|
|
53
|
+
y[2],
|
|
54
|
+
d,
|
|
55
|
+
f,
|
|
56
|
+
a,
|
|
57
|
+
o,
|
|
58
|
+
c
|
|
59
|
+
], n * 8);
|
|
60
|
+
}
|
|
61
|
+
for (let e = 0; e <= s; e++) {
|
|
62
|
+
let n = e === s && r.closed ? 0 : e, i = n === 0 ? r.closed ? s - 1 : 0 : n - 1, a = n === s ? s : n + 1, o = n * 8, c = i * 8, l = a * 8, u = [
|
|
63
|
+
C[o] - C[c],
|
|
64
|
+
C[o + 1] - C[c + 1],
|
|
65
|
+
C[o + 2] - C[c + 2]
|
|
66
|
+
], d = [
|
|
67
|
+
C[l] - C[o],
|
|
68
|
+
C[l + 1] - C[o + 1],
|
|
69
|
+
C[l + 2] - C[o + 2]
|
|
70
|
+
], f = Math.hypot(...u), p = Math.hypot(...d), m = u.map((e, t) => (f ? e / f : 0) + (p ? d[t] / p : 0)), h = Math.hypot(m[0], m[2]), g = Math.hypot(...m);
|
|
71
|
+
if (!h || !g) throw t("unsupported", "Road spline needs a nonvertical, nonreversing tangent; remove the spline cusp", "geometry");
|
|
72
|
+
C.set([
|
|
73
|
+
m[2] / h,
|
|
74
|
+
-m[0] / h,
|
|
75
|
+
m[0] / g,
|
|
76
|
+
m[1] / g,
|
|
77
|
+
m[2] / g
|
|
78
|
+
], e * 8 + 3);
|
|
79
|
+
}
|
|
80
|
+
for (let e = 0; e < s; e++) {
|
|
81
|
+
let n = e * 8, r = n + 8, i = C[r] - C[n], a = C[r + 2] - C[n + 2], o = C[n + 3] * a - C[n + 4] * i, s = C[r + 3] * a - C[r + 4] * i, c = C[n + 3] * C[r + 4] - C[n + 4] * C[r + 3];
|
|
82
|
+
if (!(o > 0 && s > 0)) throw t("failed", "Road sample rows reverse or coincide; increase segments or remove a spline cusp", "geometry");
|
|
83
|
+
if (c === 0) continue;
|
|
84
|
+
let l = c > 0 ? 0 : 1, u = l === 0 ? T : E;
|
|
85
|
+
if (!u) continue;
|
|
86
|
+
let d = .95 / (Math.abs(c) * u);
|
|
87
|
+
w[e * 2 + l] = Math.min(w[e * 2 + l], s * d), w[(e + 1) * 2 + l] = Math.min(w[(e + 1) * 2 + l], o * d);
|
|
88
|
+
}
|
|
89
|
+
if (r.closed) for (let e = 0; e < 2; e++) {
|
|
90
|
+
let t = Math.min(w[e], w[s * 2 + e]);
|
|
91
|
+
w[e] = w[s * 2 + e] = t;
|
|
92
|
+
}
|
|
93
|
+
for (let e = 0; e <= s; e++) {
|
|
94
|
+
let t = e * 8, n = r.length * e / s, i = C[t + 3], a = C[t + 4], o = C[t + 5], l = C[t + 6], p = C[t + 7], y = (t) => t * w[e * 2 + (t < 0 ? 0 : 1)];
|
|
95
|
+
for (let r = 0; r < d; r++) {
|
|
96
|
+
let b = y(u[r + 1][0]) - y(u[r][0]), x = u[r + 1][1] - u[r][1], S = l * a * b - p * x, w = (p * i - o * a) * b, T = o * x - l * i * b, E = Math.hypot(S, w, T);
|
|
97
|
+
for (let o = 0; o < 2; o++) {
|
|
98
|
+
let s = e * f + r * 2 + o, l = u[r + o], d = s * 3, p = s * 2;
|
|
99
|
+
m[d] = C[t] + i * y(l[0]), m[d + 1] = C[t + 1] + l[1], m[d + 2] = C[t + 2] + a * y(l[0]), h[d] = S / E, h[d + 1] = w / E, h[d + 2] = T / E, g[p] = v[r + o] / c, g[p + 1] = n / c;
|
|
100
|
+
}
|
|
101
|
+
if (e < s) {
|
|
102
|
+
let t = e * f + r * 2, n = t + f, i = (e * d + r) * 6;
|
|
103
|
+
_[i] = t, _[i + 1] = n, _[i + 2] = t + 1, _[i + 3] = t + 1, _[i + 4] = n, _[i + 5] = n + 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
geometry: new n(m, h, _),
|
|
109
|
+
uvs: g,
|
|
110
|
+
section: u.map((e) => [...e])
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { i as road, r as roadPath };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Polygon, PolygonCap, PolygonJoin } from '@margoengine/geometry/polygon';
|
|
2
|
+
import type { JunctionRoad, JunctionMesh } from './junctions.js';
|
|
3
|
+
/** All dimensions are metres. The shared height field makes at-grade crossing heights agree. */
|
|
4
|
+
export interface IntersectionOptions {
|
|
5
|
+
/** Boundary join. Default round. */
|
|
6
|
+
join?: PolygonJoin;
|
|
7
|
+
/** Road end style. Default round. */
|
|
8
|
+
cap?: PolygonCap;
|
|
9
|
+
/** Miter ratio before bevel fallback. Default 4. */
|
|
10
|
+
miterLimit?: number;
|
|
11
|
+
/** Circular curb-return radius at concave corners. Default 2; 0 keeps sharp corners. */
|
|
12
|
+
turnRadius?: number;
|
|
13
|
+
/** Largest circular arc chord error, metres. Default 0.02. */
|
|
14
|
+
arcTolerance?: number;
|
|
15
|
+
/** Constant height or shared ground height(x,z). Default 0. Evaluated at triangulation vertices. */
|
|
16
|
+
elevation?: number | ((x: number, z: number) => number);
|
|
17
|
+
/** Width outside the road. Default 0.2. */
|
|
18
|
+
curbWidth?: number;
|
|
19
|
+
/** Height above road/ground. Default 0.15. */
|
|
20
|
+
curbHeight?: number;
|
|
21
|
+
/** Width beyond curb. Default 1.8; 0 omits sidewalk. */
|
|
22
|
+
sidewalkWidth?: number;
|
|
23
|
+
/** Metres per planar UV repeat. Default 1. */
|
|
24
|
+
uvMeters?: number;
|
|
25
|
+
/** Checked around lazy loading and before return. Default none. */
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
/** CPU design layers with independent mesh ownership. */
|
|
29
|
+
export interface IntersectionMesh extends JunctionMesh {
|
|
30
|
+
/** Separate curb top and vertical road-facing riser, or null when curbWidth is zero. */
|
|
31
|
+
curb: JunctionMesh | null;
|
|
32
|
+
/** Raised sidewalk outside the curb, or null when sidewalkWidth is zero. */
|
|
33
|
+
sidewalk: JunctionMesh | null;
|
|
34
|
+
/** Caller-owned road footprint, coordinates [x,-z], including courtyard holes. */
|
|
35
|
+
footprint: Polygon[];
|
|
36
|
+
}
|
|
37
|
+
/** Unite road footprints, design curb returns, and lift road, curbs and sidewalks onto shared sloping ground. */
|
|
38
|
+
export declare function intersections(roads: readonly JunctionRoad[], options?: IntersectionOptions): Promise<IntersectionMesh>;
|