@woosh/meep-engine 2.157.0 → 2.158.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 (60) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/3d/shape/PosedShape3D.d.ts +17 -0
  3. package/src/core/geom/3d/shape/PosedShape3D.d.ts.map +1 -1
  4. package/src/core/geom/3d/shape/PosedShape3D.js +50 -0
  5. package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
  6. package/src/engine/graphics/ecs/trail2d/Trail2D.js +21 -0
  7. package/src/engine/graphics/ecs/trail2d/Trail2DFlags.d.ts +1 -0
  8. package/src/engine/graphics/ecs/trail2d/Trail2DFlags.js +9 -1
  9. package/src/engine/physics/fluid/FluidField.d.ts +53 -9
  10. package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
  11. package/src/engine/physics/fluid/FluidField.js +684 -600
  12. package/src/engine/physics/fluid/FluidSimulator.d.ts +53 -38
  13. package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
  14. package/src/engine/physics/fluid/FluidSimulator.js +252 -178
  15. package/src/engine/physics/fluid/REVIEW_02_PLAN.md +155 -26
  16. package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts +72 -0
  17. package/src/engine/physics/fluid/ecs/FluidObstacle.d.ts.map +1 -0
  18. package/src/engine/physics/fluid/ecs/FluidObstacle.js +97 -0
  19. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +117 -0
  20. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -0
  21. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.js +348 -0
  22. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  23. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +62 -12
  24. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  25. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +135 -38
  26. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
  27. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +85 -38
  28. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
  29. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +104 -50
  30. package/src/engine/physics/fluid/prototype.js +25 -1
  31. package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.d.ts +30 -0
  32. package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.d.ts.map +1 -0
  33. package/src/engine/physics/fluid/solver/v3_grid_sample_scalar_masked.js +92 -0
  34. package/src/engine/physics/fluid/solver/v3_mac_advect_maccormack_velocity.d.ts +42 -0
  35. package/src/engine/physics/fluid/solver/v3_mac_advect_maccormack_velocity.d.ts.map +1 -0
  36. package/src/engine/physics/fluid/solver/v3_mac_advect_maccormack_velocity.js +319 -0
  37. package/src/engine/physics/fluid/solver/v3_mac_advect_scalar.d.ts +53 -0
  38. package/src/engine/physics/fluid/solver/v3_mac_advect_scalar.d.ts.map +1 -0
  39. package/src/engine/physics/fluid/solver/v3_mac_advect_scalar.js +236 -0
  40. package/src/engine/physics/fluid/solver/v3_mac_advect_sl_velocity.d.ts +46 -0
  41. package/src/engine/physics/fluid/solver/v3_mac_advect_sl_velocity.d.ts.map +1 -0
  42. package/src/engine/physics/fluid/solver/v3_mac_advect_sl_velocity.js +217 -0
  43. package/src/engine/physics/fluid/solver/v3_mac_apply_vorticity_confinement.d.ts +40 -0
  44. package/src/engine/physics/fluid/solver/v3_mac_apply_vorticity_confinement.d.ts.map +1 -0
  45. package/src/engine/physics/fluid/solver/v3_mac_apply_vorticity_confinement.js +165 -0
  46. package/src/engine/physics/fluid/solver/v3_mac_clip_trace.d.ts +44 -0
  47. package/src/engine/physics/fluid/solver/v3_mac_clip_trace.d.ts.map +1 -0
  48. package/src/engine/physics/fluid/solver/v3_mac_clip_trace.js +95 -0
  49. package/src/engine/physics/fluid/solver/v3_mac_compute_divergence.d.ts +38 -0
  50. package/src/engine/physics/fluid/solver/v3_mac_compute_divergence.d.ts.map +1 -0
  51. package/src/engine/physics/fluid/solver/v3_mac_compute_divergence.js +77 -0
  52. package/src/engine/physics/fluid/solver/v3_mac_compute_face_solid.d.ts +52 -0
  53. package/src/engine/physics/fluid/solver/v3_mac_compute_face_solid.d.ts.map +1 -0
  54. package/src/engine/physics/fluid/solver/v3_mac_compute_face_solid.js +131 -0
  55. package/src/engine/physics/fluid/solver/v3_mac_subtract_pressure_gradient.d.ts +38 -0
  56. package/src/engine/physics/fluid/solver/v3_mac_subtract_pressure_gradient.d.ts.map +1 -0
  57. package/src/engine/physics/fluid/solver/v3_mac_subtract_pressure_gradient.js +104 -0
  58. package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.d.ts +0 -41
  59. package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.d.ts.map +0 -1
  60. package/src/engine/physics/fluid/effector/AmbientWindFluidEffector.js +0 -124
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "2.157.0",
9
+ "version": "2.158.0",
10
10
  "main": "build/meep.module.js",
11
11
  "module": "build/meep.module.js",
12
12
  "exports": {
@@ -47,6 +47,23 @@ export class PosedShape3D extends AbstractShape3D {
47
47
  w: number;
48
48
  }): void;
49
49
  compute_bounding_box(result: any): void;
50
+ /**
51
+ * Signed distance from a WORLD-space point to the posed shape's boundary.
52
+ * Rigid poses preserve distances, so the local shape's SDF applies
53
+ * unchanged after re-framing the query point.
54
+ *
55
+ * @param {number[]|Float32Array|Float64Array} point world-space, length 3
56
+ * @returns {number}
57
+ */
58
+ signed_distance_at_point(point: number[] | Float32Array | Float64Array): number;
59
+ /**
60
+ * Whether a WORLD-space point lies inside the posed shape.
61
+ *
62
+ * @param {number[]|Float32Array|Float64Array} point world-space, length 3
63
+ * @returns {boolean}
64
+ */
65
+ contains_point(point: number[] | Float32Array | Float64Array): boolean;
66
+ #private;
50
67
  }
51
68
  import { AbstractShape3D } from "./AbstractShape3D.js";
52
69
  //# sourceMappingURL=PosedShape3D.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PosedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/PosedShape3D.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAKQ,mCAAmC;IACnC,OADW,eAAe,GAAC,IAAI,CACd;IAEjB,WAAW;IAAE,WAAW;IAAE,WAAW;IACrC,WAAW;IAAE,WAAW;IAAE,WAAW;IAAE,WAAW;IAGtD;;;;;;;OAOG;IACH,aAJW,eAAe,YACf,UAAQ;QAAC,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAA;KAAC,YACpC,aAAW;QAAC,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAA;KAAC,QAM1D;IAgDD,wCASC;CACJ;gCA3G+B,sBAAsB"}
1
+ {"version":3,"file":"PosedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/PosedShape3D.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAKQ,mCAAmC;IACnC,OADW,eAAe,GAAC,IAAI,CACd;IAEjB,WAAW;IAAE,WAAW;IAAE,WAAW;IACrC,WAAW;IAAE,WAAW;IAAE,WAAW;IAAE,WAAW;IAGtD;;;;;;;OAOG;IACH,aAJW,eAAe,YACf,UAAQ;QAAC,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAA;KAAC,YACpC,aAAW;QAAC,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAC;QAAA,CAAC,EAAC,MAAM,CAAA;KAAC,QAM1D;IAgDD,wCASC;IA4BD;;;;;;;OAOG;IACH,gCAHW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,GAChC,MAAM,CAKlB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,GAChC,OAAO,CAKnB;;CACJ;gCA7J+B,sBAAsB"}
@@ -106,4 +106,54 @@ export class PosedShape3D extends AbstractShape3D {
106
106
  this.qx, this.qy, this.qz, this.qw
107
107
  );
108
108
  }
109
+
110
+ /**
111
+ * Transform a world-space point into the body frame (inverse rigid pose:
112
+ * translate by −position, rotate by the conjugate quaternion) and write it
113
+ * into {@link scratch_local}. Shared by the point-query adapters below.
114
+ *
115
+ * @param {number[]|Float32Array|Float64Array} point world-space, length 3
116
+ */
117
+ #world_point_to_local(point) {
118
+ const dx = point[0] - this.px;
119
+ const dy = point[1] - this.py;
120
+ const dz = point[2] - this.pz;
121
+
122
+ // v_local = q* · v · q — inline conjugate-quaternion rotation, the
123
+ // same literal expansion as in support().
124
+ const qx = this.qx, qy = this.qy, qz = this.qz, qw = this.qw;
125
+
126
+ const tx = qw * dx - qy * dz + qz * dy;
127
+ const ty = qw * dy - qz * dx + qx * dz;
128
+ const tz = qw * dz - qx * dy + qy * dx;
129
+ const tw = qx * dx + qy * dy + qz * dz;
130
+
131
+ scratch_local[0] = tx * qw + tw * qx + ty * qz - tz * qy;
132
+ scratch_local[1] = ty * qw + tw * qy + tz * qx - tx * qz;
133
+ scratch_local[2] = tz * qw + tw * qz + tx * qy - ty * qx;
134
+ }
135
+
136
+ /**
137
+ * Signed distance from a WORLD-space point to the posed shape's boundary.
138
+ * Rigid poses preserve distances, so the local shape's SDF applies
139
+ * unchanged after re-framing the query point.
140
+ *
141
+ * @param {number[]|Float32Array|Float64Array} point world-space, length 3
142
+ * @returns {number}
143
+ */
144
+ signed_distance_at_point(point) {
145
+ this.#world_point_to_local(point);
146
+ return this.shape.signed_distance_at_point(scratch_local);
147
+ }
148
+
149
+ /**
150
+ * Whether a WORLD-space point lies inside the posed shape.
151
+ *
152
+ * @param {number[]|Float32Array|Float64Array} point world-space, length 3
153
+ * @returns {boolean}
154
+ */
155
+ contains_point(point) {
156
+ this.#world_point_to_local(point);
157
+ return this.shape.contains_point(scratch_local);
158
+ }
109
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Trail2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2D.js"],"names":[],"mappings":";AAoBA;IAsKI,oCAMC;IA1KD;;;OAGG;IACH,QAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,qBAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,gBAFU,KAAK,CAEe;IAE9B;;;;OAIG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,QAFU,OAAO,GAAC,IAAI,CAER;IAEd;;;OAGG;IACH,UAFU,mBAAmB,CAEQ;IAErC;;;OAGG;IACH,cAFU,SAAS,CAEG;IAEtB;;;OAGG;IACH,cAAsB;IAEtB,gBAQC;IAMD,4BAEC;IAND,yBAEC;IAMD;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,SACnB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAehB;IADG,kHAAgB;IAGpB;;OAEG;IACH,cAeC;IAUD;;;;;;;;;;;aAcC;IAGD;;;;;;;;;;;;;;;MAQC;IAED;;;OAGG;IACH,cAFW,OAAO,WASjB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,GACJ,OAAO,CA2CnB;CAEJ;;;;;;sBA3RqB,iCAAiC;oBACnC,kCAAkC;wBAI9B,0BAA0B;oCACd,sCAAsC;0BAPhD,yCAAyC;6BAStC,mBAAmB;kCADd,wBAAwB"}
1
+ {"version":3,"file":"Trail2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2D.js"],"names":[],"mappings":";AAoBA;IA6KI,oCAMC;IAjLD;;;OAGG;IACH,QAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,qBAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,gBAFU,KAAK,CAEe;IAE9B;;;;OAIG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,QAFU,OAAO,GAAC,IAAI,CAER;IAEd;;;OAGG;IACH,UAFU,mBAAmB,CAEQ;IAErC;;;OAGG;IACH,cAFU,SAAS,CAEG;IAEtB;;;OAGG;IACH,cAAsB;IAEtB,gBAQC;IAMD,4BAEC;IAND,yBAEC;IAMD;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,SACnB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAehB;IADG,kHAAgB;IAGpB;;OAEG;IACH,cAsBC;IAUD;;;;;;;;;;;aAcC;IAGD;;;;;;;;;;;;;;;MAQC;IAED;;;OAGG;IACH,cAFW,OAAO,WASjB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,GACJ,OAAO,CAyDnB;CAEJ;;;;;;sBAhTqB,iCAAiC;oBACnC,kCAAkC;wBAI9B,0BAA0B;oCACd,sCAAsC;0BAPhD,yCAAyC;6BAStC,mBAAmB;kCADd,wBAAwB"}
@@ -182,6 +182,13 @@ class Trail2D {
182
182
  ribbon.setPointAlpha(i, 0);
183
183
  }
184
184
 
185
+ // Ages/alphas alone don't erase the trail: point POSITIONS still
186
+ // trace the old path, and alpha is interpolated per-quad — the first
187
+ // live head vertex written after this would form a visible gradient
188
+ // quad back to the stale geometry (worst case: a screen-wide streak
189
+ // after a teleport). Defer a geometry reset to the next updateHead(),
190
+ // which is the first code to know the post-clear position.
191
+ this.setFlag(Trail2DFlags.Reseed);
185
192
  }
186
193
 
187
194
  static fromJSON(json) {
@@ -245,6 +252,20 @@ class Trail2D {
245
252
 
246
253
  const maxAge = this.maxAge;
247
254
 
255
+ if (this.getFlag(Trail2DFlags.Reseed)) {
256
+ // post-clear() re-seed: collapse every point onto the new head
257
+ // position (mirrors Trail2DSystem.__build_trail's seeding).
258
+ // setPointPosition keeps the PREVIOUS/NEXT extrusion attributes
259
+ // consistent, so the screen-space normals are sane on the first
260
+ // live frame too.
261
+ const n = ribbon.getCount();
262
+ for (let i = 0; i < n; i++) {
263
+ ribbon.setPointPosition(i, x, y, z);
264
+ }
265
+ this.timeSinceLastUpdate = 0;
266
+ this.clearFlag(Trail2DFlags.Reseed);
267
+ }
268
+
248
269
  const refitTimeDelta = maxAge / ribbon.getCount();
249
270
 
250
271
  let head_index = ribbon.getHeadIndex();
@@ -4,5 +4,6 @@ export namespace Trail2DFlags {
4
4
  let Aging: number;
5
5
  let Built: number;
6
6
  let BoundsNeedUpdate: number;
7
+ let Reseed: number;
7
8
  }
8
9
  //# sourceMappingURL=Trail2DFlags.d.ts.map
@@ -6,5 +6,13 @@ export const Trail2DFlags = {
6
6
  Spawning: 1,
7
7
  Aging: 2,
8
8
  Built: 4,
9
- BoundsNeedUpdate: 8
9
+ BoundsNeedUpdate: 8,
10
+
11
+ /**
12
+ * Set by Trail2D.clear(); consumed by the next updateHead(), which
13
+ * collapses the whole ribbon onto the new head position before resuming.
14
+ * Guarantees no quad can bridge post-clear geometry to pre-clear history
15
+ * (e.g. a screen-wide streak after teleporting the entity).
16
+ */
17
+ Reseed: 16
10
18
  };
@@ -1,8 +1,16 @@
1
1
  /**
2
- * Cell-centered 3D Eulerian grid for the fluid simulator.
2
+ * 3D Eulerian grid for the fluid simulator — MAC (marker-and-cell) staggered
3
+ * layout: pressure, solids and scalars live at cell centers; each velocity
4
+ * component lives on the cell FACES normal to it (Harlow & Welch 1965).
3
5
  *
4
- * Holds three velocity components (x, y, z), an optional per-cell `solid` mask, and any
5
- * number of user-defined passive scalar attributes that get transported by the flow.
6
+ * Staggering makes the discrete divergence and pressure gradient exact
7
+ * adjoints, so projection drives divergence to actual zero (no collocated
8
+ * operator-mismatch floor, no projection-invisible checkerboard modes) and
9
+ * solid boundaries pin the exact normal face velocity (true no-penetration).
10
+ *
11
+ * Holds three face-centered velocity components, a per-cell `solid` mask, and any
12
+ * number of user-defined cell-centered passive scalar attributes transported by
13
+ * the flow.
6
14
  *
7
15
  * Holds only state whose value carries information across step boundaries. The
8
16
  * simulator's transient working memory (per-step velocity snapshots, divergence,
@@ -20,16 +28,24 @@
20
28
  */
21
29
  export class FluidField {
22
30
  /**
23
- * Velocity X component, length = cell count. Cell-centered, indexed by
24
- * `z * res_x * res_y + y * res_x + x`.
31
+ * Velocity X component on x-faces. Length `(res_x+1) * res_y * res_z`,
32
+ * indexed by `z * (res_x+1) * res_y + y * (res_x+1) + x` with
33
+ * `x ∈ [0, res_x]`. Face `(x, y, z)` sits between cells `(x−1, y, z)` and
34
+ * `(x, y, z)` — at grid-space position `(x − 0.5, y, z)` in the
35
+ * cell-center coordinate frame.
25
36
  * @type {Float32Array|null}
26
37
  */
27
38
  velocity_x: Float32Array | null;
28
39
  /**
40
+ * Velocity Y component on y-faces. Length `res_x * (res_y+1) * res_z`,
41
+ * indexed by `z * res_x * (res_y+1) + y * res_x + x` with `y ∈ [0, res_y]`.
29
42
  * @type {Float32Array|null}
30
43
  */
31
44
  velocity_y: Float32Array | null;
32
45
  /**
46
+ * Velocity Z component on z-faces. Length `res_x * res_y * (res_z+1)`,
47
+ * indexed by `z * res_x * res_y + y * res_x + x` with `z ∈ [0, res_z]`
48
+ * (the face slice size equals the cell slice size).
33
49
  * @type {Float32Array|null}
34
50
  */
35
51
  velocity_z: Float32Array | null;
@@ -72,6 +88,25 @@ export class FluidField {
72
88
  * @type {Uint8Array|null}
73
89
  */
74
90
  solid_neighbour_mask: Uint8Array | null;
91
+ /**
92
+ * Per-face "pinned" mask for x-faces: `1` where either adjacent cell is
93
+ * solid — the face's normal velocity is a boundary condition (0 for
94
+ * static solids), not a degree of freedom. Same length and indexing as
95
+ * {@link velocity_x}. Baked by {@link recomputeSolidNeighbourMask} via
96
+ * {@link v3_mac_compute_face_solid}; domain-edge faces stay 0 (open).
97
+ * @type {Uint8Array|null}
98
+ */
99
+ face_solid_x: Uint8Array | null;
100
+ /**
101
+ * y-face pinned mask — see {@link face_solid_x}.
102
+ * @type {Uint8Array|null}
103
+ */
104
+ face_solid_y: Uint8Array | null;
105
+ /**
106
+ * z-face pinned mask — see {@link face_solid_x}.
107
+ * @type {Uint8Array|null}
108
+ */
109
+ face_solid_z: Uint8Array | null;
75
110
  /**
76
111
  * Per-cell pressure-Laplacian diagonal, baked alongside
77
112
  * {@link solid_neighbour_mask} by the same kernel pass:
@@ -196,7 +231,11 @@ export class FluidField {
196
231
  */
197
232
  cellIndex(x: number, y: number, z: number): number;
198
233
  /**
199
- * Set the velocity at an integer grid cell.
234
+ * Set the velocity of an integer grid cell: each component is written to
235
+ * BOTH faces of the cell along its axis, so sampling at the cell centre
236
+ * reads back exactly `(vx, vy, vz)`. Adjacent cells share faces — the
237
+ * later write wins on a shared face, exactly like overlapping
238
+ * cell-centered writes used to.
200
239
  * @param {number} x
201
240
  * @param {number} y
202
241
  * @param {number} z
@@ -206,7 +245,9 @@ export class FluidField {
206
245
  */
207
246
  setVelocityAt(x: number, y: number, z: number, vx: number, vy: number, vz: number): void;
208
247
  /**
209
- * Add to the velocity at an integer grid cell (impulse).
248
+ * Add to the velocity of an integer grid cell (impulse). Deposits each
249
+ * component onto BOTH faces of the cell along its axis; the centre-sampled
250
+ * velocity increases by exactly `(dvx, dvy, dvz)`.
210
251
  * @param {number} x
211
252
  * @param {number} y
212
253
  * @param {number} z
@@ -239,8 +280,11 @@ export class FluidField {
239
280
  */
240
281
  isSolidAt(x: number, y: number, z: number): boolean;
241
282
  /**
242
- * Sample velocity at a fractional grid position (positions outside the grid are
243
- * clamped). Writes into `out` and returns it.
283
+ * Sample velocity at a fractional grid position in CELL-CENTER coordinates
284
+ * (positions outside the grid are clamped). Each component is trilinearly
285
+ * interpolated on its own staggered face lattice — x-face `i` sits at
286
+ * `x = i − 0.5`, so the component is sampled at `x + 0.5` in face-index
287
+ * space, and likewise per axis. Writes into `out` and returns it.
244
288
  * @param {Float32Array|number[]} out Length-3 destination.
245
289
  * @param {number} x
246
290
  * @param {number} y
@@ -1 +1 @@
1
- {"version":3,"file":"FluidField.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/fluid/FluidField.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAQI;;;;OAIG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;OAEG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;OAEG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;;;;;OAMG;IACH,OAFU,UAAU,GAAC,IAAI,CAEZ;IAEb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,sBAFU,UAAU,GAAC,IAAI,CAEG;IAE5B;;;;;;;;;;;;;;;;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AAY,GAAC,MAAM,EAAE,CAUhC;IAED;;;;;;;OAOG;IACH,mBANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACL,MAAM,CAMjB;IAED;;;;;;;;;;OAUG;IACH,cAHW,UAAU,GACT,OAAO,CAqDlB;IAED;;;;;;;;;;;OAWG;IACH,QAFY,MAAM,CAajB;IAED;;;;;;;;;;OAUG;IACH,oCAUC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,eAJW,MAAM,WACN,MAAM,WACN,MAAM,QAuChB;IAED;;;;OAIG;IACH,cASC;;CACJ"}
1
+ {"version":3,"file":"FluidField.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/fluid/FluidField.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAQI;;;;;;;OAOG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;;;OAIG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;;;;OAKG;IACH,YAFU,YAAY,GAAC,IAAI,CAET;IAElB;;;;;;OAMG;IACH,OAFU,UAAU,GAAC,IAAI,CAEZ;IAEb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,sBAFU,UAAU,GAAC,IAAI,CAEG;IAE5B;;;;;;;OAOG;IACH,cAFU,UAAU,GAAC,IAAI,CAEL;IAEpB;;;OAGG;IACH,cAFU,UAAU,GAAC,IAAI,CAEL;IAEpB;;;OAGG;IACH,cAFU,UAAU,GAAC,IAAI,CAEL;IAEpB;;;;;;;;;;;;;;;;OAgBG;IACH,eAFU,UAAU,GAAC,IAAI,CAEJ;IAErB;;;;;;;;;;;;;OAaG;IACH,UAFU,YAAY,kBAAc,IAAI,CAExB;IAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,yBAFU,OAAO,CAEe;IAShC;;;;;;OAMG;IACH,qBAJW,MAAM,SACN,MAAM,SACN,MAAM,QAWhB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