@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.
@@ -0,0 +1,16 @@
1
+ /** `@margoengine/math`'s MargoErrorCode, repeated here because shared code cannot import the package. */
2
+ export type MargoErrorCode = 'disposed' | 'attached' | 'state' | 'unsupported' | 'failed' | 'timeout' | 'version';
3
+ /** An Error named `MargoError` with `code`: what `new MargoError(code, message)` builds, without the class. */
4
+ export function margoError(code: MargoErrorCode, message: string): Error & { code: MargoErrorCode };
5
+ /** `margoError` whose message links to `anchor` (default the code) on margoengine.com/errors. */
6
+ export function fault(code: MargoErrorCode, message: string, anchor?: string): Error & { code: MargoErrorCode };
7
+ /** TypeError whose message links to `anchor` on margoengine.com/errors. */
8
+ export function typeError(message: string, anchor: string): TypeError;
9
+ /** RangeError whose message links to `anchor` on margoengine.com/errors. */
10
+ export function rangeError(message: string, anchor: string): RangeError;
11
+
12
+ /** Throws a TypeError with code `transform` and the retained-vector help message. */
13
+ export function vectorAssignment(): never;
14
+
15
+ /** Coded error with CSP help for policy-blocked Wasm initialization; other errors pass through. */
16
+ export function wasmError(error: unknown): unknown;
@@ -0,0 +1,91 @@
1
+ import type { Spline } from '@margoengine/splines';
2
+ import type { Geometry } from '@margoengine/core';
3
+ import { type Point3 } from './design-mesh.js';
4
+ /** A bridge or tunnel over an arc-distance interval, in metres. */
5
+ export interface StructureSpan {
6
+ /** Generated structure type. */
7
+ kind: 'bridge' | 'tunnel';
8
+ /** Start distance inclusive. */
9
+ start: number;
10
+ /** End distance inclusive. */
11
+ end: number;
12
+ }
13
+ /** Another road that must stay clear of bridge piers and the underside of the deck. */
14
+ export interface CrossingRoad {
15
+ /** Centreline in the same local coordinate system. */
16
+ curve: Spline;
17
+ /** Driving width, metres. Default 6. */
18
+ width?: number;
19
+ }
20
+ /** Parametric visual structures; these dimensions do not certify engineering capacity. */
21
+ export interface StructureOptions {
22
+ /** Road/deck inside width, metres. Default 6. */
23
+ width?: number;
24
+ /** Ground height(x,z), default flat 0. */
25
+ ground?: (x: number, z: number) => number;
26
+ /** Authored spans replace terrain classification. Default automatically classify terrain and road crossings. */
27
+ spans?: readonly StructureSpan[];
28
+ /** Maximum arc-distance between samples, metres. Default 1. */
29
+ step?: number;
30
+ /** Height over terrain that starts a bridge, metres. Default 3. */
31
+ bridgeHeight?: number;
32
+ /** Deck thickness below road, metres. Default 0.5. */
33
+ deckThickness?: number;
34
+ /** Maximum centre-to-centre support spacing before exclusions, metres. Default 12. */
35
+ supportSpacing?: number;
36
+ /** Square pier width/depth, metres. Default 0.8. Two piers per support row. */
37
+ pierWidth?: number;
38
+ /** Tunnel interior height, metres. Default 5. */
39
+ tunnelHeight?: number;
40
+ /** Shell and portal thickness, metres. Default 0.4. */
41
+ tunnelThickness?: number;
42
+ /** Ground above the outer roof needed to classify a tunnel, metres. Default 1. */
43
+ cover?: number;
44
+ /** Tunnel profile, default arch (elliptical if height < half width). */
45
+ tunnelShape?: 'arch' | 'box';
46
+ /** Chords per half arch, default 16. */
47
+ archSegments?: number;
48
+ /** Other roads for automatic bridge spans and pier exclusion. Default empty. */
49
+ crossings?: readonly CrossingRoad[];
50
+ /** Required vertical clearance below deck at crossings, metres. Default 4.5. */
51
+ clearance?: number;
52
+ /** Horizontal margin beyond crossing road edges, metres. Default 1. */
53
+ crossingMargin?: number;
54
+ /** Checked before and after synchronous geometry work. Default none. */
55
+ signal?: AbortSignal;
56
+ }
57
+ /** One independent CPU layer, possibly empty. */
58
+ export interface StructureMesh {
59
+ /** Owned geometry with hard face normals. */
60
+ geometry: Geometry;
61
+ /** Owned planar UVs in metres. */
62
+ uvs: Float32Array;
63
+ }
64
+ /** An open passage ring for application terrain-cutting or placement. */
65
+ export interface TunnelOpening {
66
+ /** Arc-distance of portal. */
67
+ distance: number;
68
+ /** Inner boundary from the driver's right road edge over the roof to the left road edge. The floor is open. */
69
+ boundary: Point3[];
70
+ /** Normal pointing out of the tunnel. */
71
+ outward: Point3;
72
+ }
73
+ /** Four renderable layers and owned classification/placement metadata. */
74
+ export interface RoadStructures {
75
+ /** Closed bridge slabs: top, bottom, sides and abutment ends. */
76
+ decks: StructureMesh;
77
+ /** Vertical paired piers meeting terrain at their four bottom corners. */
78
+ supports: StructureMesh;
79
+ /** Double-sided-volume tunnel walls and roof, open at both ends and floor. */
80
+ tunnels: StructureMesh;
81
+ /** Separate annular portal end faces, leaving the driving opening clear. */
82
+ portals: StructureMesh;
83
+ /** Sorted merged authored or classified spans. */
84
+ spans: StructureSpan[];
85
+ /** Centre positions of emitted piers at deck underside. */
86
+ supportPositions: Point3[];
87
+ /** Portal boundary rings; application terrain meshes can use these to cut entrances. */
88
+ openings: TunnelOpening[];
89
+ }
90
+ /** Build grade-separated decks, terrain-founded supports and open tunnel shells/portals along a road spline. */
91
+ export declare function structures(curve: Spline, options?: StructureOptions): RoadStructures;
@@ -0,0 +1,229 @@
1
+ import { t as e } from "./frame-AjJIb-k3.js";
2
+ import { n as t, r as n, t as r } from "./design-mesh-DpZRXXz0.js";
3
+ //#region src/structures.ts
4
+ function i(i, a = {}) {
5
+ let { width: o = 6, ground: s = () => 0, spans: c, step: l = 1, bridgeHeight: u = 3, deckThickness: d = .5, supportSpacing: f = 12, pierWidth: p = .8, tunnelHeight: m = 5, tunnelThickness: h = .4, cover: g = 1, tunnelShape: _ = "arch", archSegments: v = 16, crossings: y = [], clearance: b = 4.5, crossingMargin: x = 1, signal: S } = a;
6
+ if (S?.throwIfAborted(), !t(i.length, .01, 1e5) || !t(o, .1, 1e3) || typeof s != "function" || !t(l, .01, 1e3) || !t(u, .1, 1e3) || !t(d, .01, 100) || !t(f, .5, 1e3) || !t(p, .05, o / 2) || !t(m, .5, 100) || !t(h, .01, 100) || !t(g, 0, 1e3) || !t(b, .1, 100) || !t(x, 0, 100) || !["arch", "box"].includes(_) || !Number.isInteger(v) || v < 4 || v > 128 || !Array.isArray(y) || y.length > 64) throw n("Invalid road structure options; use bounded metre dimensions, 4..128 arch segments and at most 64 crossings");
7
+ let C = /* @__PURE__ */ new Float64Array(3), w = /* @__PURE__ */ new Float64Array(3), T = /* @__PURE__ */ new Float64Array(3), E = (t) => {
8
+ e(i, t, Math.min(l * .01, i.length * 1e-5), C, w, T);
9
+ let r = T[0] - w[0], a = T[1] - w[1], o = T[2] - w[2], s = Math.hypot(r, o);
10
+ if (!s || !Math.hypot(r, a, o)) throw n("Road structures need a nonvertical, nonzero tangent; remove the cusp or vertical segment");
11
+ return {
12
+ p: [...C],
13
+ rx: o / s,
14
+ rz: -r / s,
15
+ grade: a / s,
16
+ forward: [
17
+ r / s,
18
+ 0,
19
+ o / s
20
+ ]
21
+ };
22
+ }, D = (e, t, n) => {
23
+ let r = E(e);
24
+ return [
25
+ r.p[0] + r.rx * t,
26
+ r.p[1] + n,
27
+ r.p[2] + r.rz * t
28
+ ];
29
+ }, O = (e, r) => {
30
+ let i = s(e, r);
31
+ if (!t(i, -1e6, 1e6)) throw n("Ground must return finite heights within +/-1000000 metres");
32
+ return i;
33
+ }, k = Math.ceil(i.length / l);
34
+ if (k > 8192) throw n("Road structure sampling exceeds 8192 segments; increase step or split the curve");
35
+ let A = Array.from({ length: k + 1 }, (e, t) => {
36
+ let n = i.length * t / k, r = E(n), a = O(r.p[0], r.p[2]);
37
+ return {
38
+ s: n,
39
+ p: r.p,
40
+ g: a
41
+ };
42
+ }), j = [];
43
+ if (c !== void 0) {
44
+ if (!Array.isArray(c) || c.length > 4096) throw n("Use at most 4096 authored bridge/tunnel spans");
45
+ for (let e of c) {
46
+ if (!e || !["bridge", "tunnel"].includes(e.kind) || !t(e.start, 0, i.length) || !t(e.end, e.start + .001, i.length)) throw n("Structure spans need valid kind and increasing arc distances within the curve");
47
+ j.push({ ...e });
48
+ }
49
+ } else for (let e = 0; e < k; e++) for (let t of ["bridge", "tunnel"]) {
50
+ let n = (e) => t === "bridge" ? e.p[1] - e.g - u : e.g - e.p[1] - m - h - g, r = A[e], i = A[e + 1], a = n(r), o = n(i);
51
+ if (a <= 0 && o <= 0) continue;
52
+ let s = r.s + (i.s - r.s) * a / (a - o);
53
+ j.push({
54
+ kind: t,
55
+ start: a >= 0 ? r.s : s,
56
+ end: o >= 0 ? i.s : s
57
+ });
58
+ }
59
+ let M = [], N = 0;
60
+ for (let e of y) {
61
+ let r = e.width ?? 6, i = e.curve?.length, a = Math.ceil(i / l);
62
+ if (!t(r, .1, 1e3) || !t(i, .01, 1e5) || a > 8192 || M.length + a > 65536) throw n("Crossing roads need bounded width/length and at most 65536 sampled segments total");
63
+ let o = Array.from(e.curve.atDistance(0, /* @__PURE__ */ new Float64Array(3)));
64
+ for (let s = 1; s <= a; s++) {
65
+ let c = Array.from(e.curve.atDistance(i * s / a, /* @__PURE__ */ new Float64Array(3)));
66
+ if (![...o, ...c].every((e) => t(e, -1e6, 1e6))) throw n("Crossing positions must remain finite within +/-1000000 metres");
67
+ M.push({
68
+ a: o,
69
+ b: c,
70
+ width: r
71
+ }), o = c;
72
+ }
73
+ }
74
+ let P = M.slice().sort((e, t) => Math.min(e.a[0], e.b[0]) - Math.min(t.a[0], t.b[0]));
75
+ for (let e = 0; e < k; e++) {
76
+ let t = A[e], r = A[e + 1], a = r.p[0] - t.p[0], o = r.p[2] - t.p[2];
77
+ for (let e of P) {
78
+ if (Math.min(e.a[0], e.b[0]) > Math.max(t.p[0], r.p[0])) break;
79
+ if (Math.max(e.a[0], e.b[0]) < Math.min(t.p[0], r.p[0]) || Math.min(e.a[2], e.b[2]) > Math.max(t.p[2], r.p[2]) || Math.max(e.a[2], e.b[2]) < Math.min(t.p[2], r.p[2])) continue;
80
+ if (++N > 2e6) throw n("Road crossing search exceeds two million candidates; split the road network");
81
+ let s = e.b[0] - e.a[0], l = e.b[2] - e.a[2], u = e.a[0] - t.p[0], f = e.a[2] - t.p[2], m = a * l - o * s;
82
+ if (!m) continue;
83
+ let h = (u * l - f * s) / m, g = (u * o - f * a) / m;
84
+ if (h < 0 || h > 1 || g < 0 || g > 1) continue;
85
+ let _ = t.p[1] + (r.p[1] - t.p[1]) * h, v = e.a[1] + (e.b[1] - e.a[1]) * g;
86
+ if (!(_ <= v)) {
87
+ if (_ - v - d < b) throw n("Road crossing has insufficient deck clearance; raise the road or reduce deck thickness");
88
+ if (c === void 0) {
89
+ let n = t.s + (r.s - t.s) * h, c = Math.abs(m) / Math.hypot(a, o) / Math.hypot(s, l), u = (e.width / 2 + x + p) / c;
90
+ j.push({
91
+ kind: "bridge",
92
+ start: Math.max(0, n - u),
93
+ end: Math.min(i.length, n + u)
94
+ });
95
+ }
96
+ }
97
+ }
98
+ }
99
+ j.sort((e, t) => e.start - t.start || e.end - t.end);
100
+ let F = [];
101
+ for (let e of j) {
102
+ let t = F.at(-1);
103
+ if (t && e.start <= t.end + 1e-9) {
104
+ if (t.kind !== e.kind) throw n("Bridge and tunnel spans overlap; correct the ground or authored spans");
105
+ t.end = Math.max(t.end, e.end);
106
+ } else F.push({ ...e });
107
+ }
108
+ let I = new r(), L = new r(), R = new r(), z = new r(), B = [], V = [], H = 0, U = (e, t, r, i, a) => {
109
+ if (++H > 131072) throw n("Road structures exceed 131072 quads; increase step or reduce geometry");
110
+ e.quad(t, r, i, a);
111
+ }, W = (e, t, r, i = !1) => {
112
+ let a = Math.max(1, Math.ceil((r.end - r.start) / l));
113
+ for (let o = 0; o < a; o++) {
114
+ let s = r.start + (r.end - r.start) * o / a, c = r.start + (r.end - r.start) * (o + 1) / a;
115
+ for (let r = 0; r < t.length - 1; r++) {
116
+ let a = t[r], o = t[r + 1], l = [
117
+ D(s, ...a),
118
+ D(c, ...a),
119
+ D(c, ...o),
120
+ D(s, ...o)
121
+ ];
122
+ if (o[0] !== a[0]) {
123
+ let e = (e, t, n) => (t[2] - e[2]) * (n[0] - e[0]) - (t[0] - e[0]) * (n[2] - e[2]);
124
+ if (e(l[0], l[1], l[2]) * (o[0] - a[0]) <= 0 || e(l[0], l[2], l[3]) * (o[0] - a[0]) <= 0) throw n("Road structure offsets fold on this bend; widen the bend, reduce width or refine step");
125
+ }
126
+ i ? U(e, l[3], l[2], l[1], l[0]) : U(e, l[0], l[1], l[2], l[3]);
127
+ }
128
+ }
129
+ }, G = (e, t, n, r) => M.some((i) => {
130
+ let a = i.b[0] - i.a[0], o = i.b[2] - i.a[2], s = a * a + o * o;
131
+ if (!s) return !1;
132
+ let c = Math.max(0, Math.min(1, ((e - i.a[0]) * a + (n - i.a[2]) * o) / s)), l = i.a[1] + (i.b[1] - i.a[1]) * c;
133
+ return l >= r && l <= t + b && Math.hypot(e - i.a[0] - c * a, n - i.a[2] - c * o) <= i.width / 2 + x + p / Math.SQRT2;
134
+ }), K = (e, t) => {
135
+ let r = E(e), i = r.p[0] + r.rx * t, a = r.p[2] + r.rz * t, o = r.p[1] - d, s = O(i, a);
136
+ if (s >= o) throw n("Bridge pier ground reaches above deck underside; correct the ground or bridge span");
137
+ if (G(i, o, a, s)) return;
138
+ let c = p / 2, l = [-r.rz, r.rx], u = [], f = [];
139
+ for (let [e, t] of [
140
+ [-c, -c],
141
+ [c, -c],
142
+ [c, c],
143
+ [-c, c]
144
+ ]) {
145
+ let s = i + r.rx * e + l[0] * t, c = a + r.rz * e + l[1] * t, d = O(s, c), p = o + r.grade * t;
146
+ if (d >= p) throw n("Ground intersects bridge pier/deck; increase clearance or refine the terrain");
147
+ u.push([
148
+ s,
149
+ d,
150
+ c
151
+ ]), f.push([
152
+ s,
153
+ p,
154
+ c
155
+ ]);
156
+ }
157
+ for (let e = 0; e < 4; e++) {
158
+ let t = (e + 1) % 4;
159
+ U(L, u[e], f[e], f[t], u[t]);
160
+ }
161
+ U(L, f[0], f[3], f[2], f[1]), U(L, u[0], u[1], u[2], u[3]), B.push([
162
+ i,
163
+ o,
164
+ a
165
+ ]);
166
+ };
167
+ for (let e of F) if (e.kind === "bridge") {
168
+ let t = [
169
+ [-o / 2, 0],
170
+ [o / 2, 0],
171
+ [o / 2, -d],
172
+ [-o / 2, -d],
173
+ [-o / 2, 0]
174
+ ];
175
+ W(I, t, e);
176
+ let n = t.slice(0, 4).map((t) => D(e.start, ...t)), r = t.slice(0, 4).map((t) => D(e.end, ...t));
177
+ U(I, n[0], n[1], n[2], n[3]), U(I, r[3], r[2], r[1], r[0]);
178
+ let i = Math.max(1, Math.ceil((e.end - e.start) / f)), a = [
179
+ e.start,
180
+ ...Array.from({ length: i }, (t, n) => e.start + (e.end - e.start) * (n + .5) / i),
181
+ e.end
182
+ ];
183
+ for (let e of a) for (let t of [-o / 4, o / 4]) K(e, t);
184
+ } else {
185
+ let t = Math.max(0, m - o / 2), n = m - t, r = (e) => _ === "box" ? [
186
+ [-o / 2 - e, 0],
187
+ [-o / 2 - e, m + e],
188
+ [o / 2 + e, m + e],
189
+ [o / 2 + e, 0]
190
+ ] : [
191
+ [-o / 2 - e, 0],
192
+ ...t > 0 ? [[-o / 2 - e, t]] : [],
193
+ ...Array.from({ length: v }, (r, i) => {
194
+ let a = Math.PI * (1 - (i + 1) / v);
195
+ return [(o / 2 + e) * Math.cos(a), t + (n + e) * Math.sin(a)];
196
+ }),
197
+ ...t > 0 ? [[o / 2 + e, 0]] : []
198
+ ], i = r(0), a = r(h);
199
+ W(R, i, e, !0), W(R, a, e), W(R, [i[0], a[0]], e), W(R, [a.at(-1), i.at(-1)], e);
200
+ for (let [t, n] of [[e.start, !1], [e.end, !0]]) {
201
+ for (let e = 0; e < i.length - 1; e++) {
202
+ let r = [
203
+ D(t, ...a[e]),
204
+ D(t, ...a[e + 1]),
205
+ D(t, ...i[e + 1]),
206
+ D(t, ...i[e])
207
+ ];
208
+ n ? U(z, r[3], r[2], r[1], r[0]) : U(z, r[0], r[1], r[2], r[3]);
209
+ }
210
+ let e = E(t);
211
+ V.push({
212
+ distance: t,
213
+ boundary: i.map((e) => D(t, ...e)),
214
+ outward: e.forward.map((e) => e * (n ? 1 : -1) + 0)
215
+ });
216
+ }
217
+ }
218
+ return S?.throwIfAborted(), {
219
+ decks: I.finish(),
220
+ supports: L.finish(),
221
+ tunnels: R.finish(),
222
+ portals: z.finish(),
223
+ spans: F,
224
+ supportPositions: B,
225
+ openings: V
226
+ };
227
+ }
228
+ //#endregion
229
+ export { i as structures };
@@ -0,0 +1,16 @@
1
+ import type { Geometry } from '@margoengine/core';
2
+ /** A terrain elevation function in metres, compatible with terrain heightfieldGeometry. */
3
+ export type RoadHeightField = (x: number, z: number) => number;
4
+ /** Cut-and-fill settings for a triangulated road in world coordinates. */
5
+ export interface RoadTerrainOptions {
6
+ /** Original ground elevation. Default flat ground at zero. Must return finite heights within +/-1,000,000 m. */
7
+ base?: RoadHeightField;
8
+ /** Shoulder blending distance outside the footprint, 0..1000 metres. Default 2. */
9
+ shoulder?: number;
10
+ /** Bed distance below the road, 0..100 metres. Default 0. */
11
+ depth?: number;
12
+ /** Cancels before and after lazy BVH loading. Default none. */
13
+ signal?: AbortSignal;
14
+ }
15
+ /** Cut high ground and fill low ground to a road's triangle heights, fading back to base at the shoulder. */
16
+ export declare function fitTerrain(geometry: Geometry, { base, shoulder, depth, signal }?: RoadTerrainOptions): Promise<RoadHeightField>;
@@ -0,0 +1,71 @@
1
+ import { t as e } from "./errors-CsQwshHA.js";
2
+ //#region src/terrain.ts
3
+ async function t(t, { base: n = () => 0, shoulder: r = 2, depth: i = 0, signal: a } = {}) {
4
+ a?.throwIfAborted();
5
+ let o = () => e("failed", "Terrain fit needs a bounded finite road mesh, shoulder 0..1000, depth 0..100 and a finite base height; pass valid world-space geometry and settings", "geometry");
6
+ if (typeof n != "function" || !Number.isFinite(r) || r < 0 || r > 1e3 || !Number.isFinite(i) || i < 0 || i > 100) throw o();
7
+ let s = t?.vertices, c = t?.indices;
8
+ if (!s || s.length % 6 || s.length < 18 || s.length > 6e6 || !c?.length || c.length % 3 || c.length > 3e6) throw o();
9
+ let l = new Float32Array(s.length / 2), u = new Float32Array(s.length / 6);
10
+ for (let e = 0; e < u.length; e++) {
11
+ for (let t = 0; t < 3; t++) if (!Number.isFinite(s[e * 6 + t]) || Math.abs(s[e * 6 + t]) > 1e6) throw o();
12
+ l[e * 3] = s[e * 6], l[e * 3 + 2] = s[e * 6 + 2], u[e] = s[e * 6 + 1];
13
+ }
14
+ let d = [];
15
+ for (let e = 0; e < c.length; e += 3) {
16
+ let t = c[e], n = c[e + 1], r = c[e + 2];
17
+ if (![
18
+ t,
19
+ n,
20
+ r
21
+ ].every((e) => Number.isInteger(e) && e >= 0 && e < u.length)) throw o();
22
+ (l[n * 3] - l[t * 3]) * (l[r * 3 + 2] - l[t * 3 + 2]) - (l[n * 3 + 2] - l[t * 3 + 2]) * (l[r * 3] - l[t * 3]) !== 0 && d.push(t, n, r);
23
+ }
24
+ if (!d.length) throw o();
25
+ let f = Uint32Array.from(d), { MeshBVH: p } = await import("@margoengine/bvh");
26
+ a?.throwIfAborted();
27
+ let m = p.build({
28
+ positions: l,
29
+ indices: f
30
+ }), h = (e, t, n = Infinity) => {
31
+ let r = n;
32
+ for (let n of m.raycast({
33
+ origin: [
34
+ e,
35
+ 1,
36
+ t
37
+ ],
38
+ direction: [
39
+ 0,
40
+ -1,
41
+ 0
42
+ ]
43
+ })) {
44
+ let e = 0;
45
+ for (let t = 0; t < 3; t++) e += u[f[n.faceIndex * 3 + t]] * n.barycoord[t];
46
+ r = Math.min(r, e);
47
+ }
48
+ return r;
49
+ };
50
+ return (e, t) => {
51
+ if (![e, t].every((e) => Number.isFinite(e) && Math.abs(e) <= 1e6)) throw o();
52
+ let a = n(e, t);
53
+ if (!Number.isFinite(a) || Math.abs(a) > 1e6) throw o();
54
+ let s = h(e, t);
55
+ if (s !== Infinity) return s - i;
56
+ if (r === 0) return a;
57
+ let c = m.closestPointToPoint([
58
+ e,
59
+ 0,
60
+ t
61
+ ], { maxDistance: r });
62
+ if (!c) return a;
63
+ let l = 0;
64
+ for (let e = 0; e < 3; e++) l += u[f[c.faceIndex * 3 + e]] * c.barycoord[e];
65
+ l = h(c.point[0], c.point[2], l) - i;
66
+ let d = Math.min(1, c.distance / r), p = d * d * (3 - 2 * d);
67
+ return l + (a - l) * p;
68
+ };
69
+ }
70
+ //#endregion
71
+ export { t as fitTerrain };
package/package.json CHANGED
@@ -1,6 +1,106 @@
1
- {
2
- "name": "@margoengine/road",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@margoengine/road",
3
+ "version": "0.1.0",
4
+ "description": "Arc-length spline road surfaces, raised curbs and tiled UVs.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "3d",
9
+ "road"
10
+ ],
11
+ "homepage": "https://margoengine.com",
12
+ "bugs": {
13
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
18
+ "directory": "packages/road"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "author": "Scott Campbell",
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./junctions": {
30
+ "types": "./dist/junctions.d.ts",
31
+ "import": "./dist/junctions.js"
32
+ },
33
+ "./driving": {
34
+ "types": "./dist/driving.d.ts",
35
+ "import": "./dist/driving.js"
36
+ },
37
+ "./banking": {
38
+ "types": "./dist/banking.d.ts",
39
+ "import": "./dist/banking.js"
40
+ },
41
+ "./terrain": {
42
+ "types": "./dist/terrain.d.ts",
43
+ "import": "./dist/terrain.js"
44
+ },
45
+ "./repair": {
46
+ "types": "./dist/repair.d.ts",
47
+ "import": "./dist/repair.js"
48
+ },
49
+ "./markings": {
50
+ "types": "./dist/markings.d.ts",
51
+ "import": "./dist/markings.js"
52
+ },
53
+ "./graph": {
54
+ "types": "./dist/graph.d.ts",
55
+ "import": "./dist/graph.js"
56
+ },
57
+ "./intersections": {
58
+ "types": "./dist/intersections.d.ts",
59
+ "import": "./dist/intersections.js"
60
+ },
61
+ "./lanes": {
62
+ "types": "./dist/lanes.d.ts",
63
+ "import": "./dist/lanes.js"
64
+ },
65
+ "./geojson": {
66
+ "types": "./dist/geojson.d.ts",
67
+ "import": "./dist/geojson.js"
68
+ },
69
+ "./structures": {
70
+ "types": "./dist/structures.d.ts",
71
+ "import": "./dist/structures.js"
72
+ }
73
+ },
74
+ "files": [
75
+ "dist",
76
+ "LICENSE",
77
+ "NOTICE"
78
+ ],
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "dependencies": {
83
+ "@margoengine/math": "^0.1.0",
84
+ "@margoengine/splines": "^0.1.0",
85
+ "@margoengine/geometry": "^0.1.0",
86
+ "@margoengine/bvh": "^0.1.0",
87
+ "@margoengine/post": "^0.1.0",
88
+ "@margoengine/compute": "^0.1.0"
89
+ },
90
+ "peerDependencies": {
91
+ "@margoengine/core": "^0.1.0",
92
+ "@margoengine/physics": "^0.1.0"
93
+ },
94
+ "peerDependenciesMeta": {
95
+ "@margoengine/physics": {
96
+ "optional": true
97
+ }
98
+ },
99
+ "scripts": {
100
+ "build": "node ../../scripts/build-optional.js road",
101
+ "test": "npm run build && node --test test/*.test.js tests/coupling/*.test.js",
102
+ "prepack": "npm run build",
103
+ "test:gpu": "node test/browser-check.mjs",
104
+ "test:browser:driving": "node test/driving-browser.mjs"
105
+ }
106
+ }