fast-mesh-wasm 0.5.2 → 0.5.3

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 (36) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-Uo7hHvD8.d.ts → client-D7yfPOyU.d.ts} +2 -2
  3. package/dist/{client-BIPPznBZ.js → client-f895H_yB.js} +6 -1
  4. package/dist/{engine-BS8i5U8J.js → engine-BcJ5W6kS.js} +1 -1
  5. package/dist/io.d.ts +1 -1
  6. package/dist/{mesh-CqAIuOxU.d.ts → mesh-B3QP93wx.d.ts} +1 -1
  7. package/dist/node.d.ts +2 -2
  8. package/dist/node.js +1 -1
  9. package/dist/{protocol-BHAI0xiA.d.ts → protocol-Dt0zgang.d.ts} +1 -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-rsfM06St.js → scene-CXtM_bxV.js} +40 -10
  14. package/dist/{scene-like-CavrKbpQ.d.ts → scene-like-Dq9_SaUL.d.ts} +68 -24
  15. package/dist/{store-m9l0Al-m.js → store-C9h7GFFl.js} +2 -2
  16. package/dist/{store-CZwml1K3.d.ts → store-CIW19oCh.d.ts} +2 -2
  17. package/dist/store.d.ts +2 -2
  18. package/dist/store.js +1 -1
  19. package/dist/three.d.ts +2 -2
  20. package/dist/{views-CdOArjcB.js → views-mp7Mf8CQ.js} +23 -1
  21. package/dist/wasm/fast_mesh_wasm.d.ts +7 -4
  22. package/dist/wasm/fast_mesh_wasm.js +8 -4
  23. package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
  24. package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +1 -1
  25. package/dist/wasm-threads/fast_mesh_wasm.d.ts +7 -4
  26. package/dist/wasm-threads/fast_mesh_wasm.js +8 -4
  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 -1
  29. package/dist/web.d.ts +2 -2
  30. package/dist/web.js +1 -1
  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
package/README.md CHANGED
@@ -631,16 +631,18 @@ Files are `.stl` (binary or ASCII), `.obj`, `.ply` (ASCII or binary little-endia
631
631
  | Exit code | Meaning |
632
632
  | --- | --- |
633
633
  | `0` | Success. |
634
- | `1` | The operation or a file failed: malformed or truncated input, I/O, inputs a boolean refuses, an empty result. |
634
+ | `1` | The operation or a file failed: malformed or truncated input, I/O, inputs a boolean refuses, an empty result, an invalid boolean result. |
635
635
  | `2` | Usage error: bad arguments, an unsupported extension, or an output that names an input without `--force`. |
636
636
 
637
637
  Reports go to stdout and diagnostics to stderr. With `--format json`, stdout holds one JSON object on success and nothing on failure, so a script can check the exit code and then parse. A hole `repair` leaves open is not a failure: it exits `0`, counts the hole in the report (`skipped`, `failed`) and warns on stderr.
638
638
 
639
639
  The output appears whole or not at all: it is written beside the target and renamed over it when complete, so a failed run leaves any existing file untouched.
640
640
 
641
- `boolean` refuses what the engine cannot resolve with `invalid input: boolean intersection too complex` (exit `1`); at present that includes many overlaps of curved surfaces, so check it on your data. Its report says whether the result is `closed`, and it warns on stderr when not.
641
+ `boolean` refuses what the engine cannot resolve with `invalid input: boolean intersection too complex` (exit `1`); at present that includes many overlaps of curved surfaces, so check it on your data.
642
642
 
643
- Limits: a `.glb` becomes one mesh, with its node placements baked and its primitives merged. Draco and meshopt compression, GPU instancing, sparse accessors and buffers outside the GLB body are refused with an error. JSON `.gltf`, big-endian PLY and UVs are not supported. Other attributes (normals, colors, materials) are not carried across a conversion.
643
+ `boolean` also checks its result before writing. One that is open, non-manifold or has orientation conflicts fails with `the engine produced an invalid result` and its defect counts (exit `1`), leaving any existing output untouched, even with `--force`. Today's engine produces such results for some inputs, including overlapping cubes depending on how their faces are triangulated ([#165](https://github.com/YoonDongGeun/fast-mesh-wasm/issues/165)). The check is structural: it does not compare the result against the shape it should have.
644
+
645
+ Limits: a `.glb` becomes one mesh, with its node placements baked and its primitives merged. Draco and meshopt compression, GPU instancing, sparse accessors and buffers outside the GLB body are refused with an error, as is a file whose nodes reuse their meshes for more than 1,048,576 node-primitive pairs (or file size / 16, if larger). JSON `.gltf`, big-endian PLY and UVs are not supported. Other attributes (normals, colors, materials) are not carried across a conversion.
644
646
 
645
647
  ## Supported environments
646
648
 
@@ -1,6 +1,6 @@
1
- import { At as PlacementInput, Ct as MeshHandle, Et as Indices, F as MeshChange, Ft as Vec3, H as RaycastOptions, L as MeshDistance, M as JoinReport, Mt as Positions64, O as FindContactsOptions, P as MeasureResult, S as EditOp, St as FieldHandle, T as FieldStatus, U as RegisterOptions, V as RayHit, W as RegisterResult, Y as RepairOp, Z as RepairReportOf, a as AutoRepairReport, at as SectionResult, d as ClosestPointOptions, f as ColorRule, i as AnalyzeOptions, it as SectionPlane, j as JoinOptions, kt as Placement, m as Contact, n as AddMeshOptions, nt as SectionDesc, o as AutoRepairRequest, r as Analysis, rt as SectionGap, t as SceneLike, u as ClosestHit, w as EditResult, wt as SectionHandle, x as DragSession, xt as SceneMeshViews, y as DistanceFieldDesc } from "./scene-like-CavrKbpQ.js";
1
+ import { $ as RepairReportOf, Ct as SceneMeshViews, Et as SectionHandle, F as MeshChange, G as RegisterOptions, H as RaycastOptions, K as RegisterResult, L as MeshDistance, Lt as Vec3, M as JoinReport, Mt as PlacementInput, O as FindContactsOptions, Ot as Indices, P as MeasureResult, Pt as Positions64, S as EditOp, T as FieldStatus, Tt as MeshHandle, V as RayHit, Z as RepairOp, a as AutoRepairReport, at as SectionGap, d as ClosestPointOptions, f as ColorRule, i as AnalyzeOptions, it as SectionDesc, j as JoinOptions, jt as Placement, m as Contact, n as AddMeshOptions, o as AutoRepairRequest, ot as SectionPlane, r as Analysis, st as SectionResult, t as SceneLike, u as ClosestHit, w as EditResult, wt as FieldHandle, x as DragSession, y as DistanceFieldDesc } from "./scene-like-Dq9_SaUL.js";
2
2
  import { t as FastMeshError } from "./core-CJ9D6U5A.js";
3
- import "./protocol-BHAI0xiA.js";
3
+ import "./protocol-Dt0zgang.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;
@@ -1,5 +1,5 @@
1
+ import { a as FieldHandle, c as rotationMatrix, l as targetsOf, o as MeshHandle, r as copyRule, s as SectionHandle, t as ViewGuard, u as checkRegisterOptions } from "./views-mp7Mf8CQ.js";
1
2
  import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
2
- import { a as FieldHandle, c as rotationMatrix, l as targetsOf, o as MeshHandle, r as copyRule, s as SectionHandle, t as ViewGuard } from "./views-CdOArjcB.js";
3
3
  import { a as supersedes, n as isLastWins, r as keyOf } from "./protocol-Ci9LLiwO.js";
4
4
  // src/worker/client.ts
5
5
  /**
@@ -1134,6 +1134,11 @@ var WorkerScene = class WorkerScene {
1134
1134
  register(moving, fixed, options = {}) {
1135
1135
  const m = this.#live(moving);
1136
1136
  const f = this.#live(fixed);
1137
+ try {
1138
+ checkRegisterOptions(m === f, options);
1139
+ } catch (e) {
1140
+ return Promise.reject(e);
1141
+ }
1137
1142
  if (this.#drag?.mesh === m || this.#drag?.mesh === f) this.#drag.end();
1138
1143
  const payload = copyInput(options, "options");
1139
1144
  return this.#ask((rev, qid) => ({
@@ -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-rsfM06St.js";
2
+ import { i as useWasmScene, n as fieldSteps, r as meshAdds, t as Scene } from "./scene-CXtM_bxV.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
package/dist/io.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ct as MeshHandle, t as SceneLike } from "./scene-like-CavrKbpQ.js";
1
+ import { Tt as MeshHandle, t as SceneLike } from "./scene-like-Dq9_SaUL.js";
2
2
  /** Shared by every exporter: whether local render coordinates are mapped to the world. */
3
3
  export interface ExportOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Ct as MeshHandle, t as SceneLike } from "./scene-like-CavrKbpQ.js";
1
+ import { Tt as MeshHandle, t as SceneLike } from "./scene-like-Dq9_SaUL.js";
2
2
  import * as THREE from "three";
3
3
  /** Options of {@link bindMesh}. */
4
4
  interface BindMeshOptions {
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as Scene, A as InflateReport, At as PlacementInput, B as OutOfRange, C as EditRef, Ct as MeshHandle, D as FilledLoop, Dt as InitInput, E as FillReport, Et as Indices, F as MeshChange, Ft as Vec3, G as RegisterStatus, H as RaycastOptions, I as MeshComponent, It as computeBounds, J as RemoveReport, K as RelaxReport, L as MeshDistance, Lt as computeVertexNormals, M as JoinReport, Mt as Positions64, N as LoopId, Nt as Quat, O as FindContactsOptions, Ot as Mat3, P as MeasureResult, Pt as UpdateMode, Q as Rgba, R as OffsetReport, S as EditOp, St as FieldHandle, T as FieldStatus, Tt as Bounds, U as RegisterOptions, V as RayHit, W as RegisterResult, X as RepairReport, Y as RepairOp, Z as RepairReportOf, _ as CutReport, _t as SelectSpec, a as AutoRepairReport, at as SectionResult, b as DragOptions, bt as MeshViews, c as BoundaryLoop, ct as SimplifyReport, d as ClosestPointOptions, dt as ThicknessFieldDesc, et as SceneOptions, f as ColorRule, ft as WeldReport, g as CutOptions, gt as LassoSelect, h as CurvatureFieldDesc, ht as IsolateReport, i as AnalyzeOptions, it as SectionPlane, j as JoinOptions, jt as Positions, k as GrabReport, kt as Placement, l as BridgeReport, lt as SmoothReport, m as Contact, mt as ComponentSelect, n as AddMeshOptions, nt as SectionDesc, o as AutoRepairRequest, ot as ShellReport, p as Colormap, pt as BrushSelect, q as RemeshReport, r as Analysis, rt as SectionGap, s as BooleanOp, st as SignMode, t as SceneLike, tt as SectionContour, u as ClosestHit, ut as SubdivideReport, v as DegenerateReport, vt as VertexSelection, w as EditResult, wt as SectionHandle, x as DragSession, xt as SceneMeshViews, y as DistanceFieldDesc, yt as Range, z as OrientReport } from "./scene-like-CavrKbpQ.js";
1
+ import { $ as RepairReportOf, A as InflateReport, At as Mat3, B as OutOfRange, C as EditRef, Ct as SceneMeshViews, D as FilledLoop, Dt as Bounds, E as FillReport, Et as SectionHandle, F as MeshChange, Ft as Quat, G as RegisterOptions, H as RaycastOptions, I as MeshComponent, It as UpdateMode, J as RelaxReport, K as RegisterResult, L as MeshDistance, Lt as Vec3, M as JoinReport, Mt as PlacementInput, N as LoopId, Nt as Positions, O as FindContactsOptions, Ot as Indices, P as MeasureResult, Pt as Positions64, Q as RepairReport, R as OffsetReport, Rt as computeBounds, S as EditOp, St as MeshViews, T as FieldStatus, Tt as MeshHandle, U as RegisterMotion, V as RayHit, W as RegisterNotApplied, X as RemoveReport, Y as RemeshReport, Z as RepairOp, _ as CutReport, _t as IsolateReport, a as AutoRepairReport, at as SectionGap, b as DragOptions, bt as VertexSelection, c as BoundaryLoop, ct as ShellReport, d as ClosestPointOptions, dt as SmoothReport, et as Rgba, f as ColorRule, ft as SubdivideReport, g as CutOptions, gt as ComponentSelect, h as CurvatureFieldDesc, ht as BrushSelect, i as AnalyzeOptions, it as SectionDesc, j as JoinOptions, jt as Placement, k as GrabReport, kt as InitInput, l as BridgeReport, lt as SignMode, m as Contact, mt as WeldReport, n as AddMeshOptions, nt as SceneOptions, o as AutoRepairRequest, ot as SectionPlane, p as Colormap, pt as ThicknessFieldDesc, q as RegisterStatus, r as Analysis, rt as SectionContour, s as BooleanOp, st as SectionResult, t as SceneLike, tt as Scene, u as ClosestHit, ut as SimplifyReport, v as DegenerateReport, vt as LassoSelect, w as EditResult, wt as FieldHandle, x as DragSession, xt as Range, y as DistanceFieldDesc, yt as SelectSpec, z as OrientReport, zt as computeVertexNormals } from "./scene-like-Dq9_SaUL.js";
2
2
  import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
3
3
  /**
4
4
  * Resolves immediately: in Node.js and Bun the module is ready as soon as it is imported.
@@ -6,4 +6,4 @@ import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
6
6
  * the argument is ignored.
7
7
  */
8
8
  export declare function init(_input?: InitInput | Promise<InitInput>): Promise<void>;
9
- export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
9
+ export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterMotion, type RegisterNotApplied, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
package/dist/node.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as computeVertexNormals, r as markInitialized, t as computeBounds } from "./api-4kz45-Mq.js";
2
2
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
3
- import { t as Scene } from "./scene-rsfM06St.js";
3
+ import { t as Scene } from "./scene-CXtM_bxV.js";
4
4
  import { initSync } from "./wasm/fast_mesh_wasm.js";
5
5
  import { readFileSync } from "node:fs";
6
6
  // src/node.ts
@@ -1,4 +1,4 @@
1
- import { at as SectionResult, f as ColorRule, it as SectionPlane, n as AddMeshOptions, y as DistanceFieldDesc, yt as Range } from "./scene-like-CavrKbpQ.js";
1
+ import { f as ColorRule, n as AddMeshOptions, ot as SectionPlane, st as SectionResult, xt as Range, y as DistanceFieldDesc } from "./scene-like-Dq9_SaUL.js";
2
2
  /** A mesh, field or section id allocated on the main side. Unique per kind. */
3
3
  type ClientId = number;
4
4
  /** A {@link ColorRule} naming its field by client id. */
package/dist/r3f.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Ct as MeshHandle } from "./scene-like-CavrKbpQ.js";
2
- import { t as SceneStore } from "./store-CZwml1K3.js";
3
- import { n as BoundMesh, t as BindMeshOptions } from "./mesh-CqAIuOxU.js";
1
+ import { Tt as MeshHandle } from "./scene-like-Dq9_SaUL.js";
2
+ import { t as SceneStore } from "./store-CIW19oCh.js";
3
+ import { n as BoundMesh, t as BindMeshOptions } from "./mesh-B3QP93wx.js";
4
4
  import * as THREE from "three";
5
5
  import { JSX } from "react";
6
6
  import { EventHandlers } from "@react-three/fiber";
package/dist/r3f.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
2
2
  import { c as useStoreSelector, i as useScene, l as StoreContext, t as SceneProvider } from "./react-DzrtrzZy.js";
3
3
  import { s as meshState } from "./snapshot-BkbGPspK.js";
4
- import { r as setFrameLoop } from "./store-m9l0Al-m.js";
4
+ import { r as setFrameLoop } from "./store-C9h7GFFl.js";
5
5
  import { t as bindMesh } from "./mesh-hPWBQPaN.js";
6
6
  import * as THREE from "three";
7
7
  import { createElement, useCallback, useContext, useLayoutEffect, useRef, useState } from "react";
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as FastMeshError } from "./core-CJ9D6U5A.js";
2
- import { Ct as MeshHandle, wt as SectionHandle } from "./scene-like-CavrKbpQ.js";
3
- import { a as DisplayState, c as MeshState, d as SceneSnapshot, n as SectionPatch, p as SectionState, t as SceneStore } from "./store-CZwml1K3.js";
2
+ import { Et as SectionHandle, Tt as MeshHandle } from "./scene-like-Dq9_SaUL.js";
3
+ import { a as DisplayState, c as MeshState, d as SceneSnapshot, n as SectionPatch, p as SectionState, t as SceneStore } from "./store-CIW19oCh.js";
4
4
  import { ReactElement, ReactNode } from "react";
5
5
  /** Provides `store` to the hooks below it. */
6
6
  export declare function SceneProvider(props: {
@@ -1,5 +1,5 @@
1
+ import { a as FieldHandle, c as rotationMatrix, i as encodeRule, l as targetsOf, n as meshViews, o as MeshHandle, r as copyRule, s as SectionHandle, t as ViewGuard, u as checkRegisterOptions } from "./views-mp7Mf8CQ.js";
1
2
  import { a as release, c as wasmMemory, i as finalizer, n as call, r as ensureInitialized, t as FastMeshError } from "./core-4OcWKu3r.js";
2
- import { a as FieldHandle, c as rotationMatrix, i as encodeRule, l as targetsOf, n as meshViews, o as MeshHandle, r as copyRule, s as SectionHandle, t as ViewGuard } from "./views-CdOArjcB.js";
3
3
  import { WasmScene } from "./wasm/fast_mesh_wasm.js";
4
4
  // src/changes.ts
5
5
  const ADDED = 1;
@@ -492,6 +492,14 @@ const REGISTER_STATUSES = [
492
492
  "tooFewCorrespondences",
493
493
  "diverged"
494
494
  ];
495
+ /** The `not applied` codes of `WasmScene.register`, in order. */
496
+ const REGISTER_NOT_APPLIED = [
497
+ null,
498
+ "notRequested",
499
+ "notConverged",
500
+ "rmseAboveLimit",
501
+ "tooFewInliers"
502
+ ];
495
503
  function optional(v, what) {
496
504
  if (v === void 0) return NaN;
497
505
  if (typeof v !== "number" || Number.isNaN(v)) throw invalid(`${what} must be a number`);
@@ -1050,16 +1058,24 @@ var Scene = class {
1050
1058
  * Rigidly aligns the mesh `moving` to the mesh `fixed` by point-to-plane ICP,
1051
1059
  * with the closest points found through `fixed`'s BVH and trimmed by
1052
1060
  * `options.overlap`. A drag of either mesh ends first, recording its moves
1053
- * as one step.
1061
+ * as one step, once the arguments have been checked.
1054
1062
  *
1055
1063
  * **The initial guess is the current placements.** ICP finds the nearest
1056
1064
  * fit, so put the meshes roughly in place first with `setPlacement`.
1057
1065
  *
1058
- * **Applying.** By default a converged result becomes `moving`'s placement
1059
- * as one undo step (`applied` in the result); `apply: false` only returns
1060
- * it. A result that did not converge is never applied, so a failed alignment
1061
- * does not move anything; `placement` still holds the best estimate, for
1062
- * `setPlacement` if it will do.
1066
+ * **Applying.** By default a good result becomes `moving`'s placement as one
1067
+ * undo step (`applied` in the result): converged, with `rmse` within `maxRmse`
1068
+ * and enough points in range. Otherwise nothing moves, and `notApplied` says
1069
+ * why; `placement` still holds the estimate, for `setPlacement` if it will do.
1070
+ * `apply: false` only returns it.
1071
+ *
1072
+ * **Undetermined poses.** A plane's slide and a sphere's or a cylinder's spin
1073
+ * are not fixed by the data, though facets or noise can let the iteration
1074
+ * settle with a tiny `rmse`. These report `"underconstrained"` and list the
1075
+ * motions in `undetermined`. So do coarse regular meshes with exact fits close
1076
+ * by: a 16-sided sphere fits every 22.5 degrees. The check is local, so a
1077
+ * cube's 90-degree symmetry does not count. It adds a bounded cost: up to 12
1078
+ * restarts of up to 12 steps on at most 10,000 points.
1063
1079
  *
1064
1080
  * **Scales.** Only rotation and translation are solved. `moving`'s scale is
1065
1081
  * applied to its points and kept. `fixed`'s scale, uniform or not, is
@@ -1068,20 +1084,31 @@ var Scene = class {
1068
1084
  *
1069
1085
  * @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` for one
1070
1086
  * mesh twice, a mesh without triangles or an invalid option; `STALE_BVH` for
1071
- * a stale Manual `fixed`. Nothing changes on a throw.
1087
+ * a stale Manual `fixed`. Bad options and one mesh twice change nothing,
1088
+ * and a drag keeps running. The other errors come after a drag has ended, and
1089
+ * change nothing else.
1072
1090
  */
1073
1091
  register(moving, fixed, options = {}) {
1074
1092
  const m = this.#id(moving);
1075
1093
  const f = this.#id(fixed);
1094
+ checkRegisterOptions(moving === fixed, options);
1076
1095
  const maxIterations = optional(options.maxIterations, "maxIterations");
1077
1096
  const tolerance = optional(options.tolerance, "tolerance");
1078
1097
  const overlap = optional(options.overlap, "overlap");
1079
1098
  const maxDistance = optional(options.maxDistance, "maxDistance");
1080
1099
  const maxSamples = optional(options.maxSamples, "maxSamples");
1100
+ const maxRmse = optional(options.maxRmse, "maxRmse");
1081
1101
  const apply = options.apply ?? true;
1082
1102
  if (this.#drag?.mesh === moving || this.#drag?.mesh === fixed) this.#drag.end();
1083
- const r = call(() => this.#scene().register(m.index, m.generation, f.index, f.generation, maxIterations, tolerance, overlap, maxDistance, maxSamples, apply));
1103
+ const r = call(() => this.#scene().register(m.index, m.generation, f.index, f.generation, maxIterations, tolerance, overlap, maxDistance, maxSamples, apply, maxRmse));
1084
1104
  const status = REGISTER_STATUSES[r[17]];
1105
+ const undetermined = [];
1106
+ for (let at = 24; at < r.length; at += 10) undetermined.push({
1107
+ translation: vec3At(r, at),
1108
+ rotation: vec3At(r, at + 3),
1109
+ about: vec3At(r, at + 6),
1110
+ alternativeRmse: r[at + 9]
1111
+ });
1085
1112
  return {
1086
1113
  placement: {
1087
1114
  rotation: Array.from(r.subarray(0, 9)),
@@ -1103,7 +1130,10 @@ var Scene = class {
1103
1130
  applied: r[18] === 1,
1104
1131
  samples: r[19],
1105
1132
  inliers: r[20],
1106
- conditioning: r[21]
1133
+ conditioning: r[21],
1134
+ notApplied: REGISTER_NOT_APPLIED[r[22]],
1135
+ maxRmse: r[23],
1136
+ undetermined
1107
1137
  };
1108
1138
  }
1109
1139
  /**
@@ -982,20 +982,48 @@ interface RegisterOptions {
982
982
  */
983
983
  maxSamples?: number;
984
984
  /**
985
- * Whether a converged result becomes the moving mesh's placement, as one
986
- * undo step. A result that did not converge is never applied, whatever
987
- * this says. Default `true`.
985
+ * Whether a good result becomes the moving mesh's placement, as one undo
986
+ * step: it must converge, with `rmse` within `maxRmse` and at least half of
987
+ * the points `overlap` expects in range. Anything else is not applied,
988
+ * whatever this says; {@link RegisterResult.notApplied} says why. Default
989
+ * `true`.
988
990
  */
989
991
  apply?: boolean;
992
+ /**
993
+ * The largest `rmse` (world units) that may be applied, to keep a wrong local
994
+ * minimum from moving the mesh. Default: 1% of the moving points' extent,
995
+ * reported as {@link RegisterResult.maxRmse}. Scans noisier than that need
996
+ * their own limit; `Infinity` turns the guard off.
997
+ */
998
+ maxRmse?: number;
999
+ }
1000
+ /** Why {@link Scene.register} did not apply its result. */
1001
+ type RegisterNotApplied = "notRequested" | "notConverged" | "rmseAboveLimit" | "tooFewInliers";
1002
+ /**
1003
+ * A rigid motion the data do not determine, in world coordinates: a point `p`
1004
+ * moves along `translation + rotation x (p - about)`, scaled so that the moving
1005
+ * mesh's points move by 1 (root mean square).
1006
+ */
1007
+ interface RegisterMotion {
1008
+ translation: Vec3;
1009
+ /** The rotation part, as an axis scaled by its rate. */
1010
+ rotation: Vec3;
1011
+ /** The point the rotation turns about: the moved points' centroid. */
1012
+ about: Vec3;
1013
+ /** The rmse of the other pose found along this motion, which fits as well. */
1014
+ alternativeRmse: number;
990
1015
  }
991
1016
  /**
992
1017
  * Why {@link Scene.register} stopped:
993
- * - `"converged"`: a step fell below the tolerance with all six rigid motions
994
- * constrained.
995
- * - `"maxIterations"`: the steps ran out first.
996
- * - `"underconstrained"`: a step fell below the tolerance, but the surface
997
- * does not determine some motion (a plane sliding in its plane, a tube along
998
- * its axis), which stayed where the current placement put it.
1018
+ * - `"converged"`: a step fell below the tolerance, and restarting from displaced
1019
+ * poses came back to the result, or only found worse fits: the data determine
1020
+ * every rigid motion locally.
1021
+ * - `"maxIterations"`: the steps ran out first, with no motion found undetermined.
1022
+ * - `"underconstrained"`: the data do not determine the pose. A restart stayed
1023
+ * displaced with a fit as good, as for a plane's slide, or a sphere's or a
1024
+ * cylinder's spin, even when facets or noise let the iteration settle with a
1025
+ * tiny `rmse`. {@link RegisterResult.undetermined} names the motions, and the
1026
+ * pose along them is arbitrary.
999
1027
  * - `"tooFewCorrespondences"`: fewer than six points have a usable closest
1000
1028
  * point.
1001
1029
  * - `"diverged"`: a step took points out of the range the query can represent.
@@ -1017,26 +1045,32 @@ interface RegisterResult {
1017
1045
  iterations: number;
1018
1046
  /**
1019
1047
  * `status === "converged"`. ICP is local, so this says the iteration settled
1020
- * and the surface determined the result, not that it found the right
1021
- * alignment: judge that from `rmse`.
1048
+ * and the data determine the result locally, not that it found the right
1049
+ * alignment: a far guess can settle in a wrong minimum. `maxRmse` guards
1050
+ * applying against that.
1022
1051
  */
1023
1052
  converged: boolean;
1024
1053
  /** Why iteration stopped. */
1025
1054
  status: RegisterStatus;
1026
1055
  /** Whether `placement` was set on the moving mesh. */
1027
1056
  applied: boolean;
1057
+ /** Why it was not; `null` exactly when `applied`. */
1058
+ notApplied: RegisterNotApplied | null;
1059
+ /** The `rmse` limit that applied (world units). */
1060
+ maxRmse: number;
1028
1061
  /** Points of the moving mesh sampled. */
1029
1062
  samples: number;
1030
1063
  /** Sampled points used at `placement`: the rest were trimmed or out of range. */
1031
1064
  inliers: number;
1032
1065
  /**
1033
- * How well the worst-constrained motion is determined, in `[0, 1]`: the
1034
- * smallest eigenvalue of the solver's normal equations over the largest at
1035
- * the last step. Below `1e-6` it counts as undetermined. A sphere's spin is
1036
- * determined only by its facets, so this falls as it is tessellated finer.
1037
- * 0 when no step ran.
1066
+ * The smallest eigenvalue of the solver's normal equations over the largest
1067
+ * at the last step, in `[0, 1]`; 0 when no step ran. Geometry only, with no
1068
+ * reference to noise: a low value warns of a weak motion, but a high one does
1069
+ * not show that it is determined. That is `undetermined`.
1038
1070
  */
1039
1071
  conditioning: number;
1072
+ /** The motions the data do not determine; non-empty only when `"underconstrained"`. */
1073
+ undetermined: RegisterMotion[];
1040
1074
  }
1041
1075
  /** Options of {@link Scene.cutByPlane}. */
1042
1076
  interface CutOptions {
@@ -1200,16 +1234,24 @@ declare class Scene implements SceneLike {
1200
1234
  * Rigidly aligns the mesh `moving` to the mesh `fixed` by point-to-plane ICP,
1201
1235
  * with the closest points found through `fixed`'s BVH and trimmed by
1202
1236
  * `options.overlap`. A drag of either mesh ends first, recording its moves
1203
- * as one step.
1237
+ * as one step, once the arguments have been checked.
1204
1238
  *
1205
1239
  * **The initial guess is the current placements.** ICP finds the nearest
1206
1240
  * fit, so put the meshes roughly in place first with `setPlacement`.
1207
1241
  *
1208
- * **Applying.** By default a converged result becomes `moving`'s placement
1209
- * as one undo step (`applied` in the result); `apply: false` only returns
1210
- * it. A result that did not converge is never applied, so a failed alignment
1211
- * does not move anything; `placement` still holds the best estimate, for
1212
- * `setPlacement` if it will do.
1242
+ * **Applying.** By default a good result becomes `moving`'s placement as one
1243
+ * undo step (`applied` in the result): converged, with `rmse` within `maxRmse`
1244
+ * and enough points in range. Otherwise nothing moves, and `notApplied` says
1245
+ * why; `placement` still holds the estimate, for `setPlacement` if it will do.
1246
+ * `apply: false` only returns it.
1247
+ *
1248
+ * **Undetermined poses.** A plane's slide and a sphere's or a cylinder's spin
1249
+ * are not fixed by the data, though facets or noise can let the iteration
1250
+ * settle with a tiny `rmse`. These report `"underconstrained"` and list the
1251
+ * motions in `undetermined`. So do coarse regular meshes with exact fits close
1252
+ * by: a 16-sided sphere fits every 22.5 degrees. The check is local, so a
1253
+ * cube's 90-degree symmetry does not count. It adds a bounded cost: up to 12
1254
+ * restarts of up to 12 steps on at most 10,000 points.
1213
1255
  *
1214
1256
  * **Scales.** Only rotation and translation are solved. `moving`'s scale is
1215
1257
  * applied to its points and kept. `fixed`'s scale, uniform or not, is
@@ -1218,7 +1260,9 @@ declare class Scene implements SceneLike {
1218
1260
  *
1219
1261
  * @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` for one
1220
1262
  * mesh twice, a mesh without triangles or an invalid option; `STALE_BVH` for
1221
- * a stale Manual `fixed`. Nothing changes on a throw.
1263
+ * a stale Manual `fixed`. Bad options and one mesh twice change nothing,
1264
+ * and a drag keeps running. The other errors come after a drag has ended, and
1265
+ * change nothing else.
1222
1266
  */
1223
1267
  register(moving: MeshHandle, fixed: MeshHandle, options?: RegisterOptions): RegisterResult;
1224
1268
  /**
@@ -1598,4 +1642,4 @@ interface SceneLike {
1598
1642
  */
1599
1643
  bounds?(mesh: MeshHandle): Bounds | null;
1600
1644
  }
1601
- export { Scene as $, InflateReport as A, PlacementInput as At, OutOfRange as B, EditRef as C, MeshHandle as Ct, FilledLoop as D, InitInput as Dt, FillReport as E, Indices as Et, MeshChange as F, Vec3 as Ft, RegisterStatus as G, RaycastOptions as H, MeshComponent as I, computeBounds as It, RemoveReport as J, RelaxReport as K, MeshDistance as L, computeVertexNormals as Lt, JoinReport as M, Positions64 as Mt, LoopId as N, Quat as Nt, FindContactsOptions as O, Mat3 as Ot, MeasureResult as P, UpdateMode as Pt, Rgba as Q, OffsetReport as R, EditOp as S, FieldHandle as St, FieldStatus as T, Bounds as Tt, RegisterOptions as U, RayHit as V, RegisterResult as W, RepairReport as X, RepairOp as Y, RepairReportOf as Z, CutReport as _, SelectSpec as _t, AutoRepairReport as a, SectionResult as at, DragOptions as b, MeshViews as bt, BoundaryLoop as c, SimplifyReport as ct, ClosestPointOptions as d, ThicknessFieldDesc as dt, SceneOptions as et, ColorRule as f, WeldReport as ft, CutOptions as g, LassoSelect as gt, CurvatureFieldDesc as h, IsolateReport as ht, AnalyzeOptions as i, SectionPlane as it, JoinOptions as j, Positions as jt, GrabReport as k, Placement as kt, BridgeReport as l, SmoothReport as lt, Contact as m, ComponentSelect as mt, AddMeshOptions as n, SectionDesc as nt, AutoRepairRequest as o, ShellReport as ot, Colormap as p, BrushSelect as pt, RemeshReport as q, Analysis as r, SectionGap as rt, BooleanOp as s, SignMode as st, SceneLike as t, SectionContour as tt, ClosestHit as u, SubdivideReport as ut, DegenerateReport as v, VertexSelection as vt, EditResult as w, SectionHandle as wt, DragSession as x, SceneMeshViews as xt, DistanceFieldDesc as y, Range as yt, OrientReport as z };
1645
+ export { RepairReportOf as $, InflateReport as A, Mat3 as At, OutOfRange as B, EditRef as C, SceneMeshViews as Ct, FilledLoop as D, Bounds as Dt, FillReport as E, SectionHandle as Et, MeshChange as F, Quat as Ft, RegisterOptions as G, RaycastOptions as H, MeshComponent as I, UpdateMode as It, RelaxReport as J, RegisterResult as K, MeshDistance as L, Vec3 as Lt, JoinReport as M, PlacementInput as Mt, LoopId as N, Positions as Nt, FindContactsOptions as O, Indices as Ot, MeasureResult as P, Positions64 as Pt, RepairReport as Q, OffsetReport as R, computeBounds as Rt, EditOp as S, MeshViews as St, FieldStatus as T, MeshHandle as Tt, RegisterMotion as U, RayHit as V, RegisterNotApplied as W, RemoveReport as X, RemeshReport as Y, RepairOp as Z, CutReport as _, IsolateReport as _t, AutoRepairReport as a, SectionGap as at, DragOptions as b, VertexSelection as bt, BoundaryLoop as c, ShellReport as ct, ClosestPointOptions as d, SmoothReport as dt, Rgba as et, ColorRule as f, SubdivideReport as ft, CutOptions as g, ComponentSelect as gt, CurvatureFieldDesc as h, BrushSelect as ht, AnalyzeOptions as i, SectionDesc as it, JoinOptions as j, Placement as jt, GrabReport as k, InitInput as kt, BridgeReport as l, SignMode as lt, Contact as m, WeldReport as mt, AddMeshOptions as n, SceneOptions as nt, AutoRepairRequest as o, SectionPlane as ot, Colormap as p, ThicknessFieldDesc as pt, RegisterStatus as q, Analysis as r, SectionContour as rt, BooleanOp as s, SectionResult as st, SceneLike as t, Scene as tt, ClosestHit as u, SimplifyReport as ut, DegenerateReport as v, LassoSelect as vt, EditResult as w, FieldHandle as wt, DragSession as x, Range as xt, DistanceFieldDesc as y, SelectSpec as yt, OrientReport as z, computeVertexNormals as zt };
@@ -1,7 +1,7 @@
1
1
  import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
2
- import { l as targetsOf } from "./views-CdOArjcB.js";
2
+ import { l as targetsOf } from "./views-mp7Mf8CQ.js";
3
3
  import { i as sectionAspects } from "./protocol-Ci9LLiwO.js";
4
- import { a as watchStatusKeys, r as addFieldKeyed } from "./client-BIPPznBZ.js";
4
+ import { a as watchStatusKeys, r as addFieldKeyed } from "./client-f895H_yB.js";
5
5
  import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-BkbGPspK.js";
6
6
  // src/store/host.ts
7
7
  /** Whether `scene` is a Worker scene (structurally: it reports key statuses). */
@@ -1,5 +1,5 @@
1
- import { $ as Scene, At as PlacementInput, B as OutOfRange, Ct as MeshHandle, Et as Indices, F as MeshChange, Mt as Positions64, Q as Rgba, S as EditOp, X as RepairReport, Y as RepairOp, a as AutoRepairReport, it as SectionPlane, n as AddMeshOptions, nt as SectionDesc, o as AutoRepairRequest, p as Colormap, st as SignMode, t as SceneLike, w as EditResult, wt as SectionHandle, x as DragSession } from "./scene-like-CavrKbpQ.js";
2
- import { i as WorkerScene } from "./client-Uo7hHvD8.js";
1
+ import { B as OutOfRange, Et as SectionHandle, F as MeshChange, Mt as PlacementInput, Ot as Indices, Pt as Positions64, Q as RepairReport, S as EditOp, Tt as MeshHandle, Z as RepairOp, a as AutoRepairReport, et as Rgba, it as SectionDesc, lt as SignMode, n as AddMeshOptions, o as AutoRepairRequest, ot as SectionPlane, p as Colormap, t as SceneLike, tt as Scene, w as EditResult, x as DragSession } from "./scene-like-Dq9_SaUL.js";
2
+ import { i as WorkerScene } from "./client-D7yfPOyU.js";
3
3
  import { t as FastMeshError } from "./core-CJ9D6U5A.js";
4
4
  /** Options of `SceneStore.addMesh`: those both scenes take (a store mesh is always eager). */
5
5
  type StoreAddMeshOptions = Pick<AddMeshOptions, "origin" | "normals" | "uvs">;
package/dist/store.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Q as Rgba, st as SignMode } from "./scene-like-CavrKbpQ.js";
2
- import { _ as StoreAddMeshOptions, a as DisplayState, c as MeshState, d as SceneSnapshot, f as SectionParts, g as sectionState, h as meshState, i as ContactGroup, l as REMOVED_MESH_STATE, m as Status, n as SectionPatch, o as DistanceColoring, p as SectionState, r as createSceneStore, s as EMPTY_SNAPSHOT, t as SceneStore, u as REMOVED_SECTION_STATE } from "./store-CZwml1K3.js";
1
+ import { et as Rgba, lt as SignMode } from "./scene-like-Dq9_SaUL.js";
2
+ import { _ as StoreAddMeshOptions, a as DisplayState, c as MeshState, d as SceneSnapshot, f as SectionParts, g as sectionState, h as meshState, i as ContactGroup, l as REMOVED_MESH_STATE, m as Status, n as SectionPatch, o as DistanceColoring, p as SectionState, r as createSceneStore, s as EMPTY_SNAPSHOT, t as SceneStore, u as REMOVED_SECTION_STATE } from "./store-CIW19oCh.js";
3
3
  /** Options of {@link contactHeatmap}. Distances are in the meshes' units. */
4
4
  interface ContactHeatmapOptions {
5
5
  /** The penetration depth shown darkest (`deep`); deeper clamps to it. `> 0`. */
package/dist/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
2
2
  import { i as REMOVED_SECTION_STATE, l as sectionState, n as EMPTY_SNAPSHOT, r as REMOVED_MESH_STATE, s as meshState } from "./snapshot-BkbGPspK.js";
3
- import { n as createSceneStore, t as SceneStore } from "./store-m9l0Al-m.js";
3
+ import { n as createSceneStore, t as SceneStore } from "./store-C9h7GFFl.js";
4
4
  // src/store/heatmap.ts
5
5
  /** The default colours: `#7f0000`, `#ff6b6b`, `#ffffff`, `#4caf50`, `#1e3a8a`. */
6
6
  const DEFAULT_COLORS = {
package/dist/three.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as SceneLike, wt as SectionHandle } from "./scene-like-CavrKbpQ.js";
2
- import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-CqAIuOxU.js";
1
+ import { Et as SectionHandle, t as SceneLike } from "./scene-like-Dq9_SaUL.js";
2
+ import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-B3QP93wx.js";
3
3
  import * as THREE from "three";
4
4
  /**
5
5
  * What {@link attachTransformControls} needs of a TransformControls: its
@@ -1,5 +1,27 @@
1
1
  import { c as wasmMemory, n as call, t as FastMeshError } from "./core-4OcWKu3r.js";
2
2
  import { n as DEFAULT_NAN, t as DEFAULT_BASE } from "./colormap-Dr5V3bvs.js";
3
+ // src/register.ts
4
+ function invalid$1(message) {
5
+ return new FastMeshError("INVALID_ARGUMENT", message);
6
+ }
7
+ function isNumber(v) {
8
+ return typeof v === "number" && !Number.isNaN(v);
9
+ }
10
+ /**
11
+ * Throws `INVALID_ARGUMENT` for an option out of range or for one mesh twice.
12
+ * Unset options are valid: they take their defaults.
13
+ */
14
+ function checkRegisterOptions(sameMesh, o) {
15
+ if (sameMesh) throw invalid$1("cannot register a mesh to itself");
16
+ const { maxIterations: it, tolerance: tol, overlap, maxDistance: far, maxSamples: cap, maxRmse: rmse } = o;
17
+ if (it !== void 0 && !(Number.isInteger(it) && it >= 0)) throw invalid$1("maxIterations must be a non-negative integer");
18
+ if (tol !== void 0 && !(isNumber(tol) && Number.isFinite(tol) && tol >= 0)) throw invalid$1("tolerance must be finite and zero or greater");
19
+ if (overlap !== void 0 && !(isNumber(overlap) && overlap > 0 && overlap <= 1)) throw invalid$1("overlap must be in (0, 1]");
20
+ if (far !== void 0 && !(isNumber(far) && far > 0)) throw invalid$1("maxDistance must be positive");
21
+ if (cap !== void 0 && !(Number.isInteger(cap) && cap >= 1)) throw invalid$1("maxSamples must be a positive integer");
22
+ if (rmse !== void 0 && !(isNumber(rmse) && rmse >= 0)) throw invalid$1("maxRmse must be zero or greater");
23
+ if (o.apply !== void 0 && typeof o.apply !== "boolean") throw invalid$1("apply must be a boolean");
24
+ }
3
25
  // src/handles.ts
4
26
  /**
5
27
  * A mesh in a {@link Scene}. Opaque: pass it to the scene's methods. The same
@@ -184,4 +206,4 @@ function meshViews(scene, index, generation, guard) {
184
206
  indices: () => build(u32, (s) => s.indices_ptr(index, generation), (s) => s.indices_len(index, generation))
185
207
  };
186
208
  }
187
- export { FieldHandle as a, rotationMatrix as c, encodeRule as i, targetsOf as l, meshViews as n, MeshHandle as o, copyRule as r, SectionHandle as s, ViewGuard as t };
209
+ export { FieldHandle as a, rotationMatrix as c, encodeRule as i, targetsOf as l, meshViews as n, MeshHandle as o, copyRule as r, SectionHandle as s, ViewGuard as t, checkRegisterOptions as u };
@@ -392,10 +392,13 @@ export class WasmScene {
392
392
  * placements; see [`Scene::register`]. The numeric options are NaN for
393
393
  * their defaults. Returns `[rotation (9, row-major), translation (3),
394
394
  * scale (3), rmse, iterations, status, applied, samples, inliers,
395
- * conditioning]`, with status 0 converged, 1 out of iterations, 2
396
- * underconstrained, 3 too few correspondences, 4 diverged.
395
+ * conditioning, not applied, max rmse, then per undetermined motion
396
+ * translation (3), rotation (3), about (3) and its other rmse]`, with
397
+ * status 0 converged, 1 out of iterations, 2 underconstrained, 3 too few
398
+ * correspondences, 4 diverged; and not applied 0 applied, 1 not requested,
399
+ * 2 not converged, 3 rmse above the limit, 4 too few inliers.
397
400
  */
398
- register(moving_index: number, moving_generation: number, fixed_index: number, fixed_generation: number, max_iterations: number, tolerance: number, overlap: number, max_distance: number, max_samples: number, apply: boolean): Float64Array;
401
+ register(moving_index: number, moving_generation: number, fixed_index: number, fixed_generation: number, max_iterations: number, tolerance: number, overlap: number, max_distance: number, max_samples: number, apply: boolean, max_rmse: number): Float64Array;
399
402
  /**
400
403
  * Removes a field (and a colouring by it).
401
404
  */
@@ -611,7 +614,7 @@ export interface InitOutput {
611
614
  readonly wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
612
615
  readonly wasmscene_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
613
616
  readonly wasmscene_redo: (a: number) => [number, number, number];
614
- readonly wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
617
+ readonly wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
615
618
  readonly wasmscene_remove_field: (a: number, b: number) => [number, number];
616
619
  readonly wasmscene_remove_mesh: (a: number, b: number, c: number) => [number, number];
617
620
  readonly wasmscene_remove_section: (a: number, b: number) => [number, number];
@@ -1045,8 +1045,11 @@ export class WasmScene {
1045
1045
  * placements; see [`Scene::register`]. The numeric options are NaN for
1046
1046
  * their defaults. Returns `[rotation (9, row-major), translation (3),
1047
1047
  * scale (3), rmse, iterations, status, applied, samples, inliers,
1048
- * conditioning]`, with status 0 converged, 1 out of iterations, 2
1049
- * underconstrained, 3 too few correspondences, 4 diverged.
1048
+ * conditioning, not applied, max rmse, then per undetermined motion
1049
+ * translation (3), rotation (3), about (3) and its other rmse]`, with
1050
+ * status 0 converged, 1 out of iterations, 2 underconstrained, 3 too few
1051
+ * correspondences, 4 diverged; and not applied 0 applied, 1 not requested,
1052
+ * 2 not converged, 3 rmse above the limit, 4 too few inliers.
1050
1053
  * @param {number} moving_index
1051
1054
  * @param {number} moving_generation
1052
1055
  * @param {number} fixed_index
@@ -1057,10 +1060,11 @@ export class WasmScene {
1057
1060
  * @param {number} max_distance
1058
1061
  * @param {number} max_samples
1059
1062
  * @param {boolean} apply
1063
+ * @param {number} max_rmse
1060
1064
  * @returns {Float64Array}
1061
1065
  */
1062
- register(moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply) {
1063
- const ret = wasm.wasmscene_register(this.__wbg_ptr, moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply);
1066
+ register(moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply, max_rmse) {
1067
+ const ret = wasm.wasmscene_register(this.__wbg_ptr, moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply, max_rmse);
1064
1068
  if (ret[3]) {
1065
1069
  throw takeFromExternrefTable0(ret[2]);
1066
1070
  }
Binary file
@@ -67,7 +67,7 @@ export const wasmscene_positions_len: (a: number, b: number, c: number) => [numb
67
67
  export const wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
68
68
  export const wasmscene_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
69
69
  export const wasmscene_redo: (a: number) => [number, number, number];
70
- export const wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
70
+ export const wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
71
71
  export const wasmscene_remove_field: (a: number, b: number) => [number, number];
72
72
  export const wasmscene_remove_mesh: (a: number, b: number, c: number) => [number, number];
73
73
  export const wasmscene_remove_section: (a: number, b: number) => [number, number];
@@ -392,10 +392,13 @@ export class WasmScene {
392
392
  * placements; see [`Scene::register`]. The numeric options are NaN for
393
393
  * their defaults. Returns `[rotation (9, row-major), translation (3),
394
394
  * scale (3), rmse, iterations, status, applied, samples, inliers,
395
- * conditioning]`, with status 0 converged, 1 out of iterations, 2
396
- * underconstrained, 3 too few correspondences, 4 diverged.
395
+ * conditioning, not applied, max rmse, then per undetermined motion
396
+ * translation (3), rotation (3), about (3) and its other rmse]`, with
397
+ * status 0 converged, 1 out of iterations, 2 underconstrained, 3 too few
398
+ * correspondences, 4 diverged; and not applied 0 applied, 1 not requested,
399
+ * 2 not converged, 3 rmse above the limit, 4 too few inliers.
397
400
  */
398
- register(moving_index: number, moving_generation: number, fixed_index: number, fixed_generation: number, max_iterations: number, tolerance: number, overlap: number, max_distance: number, max_samples: number, apply: boolean): Float64Array;
401
+ register(moving_index: number, moving_generation: number, fixed_index: number, fixed_generation: number, max_iterations: number, tolerance: number, overlap: number, max_distance: number, max_samples: number, apply: boolean, max_rmse: number): Float64Array;
399
402
  /**
400
403
  * Removes a field (and a colouring by it).
401
404
  */
@@ -634,7 +637,7 @@ export interface InitOutput {
634
637
  readonly wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
635
638
  readonly wasmscene_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
636
639
  readonly wasmscene_redo: (a: number) => [number, number, number];
637
- readonly wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
640
+ readonly wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
638
641
  readonly wasmscene_remove_field: (a: number, b: number) => [number, number];
639
642
  readonly wasmscene_remove_mesh: (a: number, b: number, c: number) => [number, number];
640
643
  readonly wasmscene_remove_section: (a: number, b: number) => [number, number];
@@ -1048,8 +1048,11 @@ export class WasmScene {
1048
1048
  * placements; see [`Scene::register`]. The numeric options are NaN for
1049
1049
  * their defaults. Returns `[rotation (9, row-major), translation (3),
1050
1050
  * scale (3), rmse, iterations, status, applied, samples, inliers,
1051
- * conditioning]`, with status 0 converged, 1 out of iterations, 2
1052
- * underconstrained, 3 too few correspondences, 4 diverged.
1051
+ * conditioning, not applied, max rmse, then per undetermined motion
1052
+ * translation (3), rotation (3), about (3) and its other rmse]`, with
1053
+ * status 0 converged, 1 out of iterations, 2 underconstrained, 3 too few
1054
+ * correspondences, 4 diverged; and not applied 0 applied, 1 not requested,
1055
+ * 2 not converged, 3 rmse above the limit, 4 too few inliers.
1053
1056
  * @param {number} moving_index
1054
1057
  * @param {number} moving_generation
1055
1058
  * @param {number} fixed_index
@@ -1060,10 +1063,11 @@ export class WasmScene {
1060
1063
  * @param {number} max_distance
1061
1064
  * @param {number} max_samples
1062
1065
  * @param {boolean} apply
1066
+ * @param {number} max_rmse
1063
1067
  * @returns {Float64Array}
1064
1068
  */
1065
- register(moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply) {
1066
- const ret = wasm.wasmscene_register(this.__wbg_ptr, moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply);
1069
+ register(moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply, max_rmse) {
1070
+ const ret = wasm.wasmscene_register(this.__wbg_ptr, moving_index, moving_generation, fixed_index, fixed_generation, max_iterations, tolerance, overlap, max_distance, max_samples, apply, max_rmse);
1067
1071
  if (ret[3]) {
1068
1072
  throw takeFromExternrefTable0(ret[2]);
1069
1073
  }
@@ -68,7 +68,7 @@ export const wasmscene_positions_len: (a: number, b: number, c: number) => [numb
68
68
  export const wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
69
69
  export const wasmscene_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
70
70
  export const wasmscene_redo: (a: number) => [number, number, number];
71
- export const wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
71
+ export const wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
72
72
  export const wasmscene_remove_field: (a: number, b: number) => [number, number];
73
73
  export const wasmscene_remove_mesh: (a: number, b: number, c: number) => [number, number];
74
74
  export const wasmscene_remove_section: (a: number, b: number) => [number, number];
package/dist/web.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as Scene, A as InflateReport, At as PlacementInput, B as OutOfRange, C as EditRef, Ct as MeshHandle, D as FilledLoop, Dt as InitInput, E as FillReport, Et as Indices, F as MeshChange, Ft as Vec3, G as RegisterStatus, H as RaycastOptions, I as MeshComponent, It as computeBounds, J as RemoveReport, K as RelaxReport, L as MeshDistance, Lt as computeVertexNormals, M as JoinReport, Mt as Positions64, N as LoopId, Nt as Quat, O as FindContactsOptions, Ot as Mat3, P as MeasureResult, Pt as UpdateMode, Q as Rgba, R as OffsetReport, S as EditOp, St as FieldHandle, T as FieldStatus, Tt as Bounds, U as RegisterOptions, V as RayHit, W as RegisterResult, X as RepairReport, Y as RepairOp, Z as RepairReportOf, _ as CutReport, _t as SelectSpec, a as AutoRepairReport, at as SectionResult, b as DragOptions, bt as MeshViews, c as BoundaryLoop, ct as SimplifyReport, d as ClosestPointOptions, dt as ThicknessFieldDesc, et as SceneOptions, f as ColorRule, ft as WeldReport, g as CutOptions, gt as LassoSelect, h as CurvatureFieldDesc, ht as IsolateReport, i as AnalyzeOptions, it as SectionPlane, j as JoinOptions, jt as Positions, k as GrabReport, kt as Placement, l as BridgeReport, lt as SmoothReport, m as Contact, mt as ComponentSelect, n as AddMeshOptions, nt as SectionDesc, o as AutoRepairRequest, ot as ShellReport, p as Colormap, pt as BrushSelect, q as RemeshReport, r as Analysis, rt as SectionGap, s as BooleanOp, st as SignMode, t as SceneLike, tt as SectionContour, u as ClosestHit, ut as SubdivideReport, v as DegenerateReport, vt as VertexSelection, w as EditResult, wt as SectionHandle, x as DragSession, xt as SceneMeshViews, y as DistanceFieldDesc, yt as Range, z as OrientReport } from "./scene-like-CavrKbpQ.js";
1
+ import { $ as RepairReportOf, A as InflateReport, At as Mat3, B as OutOfRange, C as EditRef, Ct as SceneMeshViews, D as FilledLoop, Dt as Bounds, E as FillReport, Et as SectionHandle, F as MeshChange, Ft as Quat, G as RegisterOptions, H as RaycastOptions, I as MeshComponent, It as UpdateMode, J as RelaxReport, K as RegisterResult, L as MeshDistance, Lt as Vec3, M as JoinReport, Mt as PlacementInput, N as LoopId, Nt as Positions, O as FindContactsOptions, Ot as Indices, P as MeasureResult, Pt as Positions64, Q as RepairReport, R as OffsetReport, Rt as computeBounds, S as EditOp, St as MeshViews, T as FieldStatus, Tt as MeshHandle, U as RegisterMotion, V as RayHit, W as RegisterNotApplied, X as RemoveReport, Y as RemeshReport, Z as RepairOp, _ as CutReport, _t as IsolateReport, a as AutoRepairReport, at as SectionGap, b as DragOptions, bt as VertexSelection, c as BoundaryLoop, ct as ShellReport, d as ClosestPointOptions, dt as SmoothReport, et as Rgba, f as ColorRule, ft as SubdivideReport, g as CutOptions, gt as ComponentSelect, h as CurvatureFieldDesc, ht as BrushSelect, i as AnalyzeOptions, it as SectionDesc, j as JoinOptions, jt as Placement, k as GrabReport, kt as InitInput, l as BridgeReport, lt as SignMode, m as Contact, mt as WeldReport, n as AddMeshOptions, nt as SceneOptions, o as AutoRepairRequest, ot as SectionPlane, p as Colormap, pt as ThicknessFieldDesc, q as RegisterStatus, r as Analysis, rt as SectionContour, s as BooleanOp, st as SectionResult, t as SceneLike, tt as Scene, u as ClosestHit, ut as SimplifyReport, v as DegenerateReport, vt as LassoSelect, w as EditResult, wt as FieldHandle, x as DragSession, xt as Range, y as DistanceFieldDesc, yt as SelectSpec, z as OrientReport, zt as computeVertexNormals } from "./scene-like-Dq9_SaUL.js";
2
2
  import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
3
3
  /**
4
4
  * Loads the WebAssembly module. Await this once before calling any other function.
@@ -8,4 +8,4 @@ import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
8
8
  * Leave empty to load the file shipped with this package.
9
9
  */
10
10
  export declare function init(input?: InitInput | Promise<InitInput>): Promise<void>;
11
- export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
11
+ export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterMotion, type RegisterNotApplied, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
package/dist/web.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as computeVertexNormals, r as markInitialized, t as computeBounds } from "./api-4kz45-Mq.js";
2
2
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
3
- import { t as Scene } from "./scene-rsfM06St.js";
3
+ import { t as Scene } from "./scene-CXtM_bxV.js";
4
4
  import wasmInit from "./wasm/fast_mesh_wasm.js";
5
5
  // src/web.ts
6
6
  let ready;
@@ -1,4 +1,4 @@
1
- import { a as WorkerMessage, i as Result, n as InitMessage, r as Request, t as ClientId } from "./protocol-BHAI0xiA.js";
1
+ import { a as WorkerMessage, i as Result, n as InitMessage, r as Request, t as ClientId } from "./protocol-Dt0zgang.js";
2
2
  import { WasmScene } from "./wasm/fast_mesh_wasm.js";
3
3
  /** What the engine needs of a wasm-bindgen glue module. */
4
4
  interface Glue {
@@ -1 +1 @@
1
- export { t as ADD_STEP_WORK, n as BACKGROUND_ADD_TRIANGLES, r as STALE_GUARD_MS, i as STEP_POINTS, a as YIELD_MS, c as loadEngine, u as probeSharedGrowth, o as runEngine, s as serveEngine, l as startEngine } from "./engine-BS8i5U8J.js";
1
+ export { t as ADD_STEP_WORK, n as BACKGROUND_ADD_TRIANGLES, r as STALE_GUARD_MS, i as STEP_POINTS, a as YIELD_MS, c as loadEngine, u as probeSharedGrowth, o as runEngine, s as serveEngine, l as startEngine } from "./engine-BcJ5W6kS.js";
@@ -1,4 +1,4 @@
1
- import { l as startEngine, s as serveEngine } from "./engine-BS8i5U8J.js";
1
+ import { l as startEngine, s as serveEngine } from "./engine-BcJ5W6kS.js";
2
2
  // src/worker/entry.ts
3
3
  const scope = globalThis;
4
4
  serveEngine({
package/dist/worker.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as WorkerSceneOptions, i as WorkerScene, n as MAX_THREADS, o as createWorkerScene, r as WorkerLike, t as KeyStatus } from "./client-Uo7hHvD8.js";
1
+ import { a as WorkerSceneOptions, i as WorkerScene, n as MAX_THREADS, o as createWorkerScene, r as WorkerLike, t as KeyStatus } from "./client-D7yfPOyU.js";
2
2
  export { type KeyStatus, MAX_THREADS, type WorkerLike, WorkerScene, type WorkerSceneOptions, createWorkerScene };
package/dist/worker.js CHANGED
@@ -1 +1 @@
1
- export { t as MAX_THREADS, n as WorkerScene, i as createWorkerScene } from "./client-BIPPznBZ.js";
1
+ export { t as MAX_THREADS, n as WorkerScene, i as createWorkerScene } from "./client-f895H_yB.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-mesh-wasm",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Fast triangle mesh utilities for JavaScript, written in Rust and compiled to WebAssembly",
5
5
  "keywords": [
6
6
  "mesh",