@khr3/core 0.1.5 → 0.2.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 (44) hide show
  1. package/README.md +3 -114
  2. package/dist/BundleSceneHost-DUqqPtJF.js +1036 -0
  3. package/dist/BundleSceneHost-DUqqPtJF.js.map +1 -0
  4. package/dist/KhrCollider.d.ts +1 -1
  5. package/dist/KhrVehicle.d.ts +5 -7
  6. package/dist/PhysicsWorld.d.ts +2 -2
  7. package/dist/assemblyPlan.d.ts +2 -0
  8. package/dist/curves.d.ts +11 -32
  9. package/dist/curves.js +141 -139
  10. package/dist/curves.js.map +1 -0
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +1639 -1240
  13. package/dist/index.js.map +1 -0
  14. package/dist/jointDynamics.d.ts +1 -1
  15. package/dist/khrBundleFinalize.d.ts +14 -0
  16. package/dist/khrConfigTypes.d.ts +62 -0
  17. package/dist/khrExportEncoders.d.ts +8 -0
  18. package/dist/khrExporter.d.ts +2 -1
  19. package/dist/khrExtras.d.ts +3 -3
  20. package/dist/khrGlb.d.ts +23 -0
  21. package/dist/khrJointParser.d.ts +3 -0
  22. package/dist/khrLoader.d.ts +2 -1
  23. package/dist/khrParsers.d.ts +5 -9
  24. package/dist/khrPlugin.d.ts +2 -3
  25. package/dist/khrPluginHelpers.d.ts +4 -0
  26. package/dist/khrRotorDecoders.d.ts +4 -0
  27. package/dist/khrShapeParser.d.ts +8 -0
  28. package/dist/khrTypes.d.ts +11 -103
  29. package/dist/khrVehicleChassis.d.ts +9 -17
  30. package/dist/khrVehicleJointHelpers.d.ts +24 -0
  31. package/dist/khrVehicleJoints.d.ts +18 -0
  32. package/dist/khrVehicleRotors.d.ts +22 -0
  33. package/dist/khrVehicleSlots.d.ts +19 -15
  34. package/dist/khrVehicleTypes.d.ts +52 -0
  35. package/dist/pacejka.d.ts +1 -1
  36. package/dist/physicsEcs.d.ts +2 -7
  37. package/dist/useKhrGlb.d.ts +2 -2
  38. package/dist/vehicle.d.ts +2 -2
  39. package/dist/vehicle.js +757 -451
  40. package/dist/vehicle.js.map +1 -0
  41. package/dist/wheelLoads.d.ts +4 -7
  42. package/docs/api-reference.md +209 -0
  43. package/package.json +8 -7
  44. package/dist/BundleSceneHost-CE3HPB8a.js +0 -556
package/dist/curves.js CHANGED
@@ -1,156 +1,179 @@
1
1
  // src/pacejka.ts
2
- var e = Math.PI * .5;
3
- function t(t, n, r, i = 100, a = "lng") {
4
- let o = (t) => a === "lat" ? Math.sin(e * t) : t, s = (t) => a === "lat" ? e * Math.cos(e * t) : 1, c = (e) => {
5
- let n = t * o(e);
6
- return n - r * (n - Math.atan(n));
7
- }, l = (e) => Math.sin(n * Math.atan(c(e))), u = 1, d = n > 1 ? Math.tan(Math.PI / (2 * n)) : Infinity;
8
- if (c(1) >= d) {
9
- let e = 0, t = 1;
10
- for (let n = 0; n < 48; n++) {
11
- let n = .5 * (e + t);
12
- c(n) < d ? e = n : t = n;
2
+ var HALF_PI = Math.PI * .5;
3
+ var MIN_KNOT_SPACING = .01;
4
+ var MAX_TANGENT_SECANT_RATIO = 2.85;
5
+ var MAX_RAD = 1.54;
6
+ function clamp(v, lo, hi) {
7
+ return v < lo ? lo : v > hi ? hi : v;
8
+ }
9
+ function uVal(x, axis) {
10
+ return axis === "lat" ? Math.sin(HALF_PI * x) : x;
11
+ }
12
+ function duVal(x, axis) {
13
+ return axis === "lat" ? HALF_PI * Math.cos(HALF_PI * x) : 1;
14
+ }
15
+ function pacejkaPhi(u, B, E) {
16
+ const bu = B * u;
17
+ return bu - E * (bu - Math.atan(bu));
18
+ }
19
+ function pacejkaYRaw(u, B, C, E) {
20
+ return Math.sin(C * Math.atan(pacejkaPhi(u, B, E)));
21
+ }
22
+ function pacejkaSlopeX(x, B, C, E, axis) {
23
+ const u = uVal(x, axis);
24
+ const bu = B * u;
25
+ const phi = pacejkaPhi(u, B, E);
26
+ const dphiDu = B * (1 - E + E / (1 + bu * bu));
27
+ return C * Math.cos(C * Math.atan(phi)) / (1 + phi * phi) * dphiDu * duVal(x, axis);
28
+ }
29
+ /**
30
+ * Exact 8-knot Fritsch-Carlson monotone Pacejka Magic Formula compiler for `ecctrl/curves`.
31
+ * - `"lng"`: `u = x` matching `ShapeCastWheel` `lngSlipRatio = |w*R - vx| / |vx|`.
32
+ * - `"lat"`: `u = sin((pi/2) * x)` matching `ShapeCastWheel` `latSlipRatio = atan2(|vy|, |vx|) / (pi/2)`.
33
+ */
34
+ function compilePacejkaCurve(B, C, E, samples = 100, axis = "lng") {
35
+ let xPeak = 1;
36
+ if (C > 1) {
37
+ const targetPhi = Math.tan(Math.PI / (2 * C));
38
+ if (pacejkaPhi(1, B, E) >= targetPhi) {
39
+ let lo = 0;
40
+ let hi = 1;
41
+ for (let iter = 0; iter < 48; iter++) {
42
+ const mid = .5 * (lo + hi);
43
+ if (pacejkaPhi(uVal(mid, axis), B, E) >= targetPhi) hi = mid;
44
+ else lo = mid;
45
+ }
46
+ xPeak = hi;
13
47
  }
14
- u = .5 * (e + t);
15
48
  }
16
- let f = Math.max(l(u), 1e-6), p = (e) => {
17
- let i = t * o(e), a = i - r * (i - Math.atan(i)), c = Math.atan(a), l = Math.sin(n * c) / f, u = t * s(e) * (1 - r * i * i / (1 + i * i));
18
- return [l, n * Math.cos(n * c) * u / ((1 + a * a) * f)];
19
- }, m = 1 - u, h = Number(u.toFixed(3)), g = [
49
+ const yPeakRaw = pacejkaYRaw(uVal(xPeak, axis), B, C, E);
50
+ const invYMax = yPeakRaw > 1e-6 ? 1 / yPeakRaw : 1;
51
+ const rawKnots = [
20
52
  0,
21
- Number((.32 * u).toFixed(3)),
22
- Number((.68 * u).toFixed(3))
23
- ].filter((e, t, n) => e < h - .01 && (t === 0 || e - n[t - 1] >= .01)), _ = [
24
- Number((u + .06 * m).toFixed(3)),
25
- Number((u + .18 * m).toFixed(3)),
26
- Number((u + .48 * m).toFixed(3))
27
- ].filter((e, t, n) => e > h + .01 && e < .99 && (t === 0 || e - n[t - 1] >= .01)), v = h >= .99 ? [...g, 1] : [
28
- ...g,
29
- h,
30
- ..._,
53
+ .32 * xPeak,
54
+ .68 * xPeak,
55
+ xPeak,
56
+ xPeak + .06 * (1 - xPeak),
57
+ xPeak + .18 * (1 - xPeak),
58
+ xPeak + .48 * (1 - xPeak),
31
59
  1
32
- ], y = (e) => Number(Math.max(0, Math.min(1, e)).toFixed(4)), b = v.map((e) => {
33
- if (Math.abs(e - h) < 1e-6) return {
34
- x: e,
35
- y: 1,
36
- m: 0,
37
- isPeak: !0
38
- };
39
- if (e === 0) return {
40
- x: 0,
41
- y: 0,
42
- m: p(0)[1],
43
- isPeak: !1
44
- };
45
- let [t, n] = p(e);
46
- return {
47
- x: e,
48
- y: y(t),
49
- m: t <= 0 || t >= 1 ? 0 : n,
50
- isPeak: !1
51
- };
60
+ ];
61
+ const knots = [0];
62
+ for (let i = 1; i < rawKnots.length - 1; i++) {
63
+ const k = rawKnots[i];
64
+ if (k - knots[knots.length - 1] >= MIN_KNOT_SPACING && 1 - k >= MIN_KNOT_SPACING) knots.push(k);
65
+ }
66
+ knots.push(1);
67
+ const ys = knots.map((x) => {
68
+ if (x === xPeak && C > 1 && yPeakRaw > 1e-6 && pacejkaPhi(1, B, E) >= Math.tan(Math.PI / (2 * C))) return 1;
69
+ return pacejkaYRaw(uVal(x, axis), B, C, E) * invYMax;
52
70
  });
53
- for (let e = 0; e < b.length - 1; e++) {
54
- let t = (b[e + 1].y - b[e].y) / (b[e + 1].x - b[e].x);
55
- if (Math.abs(t) < 1e-9) b[e].m = 0, b[e + 1].m = 0;
56
- else for (let n of [e, e + 1]) {
57
- let e = b[n].m / t;
58
- e < 0 ? b[n].m = 0 : e > 2.85 && (b[n].m = 2.85 * t);
71
+ const secants = [];
72
+ for (let i = 0; i < knots.length - 1; i++) secants.push((ys[i + 1] - ys[i]) / (knots[i + 1] - knots[i]));
73
+ const slopes = knots.map((x, i) => {
74
+ if (x === xPeak && x < 1) return 0;
75
+ const mRaw = pacejkaSlopeX(x, B, C, E, axis) * invYMax;
76
+ if (i === 0) {
77
+ const s = secants[0];
78
+ if (Math.abs(s) <= 1e-9) return 0;
79
+ return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;
59
80
  }
60
- }
81
+ if (i === knots.length - 1) {
82
+ const s = secants[secants.length - 1];
83
+ if (Math.abs(s) <= 1e-9) return 0;
84
+ return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;
85
+ }
86
+ const sL = secants[i - 1];
87
+ const sR = secants[i];
88
+ if (sL * sR <= 0 || Math.abs(sL) <= 1e-9 || Math.abs(sR) <= 1e-9) return 0;
89
+ const minS = Math.abs(sL) <= Math.abs(sR) ? sL : sR;
90
+ return clamp(mRaw / minS, 0, MAX_TANGENT_SECANT_RATIO) * minS;
91
+ });
61
92
  return {
62
- points: b.map((e, t) => {
63
- let n = Number(Math.max(-1.54, Math.min(1.54, Math.atan(e.m))).toFixed(4));
64
- return t === 0 ? {
65
- x: 0,
66
- y: 0,
67
- r_out: n,
68
- w_out: 1
69
- } : t === b.length - 1 ? {
70
- x: 1,
71
- y: e.y,
72
- r_in: n,
73
- w_in: 1
74
- } : e.isPeak ? {
75
- x: e.x,
76
- y: 1,
77
- r_in: 0,
78
- r_out: 0,
79
- w_in: 1,
80
- w_out: 1
81
- } : {
82
- x: e.x,
83
- y: e.y,
84
- r_in: n,
85
- r_out: n,
86
- w_in: 1,
87
- w_out: 1
93
+ points: knots.map((x, i) => {
94
+ const ang = clamp(Math.atan(slopes[i]), -1.54, MAX_RAD);
95
+ const pt = {
96
+ x: Number(x.toFixed(6)),
97
+ y: Number(ys[i].toFixed(6))
88
98
  };
99
+ if (i > 0) {
100
+ pt.r_in = Number(ang.toFixed(6));
101
+ pt.w_in = 1;
102
+ }
103
+ if (i < knots.length - 1) {
104
+ pt.r_out = Number(ang.toFixed(6));
105
+ pt.w_out = 1;
106
+ }
107
+ return pt;
89
108
  }),
90
- samples: i
109
+ samples
91
110
  };
92
111
  }
93
- function n(e, t = .5) {
94
- return Number(Math.max(0, 2 * e - t).toFixed(4));
112
+ /** Inverts `ShapeCastWheel` `(rayHitFriction + tireGripFactor) * 0.5 = muPeak`. */
113
+ function tireGripForSurface(muPeakLng, groundColliderFriction = .5) {
114
+ return Number((2 * muPeakLng - groundColliderFriction).toFixed(4));
95
115
  }
96
- function r(e, t) {
97
- return Number((e * t / 7022).toFixed(1));
116
+ /** Converts physical peak engine torque (N*m) into `carConfig.engineHorsepower` (`T * RPM / 7022`). */
117
+ function engineHorsepowerForPeakTorque(peakTorqueNm, engineMaxRPM) {
118
+ return Number((peakTorqueNm * engineMaxRPM / 7022).toFixed(1));
98
119
  }
99
120
  // src/curves.ts
100
- var i = {
121
+ var TIRE_ARCHETYPES = {
101
122
  hypercarDry: {
102
- lng: t(11.2, 1.54, -.45, 100, "lng"),
103
- lat: t(11.6, 1.5, -.4, 100, "lat"),
123
+ lng: compilePacejkaCurve(11.2, 1.54, -.45, 100, "lng"),
124
+ lat: compilePacejkaCurve(11.6, 1.5, -.4, 100, "lat"),
104
125
  muPeakLng: 1.38,
105
126
  latFrictionEllipseScale: .97,
106
127
  relaxLngRate: .04,
107
128
  relaxLatRate: .06
108
129
  },
109
130
  streetDrift90s: {
110
- lng: t(8.8, 1.5, -.15, 80, "lng"),
111
- lat: t(9.2, 1.44, -.12, 80, "lat"),
131
+ lng: compilePacejkaCurve(8.8, 1.5, -.15, 80, "lng"),
132
+ lat: compilePacejkaCurve(9.2, 1.44, -.12, 80, "lat"),
112
133
  muPeakLng: 1.08,
113
134
  latFrictionEllipseScale: .97,
114
135
  relaxLngRate: .05,
115
136
  relaxLatRate: .1
116
137
  },
117
138
  offroad6x6At: {
118
- lng: t(6.2, 1.48, -.35, 80, "lng"),
119
- lat: t(6.6, 1.48, -.3, 80, "lat"),
139
+ lng: compilePacejkaCurve(6.2, 1.48, -.35, 80, "lng"),
140
+ lat: compilePacejkaCurve(6.6, 1.48, -.3, 80, "lat"),
120
141
  muPeakLng: .85,
121
142
  latFrictionEllipseScale: .87,
122
143
  relaxLngRate: .12,
123
144
  relaxLatRate: .24
124
145
  },
125
146
  gravelRally: {
126
- lng: t(5.8, 1.26, -.45, 80, "lng"),
127
- lat: t(6.4, 1.28, -.4, 80, "lat"),
147
+ lng: compilePacejkaCurve(5.8, 1.26, -.45, 80, "lng"),
148
+ lat: compilePacejkaCurve(6.4, 1.28, -.4, 80, "lat"),
128
149
  muPeakLng: .74,
129
150
  latFrictionEllipseScale: .92,
130
151
  relaxLngRate: .08,
131
152
  relaxLatRate: .16
132
153
  },
133
154
  wetAsphalt: {
134
- lng: t(12.8, 1.66, -.6, 100, "lng"),
135
- lat: t(12.2, 1.62, -.55, 100, "lat"),
155
+ lng: compilePacejkaCurve(12.8, 1.66, -.6, 100, "lng"),
156
+ lat: compilePacejkaCurve(12.2, 1.62, -.55, 100, "lat"),
136
157
  muPeakLng: .8,
137
158
  latFrictionEllipseScale: .95,
138
159
  relaxLngRate: .05,
139
160
  relaxLatRate: .09
140
161
  },
141
162
  snowIce: {
142
- lng: t(17.5, 1.64, -1.15, 120, "lng"),
143
- lat: t(16.5, 1.61, -1.05, 120, "lat"),
163
+ lng: compilePacejkaCurve(17.5, 1.64, -1.15, 120, "lng"),
164
+ lat: compilePacejkaCurve(16.5, 1.61, -1.05, 120, "lat"),
144
165
  muPeakLng: .28,
145
166
  latFrictionEllipseScale: .93,
146
167
  relaxLngRate: .06,
147
168
  relaxLatRate: .12
148
169
  }
149
- }, a = {
150
- streetRadial: i.streetDrift90s.lng,
151
- driftProgressive: i.streetDrift90s.lat,
152
- offroadLug: i.offroad6x6At.lng
153
- }, o = {
170
+ };
171
+ var TIRE_SLIP_CURVES = {
172
+ streetRadial: TIRE_ARCHETYPES.streetDrift90s.lng,
173
+ driftProgressive: TIRE_ARCHETYPES.streetDrift90s.lat,
174
+ offroadLug: TIRE_ARCHETYPES.offroad6x6At.lng
175
+ };
176
+ var ENGINE_TORQUE_CURVES = {
154
177
  w16QuadTurbo: {
155
178
  samples: 80,
156
179
  points: [
@@ -188,14 +211,14 @@ var i = {
188
211
  x: .95,
189
212
  y: .962,
190
213
  r_in: -.68,
191
- r_out: -1.45,
214
+ r_out: -.68,
192
215
  w_in: 1,
193
216
  w_out: 1
194
217
  },
195
218
  {
196
219
  x: 1,
197
- y: 0,
198
- r_in: 0,
220
+ y: .82,
221
+ r_in: -1.32,
199
222
  w_in: 1
200
223
  }
201
224
  ]
@@ -241,18 +264,10 @@ var i = {
241
264
  w_in: 1,
242
265
  w_out: 1
243
266
  },
244
- {
245
- x: .96,
246
- y: .86,
247
- r_in: -1.05,
248
- r_out: -1.45,
249
- w_in: 1,
250
- w_out: 1
251
- },
252
267
  {
253
268
  x: 1,
254
- y: 0,
255
- r_in: 0,
269
+ y: .8,
270
+ r_in: -1.12,
256
271
  w_in: 1
257
272
  }
258
273
  ]
@@ -298,18 +313,10 @@ var i = {
298
313
  w_in: 1,
299
314
  w_out: 1
300
315
  },
301
- {
302
- x: .94,
303
- y: .36,
304
- r_in: -1.02,
305
- r_out: -1.35,
306
- w_in: 1,
307
- w_out: 1
308
- },
309
316
  {
310
317
  x: 1,
311
- y: 0,
312
- r_in: 0,
318
+ y: .28,
319
+ r_in: -1.08,
313
320
  w_in: 1
314
321
  }
315
322
  ]
@@ -355,23 +362,16 @@ var i = {
355
362
  w_in: 1,
356
363
  w_out: 1
357
364
  },
358
- {
359
- x: .95,
360
- y: .3368,
361
- r_in: -.3408,
362
- r_out: -1.35,
363
- w_in: 1,
364
- w_out: 1
365
- },
366
365
  {
367
366
  x: 1,
368
- y: 0,
369
- r_in: 0,
367
+ y: .32,
368
+ r_in: -.3097,
370
369
  w_in: 1
371
370
  }
372
371
  ]
373
372
  }
374
- }, s = {
373
+ };
374
+ var STEER_SPEED_CURVES = {
375
375
  progressiveHighway: {
376
376
  samples: 80,
377
377
  points: [
@@ -475,7 +475,7 @@ var i = {
475
475
  x: .2,
476
476
  y: .28,
477
477
  r_in: -1.1,
478
- r_out: -.96,
478
+ r_out: -1.1,
479
479
  w_in: 1,
480
480
  w_out: 1
481
481
  },
@@ -483,7 +483,7 @@ var i = {
483
483
  x: .5,
484
484
  y: .11,
485
485
  r_in: -.25,
486
- r_out: -.2,
486
+ r_out: -.25,
487
487
  w_in: 1,
488
488
  w_out: 1
489
489
  },
@@ -537,4 +537,6 @@ var i = {
537
537
  ]
538
538
  }
539
539
  };
540
- export { o as ENGINE_TORQUE_CURVES, s as STEER_SPEED_CURVES, i as TIRE_ARCHETYPES, a as TIRE_SLIP_CURVES, t as compilePacejkaCurve, r as engineHorsepowerForPeakTorque, n as tireGripForSurface };
540
+ export { ENGINE_TORQUE_CURVES, STEER_SPEED_CURVES, TIRE_ARCHETYPES, TIRE_SLIP_CURVES, compilePacejkaCurve, engineHorsepowerForPeakTorque, tireGripForSurface };
541
+
542
+ //# sourceMappingURL=curves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"curves.js","names":[],"sources":["../src/pacejka.ts","../src/curves.ts"],"sourcesContent":["export type CurvePoint = {\n x: number;\n y: number;\n r_in?: number;\n r_out?: number;\n w_in?: number;\n w_out?: number;\n};\n\nexport type CurveData = {\n points: CurvePoint[];\n samples?: number;\n};\n\nconst HALF_PI = Math.PI * 0.5;\nconst MIN_KNOT_SPACING = 0.01;\nconst MAX_TANGENT_SECANT_RATIO = 2.85;\nconst MAX_RAD = 1.54;\n\nfunction clamp(v: number, lo: number, hi: number): number {\n return v < lo ? lo : v > hi ? hi : v;\n}\n\nfunction uVal(x: number, axis: \"lng\" | \"lat\"): number {\n return axis === \"lat\" ? Math.sin(HALF_PI * x) : x;\n}\n\nfunction duVal(x: number, axis: \"lng\" | \"lat\"): number {\n return axis === \"lat\" ? HALF_PI * Math.cos(HALF_PI * x) : 1;\n}\n\nfunction pacejkaPhi(u: number, B: number, E: number): number {\n const bu = B * u;\n return bu - E * (bu - Math.atan(bu));\n}\n\nfunction pacejkaYRaw(u: number, B: number, C: number, E: number): number {\n return Math.sin(C * Math.atan(pacejkaPhi(u, B, E)));\n}\n\nfunction pacejkaSlopeX(x: number, B: number, C: number, E: number, axis: \"lng\" | \"lat\"): number {\n const u = uVal(x, axis);\n const bu = B * u;\n const phi = pacejkaPhi(u, B, E);\n const dphiDu = B * ((1 - E) + E / (1 + bu * bu));\n const dyDphi = (C * Math.cos(C * Math.atan(phi))) / (1 + phi * phi);\n return dyDphi * dphiDu * duVal(x, axis);\n}\n\n/**\n * Exact 8-knot Fritsch-Carlson monotone Pacejka Magic Formula compiler for `ecctrl/curves`.\n * - `\"lng\"`: `u = x` matching `ShapeCastWheel` `lngSlipRatio = |w*R - vx| / |vx|`.\n * - `\"lat\"`: `u = sin((pi/2) * x)` matching `ShapeCastWheel` `latSlipRatio = atan2(|vy|, |vx|) / (pi/2)`.\n */\nexport function compilePacejkaCurve(\n B: number,\n C: number,\n E: number,\n samples = 100,\n axis: \"lng\" | \"lat\" = \"lng\",\n): CurveData {\n let xPeak = 1;\n if (C > 1) {\n const targetPhi = Math.tan(Math.PI / (2 * C));\n if (pacejkaPhi(1, B, E) >= targetPhi) {\n let lo = 0;\n let hi = 1;\n for (let iter = 0; iter < 48; iter++) {\n const mid = 0.5 * (lo + hi);\n if (pacejkaPhi(uVal(mid, axis), B, E) >= targetPhi)\n hi = mid;\n else\n lo = mid;\n }\n xPeak = hi;\n }\n }\n\n const yPeakRaw = pacejkaYRaw(uVal(xPeak, axis), B, C, E);\n const invYMax = yPeakRaw > 1e-6 ? 1 / yPeakRaw : 1;\n\n const rawKnots = [\n 0,\n 0.32 * xPeak,\n 0.68 * xPeak,\n xPeak,\n xPeak + 0.06 * (1 - xPeak),\n xPeak + 0.18 * (1 - xPeak),\n xPeak + 0.48 * (1 - xPeak),\n 1,\n ];\n\n const knots: number[] = [0];\n for (let i = 1; i < rawKnots.length - 1; i++) {\n const k = rawKnots[i];\n if (k - knots[knots.length - 1] >= MIN_KNOT_SPACING && 1 - k >= MIN_KNOT_SPACING)\n knots.push(k);\n }\n knots.push(1);\n\n const ys = knots.map((x) => {\n if (x === xPeak && C > 1 && yPeakRaw > 1e-6 && pacejkaPhi(1, B, E) >= Math.tan(Math.PI / (2 * C)))\n return 1;\n return pacejkaYRaw(uVal(x, axis), B, C, E) * invYMax;\n });\n\n const secants: number[] = [];\n for (let i = 0; i < knots.length - 1; i++) {\n secants.push((ys[i + 1] - ys[i]) / (knots[i + 1] - knots[i]));\n }\n\n const slopes = knots.map((x, i) => {\n if (x === xPeak && x < 1)\n return 0;\n const mRaw = pacejkaSlopeX(x, B, C, E, axis) * invYMax;\n if (i === 0) {\n const s = secants[0];\n if (Math.abs(s) <= 1e-9)\n return 0;\n return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;\n }\n if (i === knots.length - 1) {\n const s = secants[secants.length - 1];\n if (Math.abs(s) <= 1e-9)\n return 0;\n return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;\n }\n const sL = secants[i - 1];\n const sR = secants[i];\n if (sL * sR <= 0 || Math.abs(sL) <= 1e-9 || Math.abs(sR) <= 1e-9)\n return 0;\n const minS = Math.abs(sL) <= Math.abs(sR) ? sL : sR;\n return clamp(mRaw / minS, 0, MAX_TANGENT_SECANT_RATIO) * minS;\n });\n\n const points: CurvePoint[] = knots.map((x, i) => {\n const ang = clamp(Math.atan(slopes[i]), -MAX_RAD, MAX_RAD);\n const pt: CurvePoint = {\n x: Number(x.toFixed(6)),\n y: Number(ys[i].toFixed(6)),\n };\n if (i > 0) {\n pt.r_in = Number(ang.toFixed(6));\n pt.w_in = 1;\n }\n if (i < knots.length - 1) {\n pt.r_out = Number(ang.toFixed(6));\n pt.w_out = 1;\n }\n return pt;\n });\n\n return { points, samples };\n}\n\n/** Inverts `ShapeCastWheel` `(rayHitFriction + tireGripFactor) * 0.5 = muPeak`. */\nexport function tireGripForSurface(muPeakLng: number, groundColliderFriction = 0.5): number {\n return Number((2 * muPeakLng - groundColliderFriction).toFixed(4));\n}\n\n/** Converts physical peak engine torque (N*m) into `carConfig.engineHorsepower` (`T * RPM / 7022`). */\nexport function engineHorsepowerForPeakTorque(peakTorqueNm: number, engineMaxRPM: number): number {\n return Number(((peakTorqueNm * engineMaxRPM) / 7022).toFixed(1));\n}\n","import {\n compilePacejkaCurve,\n engineHorsepowerForPeakTorque,\n tireGripForSurface,\n type CurveData,\n type CurvePoint,\n} from \"./pacejka.js\";\n\nexport type { CurveData, CurvePoint };\nexport { compilePacejkaCurve, engineHorsepowerForPeakTorque, tireGripForSurface };\n\nexport interface TireArchetypePreset {\n lng: CurveData;\n lat: CurveData;\n muPeakLng: number;\n latFrictionEllipseScale: number;\n relaxLngRate: number;\n relaxLatRate: number;\n}\n\nexport const TIRE_ARCHETYPES = {\n hypercarDry: {\n lng: compilePacejkaCurve(11.2, 1.54, -0.45, 100, \"lng\"),\n lat: compilePacejkaCurve(11.6, 1.5, -0.4, 100, \"lat\"),\n muPeakLng: 1.38 as const,\n latFrictionEllipseScale: 0.97 as const,\n relaxLngRate: 0.04 as const,\n relaxLatRate: 0.06 as const,\n },\n streetDrift90s: {\n lng: compilePacejkaCurve(8.8, 1.5, -0.15, 80, \"lng\"),\n lat: compilePacejkaCurve(9.2, 1.44, -0.12, 80, \"lat\"),\n muPeakLng: 1.08 as const,\n latFrictionEllipseScale: 0.97 as const,\n relaxLngRate: 0.05 as const,\n relaxLatRate: 0.1 as const,\n },\n offroad6x6At: {\n lng: compilePacejkaCurve(6.2, 1.48, -0.35, 80, \"lng\"),\n lat: compilePacejkaCurve(6.6, 1.48, -0.3, 80, \"lat\"),\n muPeakLng: 0.85 as const,\n latFrictionEllipseScale: 0.87 as const,\n relaxLngRate: 0.12 as const,\n relaxLatRate: 0.24 as const,\n },\n gravelRally: {\n lng: compilePacejkaCurve(5.8, 1.26, -0.45, 80, \"lng\"),\n lat: compilePacejkaCurve(6.4, 1.28, -0.4, 80, \"lat\"),\n muPeakLng: 0.74 as const,\n latFrictionEllipseScale: 0.92 as const,\n relaxLngRate: 0.08 as const,\n relaxLatRate: 0.16 as const,\n },\n wetAsphalt: {\n lng: compilePacejkaCurve(12.8, 1.66, -0.6, 100, \"lng\"),\n lat: compilePacejkaCurve(12.2, 1.62, -0.55, 100, \"lat\"),\n muPeakLng: 0.8 as const,\n latFrictionEllipseScale: 0.95 as const,\n relaxLngRate: 0.05 as const,\n relaxLatRate: 0.09 as const,\n },\n snowIce: {\n lng: compilePacejkaCurve(17.5, 1.64, -1.15, 120, \"lng\"),\n lat: compilePacejkaCurve(16.5, 1.61, -1.05, 120, \"lat\"),\n muPeakLng: 0.28 as const,\n latFrictionEllipseScale: 0.93 as const,\n relaxLngRate: 0.06 as const,\n relaxLatRate: 0.12 as const,\n },\n} as const;\n\nexport const TIRE_SLIP_CURVES: {\n readonly streetRadial: CurveData;\n readonly driftProgressive: CurveData;\n readonly offroadLug: CurveData;\n} = {\n streetRadial: TIRE_ARCHETYPES.streetDrift90s.lng,\n driftProgressive: TIRE_ARCHETYPES.streetDrift90s.lat,\n offroadLug: TIRE_ARCHETYPES.offroad6x6At.lng,\n};\n\nexport const ENGINE_TORQUE_CURVES = {\n w16QuadTurbo: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.62 as const, r_out: 0.85 as const, w_out: 1 as const },\n { x: 0.15 as const, y: 0.84 as const, r_in: 1.05 as const, r_out: 1.05 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.27 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.84 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.95 as const, y: 0.962 as const, r_in: -0.68 as const, r_out: -0.68 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.82 as const, r_in: -1.32 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.62; readonly r_out: 0.85; readonly w_out: 1 },\n { readonly x: 0.15; readonly y: 0.84; readonly r_in: 1.05; readonly r_out: 1.05; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.27; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.84; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.95; readonly y: 0.962; readonly r_in: -0.68; readonly r_out: -0.68; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.82; readonly r_in: -1.32; readonly w_in: 1 }\n ],\n },\n naScreamer: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.56 as const, r_out: 0.58 as const, w_out: 1 as const },\n { x: 0.25 as const, y: 0.74 as const, r_in: 0.55 as const, r_out: 0.55 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.45 as const, y: 0.84 as const, r_in: 0.62 as const, r_out: 0.62 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.68 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.93 as const, y: 0.915 as const, r_in: -0.66 as const, r_out: -0.66 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.8 as const, r_in: -1.12 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.56; readonly r_out: 0.58; readonly w_out: 1 },\n { readonly x: 0.25; readonly y: 0.74; readonly r_in: 0.55; readonly r_out: 0.55; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.45; readonly y: 0.84; readonly r_in: 0.62; readonly r_out: 0.62; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.68; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.93; readonly y: 0.915; readonly r_in: -0.66; readonly r_out: -0.66; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.8; readonly r_in: -1.12; readonly w_in: 1 }\n ],\n },\n heavyTurboDiesel: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.64 as const, r_out: 1.05 as const, w_out: 1 as const },\n { x: 0.14 as const, y: 0.88 as const, r_in: 0.98 as const, r_out: 0.98 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.28 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.44 as const, y: 0.975 as const, r_in: -0.32 as const, r_out: -0.32 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.72 as const, y: 0.73 as const, r_in: -0.92 as const, r_out: -0.92 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.28 as const, r_in: -1.08 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.64; readonly r_out: 1.05; readonly w_out: 1 },\n { readonly x: 0.14; readonly y: 0.88; readonly r_in: 0.98; readonly r_out: 0.98; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.28; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.44; readonly y: 0.975; readonly r_in: -0.32; readonly r_out: -0.32; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.72; readonly y: 0.73; readonly r_in: -0.92; readonly r_out: -0.92; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.28; readonly r_in: -1.08; readonly w_in: 1 }\n ],\n },\n evDirectDrive: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.32 as const, y: 1 as const, r_in: 0 as const, r_out: -1.2611 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.44 as const, y: 0.7273 as const, r_in: -1.0267 as const, r_out: -1.0267 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.6 as const, y: 0.5333 as const, r_in: -0.7266 as const, r_out: -0.7266 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.78 as const, y: 0.4103 as const, r_in: -0.4842 as const, r_out: -0.4842 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.32 as const, r_in: -0.3097 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.32; readonly y: 1; readonly r_in: 0; readonly r_out: -1.2611; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.44; readonly y: 0.7273; readonly r_in: -1.0267; readonly r_out: -1.0267; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.6; readonly y: 0.5333; readonly r_in: -0.7266; readonly r_out: -0.7266; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.78; readonly y: 0.4103; readonly r_in: -0.4842; readonly r_out: -0.4842; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.32; readonly r_in: -0.3097; readonly w_in: 1 }\n ],\n },\n} as const;\n\nexport const STEER_SPEED_CURVES = {\n progressiveHighway: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.2 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.62 as const, r_in: -0.82 as const, r_out: -0.82 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.3 as const, r_in: -0.35 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.2; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.62; readonly r_in: -0.82; readonly r_out: -0.82; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.3; readonly r_in: -0.35; readonly w_in: 1 }\n ],\n },\n driftCountersteer: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.14 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.3 as const, y: 0.72 as const, r_in: -1.02 as const, r_out: -1.02 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.48 as const, r_in: -0.74 as const, r_out: -0.74 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.75 as const, y: 0.32 as const, r_in: -0.44 as const, r_out: -0.44 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.24 as const, r_in: -0.2 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.14; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.3; readonly y: 0.72; readonly r_in: -1.02; readonly r_out: -1.02; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.48; readonly r_in: -0.74; readonly r_out: -0.74; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.75; readonly y: 0.32; readonly r_in: -0.44; readonly r_out: -0.44; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.24; readonly r_in: -0.2; readonly w_in: 1 }\n ],\n },\n evSingleGearGt: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.08 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.2 as const, y: 0.28 as const, r_in: -1.1 as const, r_out: -1.1 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.11 as const, r_in: -0.25 as const, r_out: -0.25 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.07 as const, r_in: 0 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.08; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.2; readonly y: 0.28; readonly r_in: -1.1; readonly r_out: -1.1; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.11; readonly r_in: -0.25; readonly r_out: -0.25; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.07; readonly r_in: 0; readonly w_in: 1 }\n ],\n },\n heavy6x6AntiRollover: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.1 as const, y: 0.94 as const, r_in: -0.45 as const, r_out: -0.95 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.28 as const, y: 0.42 as const, r_in: -1.12 as const, r_out: -0.85 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.55 as const, y: 0.19 as const, r_in: -0.42 as const, r_out: -0.22 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.11 as const, r_in: -0.1 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.1; readonly y: 0.94; readonly r_in: -0.45; readonly r_out: -0.95; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.28; readonly y: 0.42; readonly r_in: -1.12; readonly r_out: -0.85; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.55; readonly y: 0.19; readonly r_in: -0.42; readonly r_out: -0.22; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.11; readonly r_in: -0.1; readonly w_in: 1 }\n ],\n },\n} as const;\n"],"mappings":";AAcA,IAAM,UAAU,KAAK,KAAK;AAC1B,IAAM,mBAAmB;AACzB,IAAM,2BAA2B;AACjC,IAAM,UAAU;AAEhB,SAAS,MAAM,GAAW,IAAY,IAAoB;CACtD,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1
  export { PhysicsWorld, type PhysicsWorldProps, type TimeControlValue } from "./PhysicsWorld.js";
2
- export { KhrValidationError, createKhrGltfPlugin, loadKhrGlb, type EcctrlPropellerTag, type EcctrlWheelTag, type KhrAssetBundle, type KhrBodySpec, type KhrColliderShape, type KhrColliderSpec, type KhrExportNodeSpec, type KhrImplicitShape, type KhrJointDriveSpec, type KhrJointSpec, type LoadKhrGlbOptions, } from "./khrLoader.js";
2
+ export { KhrValidationError, createKhrGltfPlugin, loadKhrGlb, type EcctrlPropellerTag, type EcctrlWheelTag, type KhrAssetBundle, type KhrBodySpec, type KhrCarConfig, type KhrColliderShape, type KhrColliderSpec, type KhrCombineMode, type KhrDroneConfig, type KhrExportNodeSpec, type KhrImplicitShape, type KhrJointDriveSpec, type KhrJointSpec, type KhrPluginOptions, type LoadKhrGlbOptions, type OmiVehicleWheelSpec, type UseKhrGlbOptions, } from "./khrLoader.js";
3
3
  export { exportKhrGlb, patchGlbJsonChunk } from "./khrExporter.js";
4
+ export type { MutableGltfJson, RawGltfJson } from "./khrGlb.js";
4
5
  export { claimBundleMount, cloneKhrBundle, disposeKhrBundle, releaseBundleMount } from "./khrClone.js";
5
6
  export { assertIdentityWorldScale, assertSceneIdentityWorldScale, assertUnitScale } from "./khrInertia.js";
6
7
  export { KhrCollider } from "./KhrCollider.js";