fast-mesh-wasm 0.6.0 → 0.7.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 (37) hide show
  1. package/dist/{client-BrTp2eMp.js → client-DFgvktkT.js} +164 -10
  2. package/dist/{client-Ds09vLkN.d.ts → client-nvmbhtn-.d.ts} +76 -14
  3. package/dist/{engine-DjdY3GxK.js → engine-BL5_sWAf.js} +15 -4
  4. package/dist/io.d.ts +200 -2
  5. package/dist/io.js +3057 -3
  6. package/dist/{mesh-BsqIofgT.d.ts → mesh-BHTFxsXc.d.ts} +1 -1
  7. package/dist/node.d.ts +2 -2
  8. package/dist/node.js +3 -2
  9. package/dist/{protocol-Cb23HelE.d.ts → protocol-DFR0JDAS.d.ts} +3 -1
  10. package/dist/r3f.d.ts +3 -3
  11. package/dist/r3f.js +1 -1
  12. package/dist/react.d.ts +2 -2
  13. package/dist/{scene-D0HNTwoo.js → scene-DUsj6uJD.js} +346 -30
  14. package/dist/{scene-like-CADk1vfb.d.ts → scene-like-CR_Dpohm.d.ts} +902 -146
  15. package/dist/{store-BfC6kkf5.d.ts → store-8HWG90Jg.d.ts} +14 -3
  16. package/dist/{store-DIQmxF_s.js → store-BAzHRRkt.js} +18 -2
  17. package/dist/store.d.ts +3 -3
  18. package/dist/store.js +1 -1
  19. package/dist/three.d.ts +2 -2
  20. package/dist/views-BSy-Qeg8.js +584 -0
  21. package/dist/wasm/fast_mesh_wasm.d.ts +7 -0
  22. package/dist/wasm/fast_mesh_wasm.js +21 -0
  23. package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
  24. package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +1 -0
  25. package/dist/wasm-threads/fast_mesh_wasm.d.ts +7 -0
  26. package/dist/wasm-threads/fast_mesh_wasm.js +21 -0
  27. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
  28. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +1 -0
  29. package/dist/web.d.ts +2 -2
  30. package/dist/web.js +3 -2
  31. package/dist/worker-engine.d.ts +1 -1
  32. package/dist/worker-engine.js +1 -1
  33. package/dist/worker-entry.js +1 -1
  34. package/dist/worker.d.ts +1 -1
  35. package/dist/worker.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/views-B00kdV0R.js +0 -214
@@ -1,4 +1,4 @@
1
- import { c as SectionHandle, d as checkRegisterOptions, i as copyRule, l as rotationMatrix, o as FieldHandle, r as checkInteractionPoints, s as MeshHandle, t as ViewGuard, u as targetsOf } from "./views-B00kdV0R.js";
1
+ import { _ as createBooleanDomain, c as SectionHandle, d as checkRegisterOptions, f as createSculptDomain, g as createDeformDomain, h as createInspectDomain, i as copyRule, l as rotationMatrix, m as createRemeshDomain, o as FieldHandle, p as createRepairDomain, r as checkInteractionPoints, s as MeshHandle, t as ViewGuard, u as targetsOf, v as createAlignDomain } from "./views-BSy-Qeg8.js";
2
2
  import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
3
3
  import { a as supersedes, n as isLastWins, r as keyOf } from "./protocol-Ci9LLiwO.js";
4
4
  // src/worker/client.ts
@@ -377,6 +377,59 @@ var WorkerScene = class WorkerScene {
377
377
  #warned = false;
378
378
  /** The current Worker's crash channel (see `#watch`), while it may run threaded. */
379
379
  #crashWatch;
380
+ /**
381
+ * Callable async repair domain (`worker.repair(mesh, op)` and `worker.repair.<method>(...)`).
382
+ */
383
+ repair = createRepairDomain({
384
+ repair: ((mesh, op) => this.#runRepair(mesh, op)),
385
+ analyze: (mesh, options) => this.analyze(mesh, options),
386
+ join: (target, source, options) => this.join(target, source, options)
387
+ });
388
+ /**
389
+ * Callable async sculpt domain (`worker.sculpt(mesh, op)` and `worker.sculpt.<method>(...)`).
390
+ */
391
+ sculpt = createSculptDomain({
392
+ sculpt: ((mesh, op) => this.#runRepair(mesh, op)),
393
+ verticesInSphere: (mesh, center, radius) => this.verticesInSphere(mesh, center, radius)
394
+ });
395
+ /** Async remesh, simplification, subdivision, and volumetric reconstruction domain. */
396
+ remesh = createRemeshDomain({ repair: ((mesh, op) => this.#runRepair(mesh, op)) });
397
+ /** Callable async boolean, offsetting, and shell domain (`offset` and `shell` execute in worker). */
398
+ boolean = createBooleanDomain({
399
+ isAsync: true,
400
+ repair: ((mesh, op) => this.#runRepair(mesh, op))
401
+ });
402
+ /** Async surface deformation and vertex-protection domain. */
403
+ deform = createDeformDomain({ sculpt: ((mesh, op) => this.#runRepair(mesh, op)) });
404
+ /** Async defect analysis, metrology, queries, fields, and section inspection domain. */
405
+ inspect = createInspectDomain({
406
+ analyze: (mesh, options) => this.analyze(mesh, options),
407
+ measure: (mesh) => this.measure(mesh),
408
+ bounds: (mesh) => this.bounds(mesh),
409
+ raycast: (origin, direction, options) => this.raycast(origin, direction, options),
410
+ closestPoint: (point, options) => this.closestPoint(point, options),
411
+ meshDistance: (a, b, options) => this.meshDistance(a, b, options),
412
+ intersects: (a, b) => this.intersects(a, b),
413
+ findContacts: (options) => this.findContacts(options),
414
+ addDistanceField: (desc) => this.addDistanceField(desc),
415
+ removeField: (field) => this.removeField(field),
416
+ fieldValues: (field) => this.fetchFieldValues(field),
417
+ fieldNearest: (field) => this.fetchFieldNearest(field),
418
+ fieldStatus: (field) => this.fieldStatus(field),
419
+ fieldTargetStatus: (field) => this.fieldTargetStatus(field),
420
+ setColoring: (mesh, rule) => this.setColoring(mesh, rule),
421
+ coloring: (mesh) => this.coloring(mesh),
422
+ addSection: (desc) => this.addSection(desc),
423
+ setSectionPlane: (section, plane) => this.setSectionPlane(section, plane),
424
+ sectionPlane: (section) => this.sectionPlane(section),
425
+ setSectionMeshes: (section, meshes) => this.setSectionMeshes(section, meshes),
426
+ setSectionFill: (section, fill) => this.setSectionFill(section, fill),
427
+ removeSection: (section) => this.removeSection(section),
428
+ section: (section, mesh) => this.section(section, mesh),
429
+ sectionGap: (section, a, b) => this.sectionGap(section, a, b)
430
+ });
431
+ /** Async rigid registration and alignment domain. */
432
+ align = createAlignDomain({ register: (moving, fixed, options) => this.register(moving, fixed, options) });
380
433
  /** Use {@link createWorkerScene}. */
381
434
  constructor(make, options) {
382
435
  this.#make = make;
@@ -844,6 +897,7 @@ var WorkerScene = class WorkerScene {
844
897
  st.add = void 0;
845
898
  }
846
899
  for (const name of BUFFERS) this.#applyBuffer(st, name, c);
900
+ if (c.bounds !== void 0) st.bounds = cloneBounds(c.bounds);
847
901
  }
848
902
  const record = {
849
903
  mesh: st.handle,
@@ -869,6 +923,7 @@ var WorkerScene = class WorkerScene {
869
923
  st.colors = null;
870
924
  st.values = null;
871
925
  st.uvs = null;
926
+ st.bounds = null;
872
927
  st.shown = null;
873
928
  this.#guard?.bump();
874
929
  }
@@ -1026,6 +1081,7 @@ var WorkerScene = class WorkerScene {
1026
1081
  shown: null,
1027
1082
  pendingRules: /* @__PURE__ */ new Map(),
1028
1083
  indices: /* @__PURE__ */ new Uint32Array(0),
1084
+ bounds: void 0,
1029
1085
  pose: poseOf(IDENTITY, [
1030
1086
  0,
1031
1087
  0,
@@ -1085,6 +1141,8 @@ var WorkerScene = class WorkerScene {
1085
1141
  * Joins `source` into `target`; see `Scene.join`. The source stays usable
1086
1142
  * until the join lands: only a successful result removes it (a failed join
1087
1143
  * changes nothing, engine-side or here).
1144
+ *
1145
+ * @deprecated Use `workerScene.repair.join()` instead.
1088
1146
  */
1089
1147
  join(target, source, options) {
1090
1148
  const ta = this.#live(target);
@@ -1130,6 +1188,8 @@ var WorkerScene = class WorkerScene {
1130
1188
  * result reaches `placement()` with its batch, like a `setPlacement`.
1131
1189
  * Not replayed by a restart: an unanswered one rejects with
1132
1190
  * `INSTANCE_POISONED`, like an edit.
1191
+ *
1192
+ * @deprecated Use `workerScene.align.register()` instead.
1133
1193
  */
1134
1194
  register(moving, fixed, options = {}) {
1135
1195
  const m = this.#live(moving);
@@ -1190,6 +1250,15 @@ var WorkerScene = class WorkerScene {
1190
1250
  return this.#shown(this.#mirrored(mesh)).matrix4.slice();
1191
1251
  }
1192
1252
  /**
1253
+ * The box around the vertices the live triangles use, in the mesh's local
1254
+ * render coordinates, mirrored from the Worker. `null` without live triangles.
1255
+ */
1256
+ bounds(mesh) {
1257
+ const st = this.#mirrored(mesh);
1258
+ if (st.bounds === void 0) return;
1259
+ return cloneBounds(st.bounds);
1260
+ }
1261
+ /**
1193
1262
  * The mirrors of the mesh's render buffers, at full slot length. Each
1194
1263
  * getter returns the current mirror; a mirror is replaced when the slot
1195
1264
  * count changes or a buffer turns on or off, so get views right before use.
@@ -1339,18 +1408,27 @@ var WorkerScene = class WorkerScene {
1339
1408
  id: st.id
1340
1409
  });
1341
1410
  }
1342
- /** A report of the mesh's defects; see `Scene.analyze`. */
1411
+ /**
1412
+ * A report of the mesh's defects; see `Scene.analyze`.
1413
+ *
1414
+ * @deprecated Use `workerScene.inspect.analyze()` or `workerScene.repair.analyze()` instead.
1415
+ */
1343
1416
  analyze(mesh, options) {
1344
1417
  return this.#query("analyze", () => ({
1345
1418
  mesh: this.#live(mesh).id,
1346
1419
  options
1347
1420
  }), (v) => v);
1348
1421
  }
1349
- /** Scalar measurements of a mesh; see `Scene.measure`. */
1422
+ /**
1423
+ * Scalar measurements of a mesh; see `Scene.measure`.
1424
+ *
1425
+ * @deprecated Use `workerScene.inspect.measure()` instead.
1426
+ */
1350
1427
  measure(mesh) {
1351
1428
  return this.#query("measure", () => ({ mesh: this.#live(mesh).id }), (v) => v);
1352
1429
  }
1353
- repair(mesh, op) {
1430
+ /** Runs one repair operation, a list as one transaction, or the auto pipeline; see `Scene.repair`. */
1431
+ #runRepair(mesh, op) {
1354
1432
  return this.#ask((rev, qid) => ({
1355
1433
  kind: "repair",
1356
1434
  rev,
@@ -1359,6 +1437,33 @@ var WorkerScene = class WorkerScene {
1359
1437
  qid
1360
1438
  }), (v) => v);
1361
1439
  }
1440
+ /**
1441
+ * Live triangle-used vertex ids of `mesh` inside the closed local-space
1442
+ * sphere `(center, radius)`, in ascending order; see `Scene.verticesInSphere`.
1443
+ *
1444
+ * @deprecated Use `workerScene.sculpt.verticesInSphere()` instead.
1445
+ */
1446
+ verticesInSphere(mesh, center, radius) {
1447
+ return this.#query("verticesInSphere", () => {
1448
+ const id = this.#live(mesh).id;
1449
+ const c = center;
1450
+ if (c?.length !== 3 || ![
1451
+ c[0],
1452
+ c[1],
1453
+ c[2]
1454
+ ].every((x) => typeof x === "number" && Number.isFinite(x))) throw invalid("center must be 3 finite numbers");
1455
+ if (typeof radius !== "number" || !Number.isFinite(radius) || radius < 0) throw invalid("radius must be a finite non-negative number");
1456
+ return {
1457
+ mesh: id,
1458
+ center: [
1459
+ c[0],
1460
+ c[1],
1461
+ c[2]
1462
+ ],
1463
+ radius
1464
+ };
1465
+ }, (v) => v);
1466
+ }
1362
1467
  /** Undoes the latest step; an active drag is ended first. */
1363
1468
  undo() {
1364
1469
  this.#alive();
@@ -1410,7 +1515,11 @@ var WorkerScene = class WorkerScene {
1410
1515
  get canRedo() {
1411
1516
  return this.#history.canRedo;
1412
1517
  }
1413
- /** Adds a signed distance field; see `Scene.addDistanceField`. */
1518
+ /**
1519
+ * Adds a signed distance field; see `Scene.addDistanceField`.
1520
+ *
1521
+ * @deprecated Use `workerScene.inspect.addDistanceField()` instead.
1522
+ */
1414
1523
  addDistanceField(desc) {
1415
1524
  return this.#addField(desc, void 0);
1416
1525
  }
@@ -1686,7 +1795,11 @@ var WorkerScene = class WorkerScene {
1686
1795
  b: this.#live(b).id
1687
1796
  }), (v) => v);
1688
1797
  }
1689
- /** The nearest hit of a world ray over every mesh, or `null`; see `Scene.raycast`. */
1798
+ /**
1799
+ * The nearest hit of a world ray over every mesh, or `null`; see `Scene.raycast`.
1800
+ *
1801
+ * @deprecated Use `workerScene.inspect.raycast()` instead.
1802
+ */
1690
1803
  raycast(origin, direction, options) {
1691
1804
  return this.#query("raycast", () => ({
1692
1805
  origin: [...origin],
@@ -1697,7 +1810,11 @@ var WorkerScene = class WorkerScene {
1697
1810
  mesh: this.#handleOf(v.mesh)
1698
1811
  });
1699
1812
  }
1700
- /** The surface point nearest to a world point, or `null`; see `Scene.closestPoint`. */
1813
+ /**
1814
+ * The surface point nearest to a world point, or `null`; see `Scene.closestPoint`.
1815
+ *
1816
+ * @deprecated Use `workerScene.inspect.closestPoint()` instead.
1817
+ */
1701
1818
  closestPoint(point, options = {}) {
1702
1819
  return this.#query("closestPoint", () => ({
1703
1820
  point: [...point],
@@ -1710,7 +1827,11 @@ var WorkerScene = class WorkerScene {
1710
1827
  mesh: this.#handleOf(v.mesh)
1711
1828
  });
1712
1829
  }
1713
- /** The distance between two meshes' surfaces, or `null`; see `Scene.meshDistance`. */
1830
+ /**
1831
+ * The distance between two meshes' surfaces, or `null`; see `Scene.meshDistance`.
1832
+ *
1833
+ * @deprecated Use `workerScene.inspect.meshDistance()` instead.
1834
+ */
1714
1835
  meshDistance(a, b, options) {
1715
1836
  return this.#query("meshDistance", () => ({
1716
1837
  a: this.#live(a).id,
@@ -1718,14 +1839,22 @@ var WorkerScene = class WorkerScene {
1718
1839
  options
1719
1840
  }), (v) => v);
1720
1841
  }
1721
- /** Whether two meshes intersect or touch as placed. */
1842
+ /**
1843
+ * Whether two meshes intersect or touch as placed.
1844
+ *
1845
+ * @deprecated Use `workerScene.inspect.intersects()` instead.
1846
+ */
1722
1847
  intersects(a, b) {
1723
1848
  return this.#query("intersects", () => ({
1724
1849
  a: this.#live(a).id,
1725
1850
  b: this.#live(b).id
1726
1851
  }), (v) => v);
1727
1852
  }
1728
- /** Every mesh pair (or every pair of `pairs`) within `margin`; see `Scene.findContacts`. */
1853
+ /**
1854
+ * Every mesh pair (or every pair of `pairs`) within `margin`; see `Scene.findContacts`.
1855
+ *
1856
+ * @deprecated Use `workerScene.inspect.findContacts()` instead.
1857
+ */
1729
1858
  findContacts(options = {}) {
1730
1859
  return this.#query("findContacts", () => ({
1731
1860
  margin: options.margin,
@@ -2296,6 +2425,31 @@ function copyArray(value, what, copy) {
2296
2425
  * slot order, as world positions before placement (local plus origin, in
2297
2426
  * `f64`, so the engine gets the same `f32` local positions back).
2298
2427
  */
2428
+ function cloneBounds(b) {
2429
+ if (b === null) return null;
2430
+ return {
2431
+ min: [
2432
+ b.min[0],
2433
+ b.min[1],
2434
+ b.min[2]
2435
+ ],
2436
+ max: [
2437
+ b.max[0],
2438
+ b.max[1],
2439
+ b.max[2]
2440
+ ],
2441
+ center: [
2442
+ b.center[0],
2443
+ b.center[1],
2444
+ b.center[2]
2445
+ ],
2446
+ size: [
2447
+ b.size[0],
2448
+ b.size[1],
2449
+ b.size[2]
2450
+ ]
2451
+ };
2452
+ }
2299
2453
  function liveGeometry(st) {
2300
2454
  const idx = st.indices;
2301
2455
  const p = st.positions;
@@ -1,6 +1,6 @@
1
- import { Bt as Vec3, C as EditOp, Dt as FieldHandle, E as FieldStatus, Et as SceneMeshViews, F as MeasureResult, Ft as PlacementInput, H as RayHit, I as MeshChange, K as RegisterOptions, Lt as Positions64, M as JoinOptions, N as JoinReport, Ot as MeshHandle, Pt as Placement, Q as RepairOp, R as MeshDistance, S as DragSession, T as EditResult, U as RaycastOptions, a as AutoRepairReport, at as SectionDesc, b as DistanceFieldDesc, ct as SectionResult, d as ClosestHit, et as RepairReportOf, f as ClosestPointOptions, h as Contact, i as AnalyzeOptions, jt as Indices, k as FindContactsOptions, kt as SectionHandle, n as AddMeshOptions, o as AutoRepairRequest, ot as SectionGap, p as ColorRule, q as RegisterResult, r as Analysis, st as SectionPlane, t as SceneLike } from "./scene-like-CADk1vfb.js";
1
+ import { $t as FindContactsOptions, Ar as Vec3, B as WorkerDeformDomain, Bn as SectionGap, Cn as RegisterOptions, Ct as AnalyzeOptions, D as WorkerRemeshDomain, Dr as Positions64, Ft as ClosestPointOptions, Hn as SectionResult, It as ColorRule, Kt as DragSession, N as WorkerInspectDomain, Pt as ClosestHit, Rt as Contact, St as Analysis, Tr as PlacementInput, Vn as SectionPlane, Wt as DistanceFieldDesc, Xt as FieldStatus, Yt as EditResult, _ as WorkerRepairDomain, _r as FieldHandle, at as WorkerSculptDomain, bn as RaycastOptions, br as Bounds, dn as MeasureResult, fn as MeshChange, lr as SceneMeshViews, mn as MeshDistance, n as SceneLike, on as JoinOptions, pt as WorkerBooleanDomain, qt as EditOp, sn as JoinReport, vr as MeshHandle, wn as RegisterResult, wr as Placement, xr as Indices, xt as AddMeshOptions, yn as RayHit, yr as SectionHandle, yt as WorkerAlignDomain, zn as SectionDesc } from "./scene-like-CR_Dpohm.js";
2
2
  import { t as FastMeshError } from "./core-CJ9D6U5A.js";
3
- import "./protocol-Cb23HelE.js";
3
+ import "./protocol-DFR0JDAS.js";
4
4
  /** What {@link WorkerScene} needs of a Worker; a browser `Worker` fits. */
5
5
  interface WorkerLike {
6
6
  postMessage(msg: unknown, transfer?: Transferable[]): void;
@@ -99,6 +99,24 @@ declare const MAX_THREADS = 64;
99
99
  */
100
100
  declare class WorkerScene implements SceneLike {
101
101
  #private;
102
+ /**
103
+ * Callable async repair domain (`worker.repair(mesh, op)` and `worker.repair.<method>(...)`).
104
+ */
105
+ readonly repair: WorkerRepairDomain;
106
+ /**
107
+ * Callable async sculpt domain (`worker.sculpt(mesh, op)` and `worker.sculpt.<method>(...)`).
108
+ */
109
+ readonly sculpt: WorkerSculptDomain;
110
+ /** Async remesh, simplification, subdivision, and volumetric reconstruction domain. */
111
+ readonly remesh: WorkerRemeshDomain;
112
+ /** Callable async boolean, offsetting, and shell domain (`offset` and `shell` execute in worker). */
113
+ readonly boolean: WorkerBooleanDomain;
114
+ /** Async surface deformation and vertex-protection domain. */
115
+ readonly deform: WorkerDeformDomain;
116
+ /** Async defect analysis, metrology, queries, fields, and section inspection domain. */
117
+ readonly inspect: WorkerInspectDomain;
118
+ /** Async rigid registration and alignment domain. */
119
+ readonly align: WorkerAlignDomain;
102
120
  /** Use {@link createWorkerScene}. */
103
121
  private constructor();
104
122
  /**
@@ -125,6 +143,8 @@ declare class WorkerScene implements SceneLike {
125
143
  * Joins `source` into `target`; see `Scene.join`. The source stays usable
126
144
  * until the join lands: only a successful result removes it (a failed join
127
145
  * changes nothing, engine-side or here).
146
+ *
147
+ * @deprecated Use `workerScene.repair.join()` instead.
128
148
  */
129
149
  join(target: MeshHandle, source: MeshHandle, options: JoinOptions): Promise<JoinReport>;
130
150
  /**
@@ -133,6 +153,8 @@ declare class WorkerScene implements SceneLike {
133
153
  * result reaches `placement()` with its batch, like a `setPlacement`.
134
154
  * Not replayed by a restart: an unanswered one rejects with
135
155
  * `INSTANCE_POISONED`, like an edit.
156
+ *
157
+ * @deprecated Use `workerScene.align.register()` instead.
136
158
  */
137
159
  register(moving: MeshHandle, fixed: MeshHandle, options?: RegisterOptions): Promise<RegisterResult>;
138
160
  /**
@@ -144,6 +166,11 @@ declare class WorkerScene implements SceneLike {
144
166
  placement(mesh: MeshHandle): Placement;
145
167
  /** The column-major world matrix of the mesh's local render coordinates, as mirrored. */
146
168
  matrix4(mesh: MeshHandle): Float64Array;
169
+ /**
170
+ * The box around the vertices the live triangles use, in the mesh's local
171
+ * render coordinates, mirrored from the Worker. `null` without live triangles.
172
+ */
173
+ bounds(mesh: MeshHandle): Bounds | null;
147
174
  /**
148
175
  * The mirrors of the mesh's render buffers, at full slot length. Each
149
176
  * getter returns the current mirror; a mirror is replaced when the slot
@@ -173,14 +200,25 @@ declare class WorkerScene implements SceneLike {
173
200
  edit(mesh: MeshHandle, ops: readonly EditOp[]): Promise<EditResult>;
174
201
  /** Compacts a mesh's slots (its slot counts change). */
175
202
  compact(mesh: MeshHandle): void;
176
- /** A report of the mesh's defects; see `Scene.analyze`. */
203
+ /**
204
+ * A report of the mesh's defects; see `Scene.analyze`.
205
+ *
206
+ * @deprecated Use `workerScene.inspect.analyze()` or `workerScene.repair.analyze()` instead.
207
+ */
177
208
  analyze(mesh: MeshHandle, options?: AnalyzeOptions): Promise<Analysis>;
178
- /** Scalar measurements of a mesh; see `Scene.measure`. */
209
+ /**
210
+ * Scalar measurements of a mesh; see `Scene.measure`.
211
+ *
212
+ * @deprecated Use `workerScene.inspect.measure()` instead.
213
+ */
179
214
  measure(mesh: MeshHandle): Promise<MeasureResult>;
180
- /** Runs one repair operation, a list as one transaction, or the auto pipeline; see `Scene.repair`. */
181
- repair(mesh: MeshHandle, request: AutoRepairRequest): Promise<AutoRepairReport>;
182
- repair<const O extends RepairOp>(mesh: MeshHandle, op: O): Promise<RepairReportOf<O>>;
183
- repair<const O extends readonly RepairOp[]>(mesh: MeshHandle, ops: O): Promise<{ -readonly [K in keyof O]: RepairReportOf<O[K]>; }>;
215
+ /**
216
+ * Live triangle-used vertex ids of `mesh` inside the closed local-space
217
+ * sphere `(center, radius)`, in ascending order; see `Scene.verticesInSphere`.
218
+ *
219
+ * @deprecated Use `workerScene.sculpt.verticesInSphere()` instead.
220
+ */
221
+ verticesInSphere(mesh: MeshHandle, center: Readonly<Vec3>, radius: number): Promise<Uint32Array>;
184
222
  /** Undoes the latest step; an active drag is ended first. */
185
223
  undo(): void;
186
224
  /** Redoes the latest undone step; an active drag is ended first. */
@@ -195,7 +233,11 @@ declare class WorkerScene implements SceneLike {
195
233
  get canUndo(): boolean;
196
234
  /** Whether there is a step to redo, as of the latest result. */
197
235
  get canRedo(): boolean;
198
- /** Adds a signed distance field; see `Scene.addDistanceField`. */
236
+ /**
237
+ * Adds a signed distance field; see `Scene.addDistanceField`.
238
+ *
239
+ * @deprecated Use `workerScene.inspect.addDistanceField()` instead.
240
+ */
199
241
  addDistanceField(desc: DistanceFieldDesc): FieldHandle;
200
242
  /** Removes a field, and a colouring by it. */
201
243
  removeField(field: FieldHandle): void;
@@ -247,17 +289,37 @@ declare class WorkerScene implements SceneLike {
247
289
  sectionPlane(section: SectionHandle): SectionPlane;
248
290
  /** The closest pair between two meshes' contours in a section; see `Scene.sectionGap`. */
249
291
  sectionGap(section: SectionHandle, a: MeshHandle, b: MeshHandle): Promise<SectionGap | null>;
250
- /** The nearest hit of a world ray over every mesh, or `null`; see `Scene.raycast`. */
292
+ /**
293
+ * The nearest hit of a world ray over every mesh, or `null`; see `Scene.raycast`.
294
+ *
295
+ * @deprecated Use `workerScene.inspect.raycast()` instead.
296
+ */
251
297
  raycast(origin: Readonly<Vec3>, direction: Readonly<Vec3>, options?: RaycastOptions): Promise<RayHit | null>;
252
- /** The surface point nearest to a world point, or `null`; see `Scene.closestPoint`. */
298
+ /**
299
+ * The surface point nearest to a world point, or `null`; see `Scene.closestPoint`.
300
+ *
301
+ * @deprecated Use `workerScene.inspect.closestPoint()` instead.
302
+ */
253
303
  closestPoint(point: Readonly<Vec3>, options?: ClosestPointOptions): Promise<ClosestHit | null>;
254
- /** The distance between two meshes' surfaces, or `null`; see `Scene.meshDistance`. */
304
+ /**
305
+ * The distance between two meshes' surfaces, or `null`; see `Scene.meshDistance`.
306
+ *
307
+ * @deprecated Use `workerScene.inspect.meshDistance()` instead.
308
+ */
255
309
  meshDistance(a: MeshHandle, b: MeshHandle, options?: {
256
310
  maxDistance?: number;
257
311
  }): Promise<MeshDistance | null>;
258
- /** Whether two meshes intersect or touch as placed. */
312
+ /**
313
+ * Whether two meshes intersect or touch as placed.
314
+ *
315
+ * @deprecated Use `workerScene.inspect.intersects()` instead.
316
+ */
259
317
  intersects(a: MeshHandle, b: MeshHandle): Promise<boolean>;
260
- /** Every mesh pair (or every pair of `pairs`) within `margin`; see `Scene.findContacts`. */
318
+ /**
319
+ * Every mesh pair (or every pair of `pairs`) within `margin`; see `Scene.findContacts`.
320
+ *
321
+ * @deprecated Use `workerScene.inspect.findContacts()` instead.
322
+ */
261
323
  findContacts(options?: FindContactsOptions): Promise<Contact[]>;
262
324
  /** Registers a listener for {@link WorkerScene.commitFrame}; returns the function that removes it. */
263
325
  onChanges(listener: (changes: MeshChange[]) => void): () => void;
@@ -1,5 +1,5 @@
1
1
  import { s as setMemory, t as FastMeshError } from "./core-4OcWKu3r.js";
2
- import { i as useWasmScene, n as fieldSteps, r as meshAdds, t as Scene } from "./scene-D0HNTwoo.js";
2
+ import { i as useWasmScene, n as fieldSteps, r as meshAdds, t as Scene } from "./scene-DUsj6uJD.js";
3
3
  import { a as supersedes, n as isLastWins, r as keyOf, t as isInit } from "./protocol-Ci9LLiwO.js";
4
4
  /**
5
5
  * A module importing a shared memory `e.m` (1 page, at most 2), exporting
@@ -1380,7 +1380,10 @@ var Engine = class {
1380
1380
  * recorded operation would drop them even if a later one fails).
1381
1381
  */
1382
1382
  #inSteps(req) {
1383
- return Array.isArray(req.payload) && req.payload.length > 1 && this.#drag === void 0 && !this.#scene.canRedo();
1383
+ return Array.isArray(req.payload) && req.payload.length > 1 && !req.payload.some((o) => {
1384
+ const name = o?.op;
1385
+ return name === "captureRestSizes" || name === "captureStrokeState";
1386
+ }) && this.#drag === void 0 && !this.#scene.canRedo();
1384
1387
  }
1385
1388
  async #repairInSteps(req, b) {
1386
1389
  const s = this.#scene;
@@ -1656,14 +1659,17 @@ var Engine = class {
1656
1659
  case "section":
1657
1660
  this.#runSection(req);
1658
1661
  return;
1659
- case "query":
1662
+ case "query": {
1660
1663
  if (req.name === "fieldStatus" || req.name === "fieldNearest" || req.name === "fieldTargetStatus" || req.name === "debugDump") this.#settleFields();
1664
+ const value = this.#query(req.name, req.args);
1661
1665
  b.replies.push({
1662
1666
  qid: req.qid,
1663
1667
  ok: true,
1664
- value: this.#query(req.name, req.args)
1668
+ value
1665
1669
  });
1670
+ if (req.name === "verticesInSphere" && value instanceof Uint32Array) b.transfer.push(value.buffer);
1666
1671
  return;
1672
+ }
1667
1673
  case "fetchFieldValues": {
1668
1674
  this.#settleFields();
1669
1675
  const values = s.fieldValues(this.#field(req.field)).slice();
@@ -1831,6 +1837,10 @@ var Engine = class {
1831
1837
  const a = args;
1832
1838
  return s.measure(this.#mesh(a.mesh));
1833
1839
  }
1840
+ case "verticesInSphere": {
1841
+ const a = args;
1842
+ return s.verticesInSphere(this.#mesh(a.mesh), a.center, a.radius);
1843
+ }
1834
1844
  case "fieldTargetStatus": {
1835
1845
  const a = args;
1836
1846
  return s.fieldTargetStatus(this.#field(a.field));
@@ -1993,6 +2003,7 @@ var Engine = class {
1993
2003
  if (c.removed) return wire;
1994
2004
  wire.vertexSlots = this.#scene.vertexSlots(c.mesh);
1995
2005
  wire.triangleSlots = this.#scene.triangleSlots(c.mesh);
2006
+ if (c.added || c.capacityChanged || c.positions === "all" || c.positions.length > 0 || c.indices === "all" || c.indices.length > 0) wire.bounds = this.#scene.bounds(c.mesh);
1996
2007
  let packed = c.added ? this.#packed.get(c.mesh) : void 0;
1997
2008
  if (packed !== void 0 && packed.stamp !== this.#meshAdds.stamp(c.mesh)) packed = void 0;
1998
2009
  const views = this.#scene.views(c.mesh);