fast-mesh-wasm 0.4.0 → 0.5.1
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.
- package/README.md +51 -3
- package/dist/{api-BUy7FRx7.js → api-4kz45-Mq.js} +2 -3
- package/dist/{client-Bpjy-eFY.js → client-C61Kku4i.js} +102 -24
- package/dist/{client-D-O5-tAg.d.ts → client-tP6R9foI.d.ts} +19 -8
- package/dist/{colormap-DxGMYVfs.js → colormap-Dr5V3bvs.js} +1 -2
- package/dist/{core-Cke_kZ2e.js → core-4OcWKu3r.js} +2 -2
- package/dist/{core-D2X9GPfK.d.ts → core-CJ9D6U5A.d.ts} +1 -3
- package/dist/{engine-D6MpGb9i.js → engine-X1Awlc5y.js} +58 -28
- package/dist/io.d.ts +294 -0
- package/dist/io.js +1395 -0
- package/dist/{mesh-zj7-wJBw.js → mesh-CWvrjO8S.js} +3 -4
- package/dist/{mesh-BUVxv3jo.d.ts → mesh-D3fv56nF.d.ts} +1 -3
- package/dist/node.d.ts +3 -5
- package/dist/node.js +4 -5
- package/dist/{protocol-CK6_3aqo.d.ts → protocol-BGQAB0op.d.ts} +16 -3
- package/dist/{protocol-CAUYm1gd.js → protocol-Ci9LLiwO.js} +7 -6
- package/dist/r3f.d.ts +22 -6
- package/dist/r3f.js +28 -19
- package/dist/{react-CTADh3NN.js → react-DzrtrzZy.js} +4 -6
- package/dist/react.d.ts +4 -6
- package/dist/react.js +1 -1
- package/dist/{scene-D6m9XM3O.js → scene-BnkCS0sv.js} +668 -14
- package/dist/{scene-like-DJKQP5uf.d.ts → scene-like-BzkDNHCy.d.ts} +502 -42
- package/dist/{snapshot-Cf6NgDl7.js → snapshot-BkbGPspK.js} +1 -2
- package/dist/{store-QWRDXlAn.d.ts → store-BKFzSykN.d.ts} +3 -9
- package/dist/{store-Ml3TQGsR.js → store-CEd2y2KS.js} +7 -9
- package/dist/store.d.ts +2 -4
- package/dist/store.js +4 -5
- package/dist/three.d.ts +2 -6
- package/dist/three.js +4 -6
- package/dist/{views-Dh3aWc2q.js → views-CUBMOK0U.js} +5 -8
- package/dist/wasm/fast_mesh_wasm.d.ts +86 -6
- package/dist/wasm/fast_mesh_wasm.js +192 -6
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +9 -1
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +86 -6
- package/dist/wasm-threads/fast_mesh_wasm.js +192 -6
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +9 -1
- package/dist/web.d.ts +3 -5
- package/dist/web.js +4 -5
- package/dist/worker-engine.d.ts +1 -7
- package/dist/worker-engine.js +1 -1
- package/dist/worker-entry.js +2 -3
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/package.json +16 -4
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/store/host.d.ts
|
|
1
|
+
import { $ as SectionPlane, Et as Positions64, G as RepairReport, J as Scene, N as MeshChange, R as OutOfRange, S as EditResult, W as RepairOp, Z as SectionDesc, _t as MeshHandle, b as EditOp, bt as Indices, d as Colormap, n as AddMeshOptions, nt as SignMode, q as Rgba, t as SceneLike, vt as SectionHandle, wt as PlacementInput, y as DragSession } from "./scene-like-BzkDNHCy.js";
|
|
2
|
+
import { i as WorkerScene } from "./client-tP6R9foI.js";
|
|
3
|
+
import { t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
5
4
|
/** Options of `SceneStore.addMesh`: those both scenes take (a store mesh is always eager). */
|
|
6
5
|
type StoreAddMeshOptions = Pick<AddMeshOptions, "origin" | "normals">;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/store/snapshot.d.ts
|
|
9
6
|
/**
|
|
10
7
|
* The state of a mesh's or section's work: `"computing"` while it, or a
|
|
11
8
|
* result it depends on, is pending; `"ready"` once applied; `"error"` when
|
|
@@ -118,8 +115,6 @@ declare function meshState(snap: SceneSnapshot, mesh: MeshHandle): MeshState;
|
|
|
118
115
|
declare const REMOVED_SECTION_STATE: SectionState;
|
|
119
116
|
/** A section's state in `snap`, or {@link REMOVED_SECTION_STATE} when it is not there. */
|
|
120
117
|
declare function sectionState(snap: SceneSnapshot, section: SectionHandle): SectionState;
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/store/store.d.ts
|
|
123
118
|
/** A change to a section's declarative parts. */
|
|
124
119
|
type SectionPatch = Partial<SectionParts>;
|
|
125
120
|
/**
|
|
@@ -281,5 +276,4 @@ declare class SceneStore {
|
|
|
281
276
|
}
|
|
282
277
|
/** A store over `scene` (a `Scene` or a `WorkerScene`). */
|
|
283
278
|
declare function createSceneStore(scene: Scene | WorkerScene): SceneStore;
|
|
284
|
-
//#endregion
|
|
285
279
|
export { StoreAddMeshOptions as _, DisplayState as a, MeshState as c, SceneSnapshot as d, SectionParts as f, sectionState as g, meshState as h, ContactGroup as i, REMOVED_MESH_STATE as l, Status as m, SectionPatch as n, DistanceColoring as o, SectionState as p, createSceneStore as r, EMPTY_SNAPSHOT as s, SceneStore as t, REMOVED_SECTION_STATE as u };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as reportListenerError, t as FastMeshError } from "./core-
|
|
2
|
-
import { l as targetsOf } from "./views-
|
|
3
|
-
import { i as sectionAspects } from "./protocol-
|
|
4
|
-
import {
|
|
5
|
-
import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-
|
|
6
|
-
|
|
1
|
+
import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { l as targetsOf } from "./views-CUBMOK0U.js";
|
|
3
|
+
import { i as sectionAspects } from "./protocol-Ci9LLiwO.js";
|
|
4
|
+
import { a as watchStatusKeys, r as addFieldKeyed } from "./client-C61Kku4i.js";
|
|
5
|
+
import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-BkbGPspK.js";
|
|
6
|
+
// src/store/host.ts
|
|
7
7
|
/** Whether `scene` is a Worker scene (structurally: it reports key statuses). */
|
|
8
8
|
function isWorkerScene(scene) {
|
|
9
9
|
return "status" in scene;
|
|
@@ -164,8 +164,7 @@ function workerHost(scene) {
|
|
|
164
164
|
forgetErrors
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
//#region src/store/store.ts
|
|
167
|
+
// src/store/store.ts
|
|
169
168
|
/**
|
|
170
169
|
* `c` without `mesh` among its targets when it has others (the scene keeps
|
|
171
170
|
* such a field without the mesh); otherwise `c` itself.
|
|
@@ -1375,5 +1374,4 @@ function createSceneStore(scene) {
|
|
|
1375
1374
|
function setFrameLoop(store, on) {
|
|
1376
1375
|
setFrameLoopOf(store, on);
|
|
1377
1376
|
}
|
|
1378
|
-
//#endregion
|
|
1379
1377
|
export { createSceneStore as n, setFrameLoop as r, SceneStore as t };
|
package/dist/store.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
3
|
-
//#region src/store/heatmap.d.ts
|
|
1
|
+
import { nt as SignMode, q as Rgba } from "./scene-like-BzkDNHCy.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-BKFzSykN.js";
|
|
4
3
|
/** Options of {@link contactHeatmap}. Distances are in the meshes' units. */
|
|
5
4
|
interface ContactHeatmapOptions {
|
|
6
5
|
/** The penetration depth shown darkest (`deep`); deeper clamps to it. `> 0`. */
|
|
@@ -57,5 +56,4 @@ interface ContactHeatmapOptions {
|
|
|
57
56
|
* `0 ≤ tolerance < min(depth, gap)` (`< depth` when `gap` is 0).
|
|
58
57
|
*/
|
|
59
58
|
export declare function contactHeatmap(options: ContactHeatmapOptions): Omit<DistanceColoring, "distanceTo">;
|
|
60
|
-
//#endregion
|
|
61
59
|
export { type ContactGroup, type ContactHeatmapOptions, type DisplayState, type DistanceColoring, EMPTY_SNAPSHOT, type MeshState, REMOVED_MESH_STATE, REMOVED_SECTION_STATE, type SceneSnapshot, SceneStore, type SectionParts, type SectionPatch, type SectionState, type Status, type StoreAddMeshOptions, createSceneStore, meshState, sectionState };
|
package/dist/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FastMeshError } from "./core-
|
|
2
|
-
import { i as REMOVED_SECTION_STATE, l as sectionState, n as EMPTY_SNAPSHOT, r as REMOVED_MESH_STATE, s as meshState } from "./snapshot-
|
|
3
|
-
import { n as createSceneStore, t as SceneStore } from "./store-
|
|
4
|
-
|
|
1
|
+
import { t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
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-CEd2y2KS.js";
|
|
4
|
+
// src/store/heatmap.ts
|
|
5
5
|
/** The default colours: `#7f0000`, `#ff6b6b`, `#ffffff`, `#4caf50`, `#1e3a8a`. */
|
|
6
6
|
const DEFAULT_COLORS = {
|
|
7
7
|
deep: [
|
|
@@ -101,5 +101,4 @@ function contactHeatmap(options) {
|
|
|
101
101
|
above: "base"
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
//#endregion
|
|
105
104
|
export { EMPTY_SNAPSHOT, REMOVED_MESH_STATE, REMOVED_SECTION_STATE, SceneStore, contactHeatmap, createSceneStore, meshState, sectionState };
|
package/dist/three.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-
|
|
1
|
+
import { t as SceneLike, vt as SectionHandle } from "./scene-like-BzkDNHCy.js";
|
|
2
|
+
import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-D3fv56nF.js";
|
|
3
3
|
import * as THREE from "three";
|
|
4
|
-
//#region src/three/controls.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* What {@link attachTransformControls} needs of a TransformControls: its
|
|
7
6
|
* `dragging-changed` (`{ value: boolean }`) and `objectChange` events, the
|
|
@@ -57,8 +56,6 @@ interface AttachTransformControlsOptions {
|
|
|
57
56
|
* cannot start a drag (another drag is active) is ignored with a warning.
|
|
58
57
|
*/
|
|
59
58
|
export declare function attachTransformControls(controls: TransformControlsLike, scene: SceneLike, bound: MeshBinding, options?: AttachTransformControlsOptions): () => void;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/three/section.d.ts
|
|
62
59
|
/** Options of {@link bindSection}. */
|
|
63
60
|
interface BindSectionOptions {
|
|
64
61
|
/** The contour line colour. Defaults to black. */
|
|
@@ -115,5 +112,4 @@ interface BoundSection {
|
|
|
115
112
|
* `scene.commitFrame()` once per animation frame.
|
|
116
113
|
*/
|
|
117
114
|
export declare function bindSection(scene: SceneLike, section: SectionHandle, bound: readonly MeshBinding[], options?: BindSectionOptions): BoundSection;
|
|
118
|
-
//#endregion
|
|
119
115
|
export { type AttachTransformControlsOptions, type BindMeshOptions, type BindSectionOptions, type BoundMesh, type BoundSection, type MeshBinding, type SceneLike, type TransformControlsLike, bindMesh };
|
package/dist/three.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FastMeshError } from "./core-
|
|
2
|
-
import { n as checkUntransformedParent, t as bindMesh } from "./mesh-
|
|
1
|
+
import { t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { n as checkUntransformedParent, t as bindMesh } from "./mesh-CWvrjO8S.js";
|
|
3
3
|
import * as THREE from "three";
|
|
4
|
-
|
|
4
|
+
// src/three/controls.ts
|
|
5
5
|
const defaultSchedule = (callback) => {
|
|
6
6
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => callback());
|
|
7
7
|
else setTimeout(callback, 16);
|
|
@@ -220,8 +220,7 @@ function attachTransformControls(controls, scene, bound, options = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
//#region src/three/section.ts
|
|
223
|
+
// src/three/section.ts
|
|
225
224
|
const DEFAULT_LINE = 0;
|
|
226
225
|
const DEFAULT_FILL = 8947848;
|
|
227
226
|
/**
|
|
@@ -391,5 +390,4 @@ function bindSection(scene, section, bound, options = {}) {
|
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
392
|
}
|
|
394
|
-
//#endregion
|
|
395
393
|
export { attachTransformControls, bindMesh, bindSection };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as wasmMemory, n as call, t as FastMeshError } from "./core-
|
|
2
|
-
import { n as DEFAULT_NAN, t as DEFAULT_BASE } from "./colormap-
|
|
3
|
-
|
|
1
|
+
import { c as wasmMemory, n as call, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { n as DEFAULT_NAN, t as DEFAULT_BASE } from "./colormap-Dr5V3bvs.js";
|
|
3
|
+
// src/handles.ts
|
|
4
4
|
/**
|
|
5
5
|
* A mesh in a {@link Scene}. Opaque: pass it to the scene's methods. The same
|
|
6
6
|
* mesh always gives the same handle object, so handles compare with `===`.
|
|
@@ -51,8 +51,7 @@ function rotationMatrix(rotation) {
|
|
|
51
51
|
function targetsOf(to) {
|
|
52
52
|
return Array.isArray(to) ? to : [to];
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
//#region src/rule.ts
|
|
54
|
+
// src/rule.ts
|
|
56
55
|
const MAPS = {
|
|
57
56
|
turbo: 0,
|
|
58
57
|
viridis: 1,
|
|
@@ -120,8 +119,7 @@ function copyRule(rule) {
|
|
|
120
119
|
if (Array.isArray(stops)) copy.map = Object.freeze({ stops: Object.freeze(stops.map((stop) => Array.isArray(stop) ? Object.freeze(stop.map(frozen)) : stop)) });
|
|
121
120
|
return Object.freeze(copy);
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
//#region src/views.ts
|
|
122
|
+
// src/views.ts
|
|
125
123
|
/**
|
|
126
124
|
* Debug-mode check of kept views. The scene bumps the epoch on every call
|
|
127
125
|
* that may allocate or move buffers; a guarded view is a `Proxy` over the
|
|
@@ -185,5 +183,4 @@ function meshViews(scene, index, generation, guard) {
|
|
|
185
183
|
indices: () => build(u32, (s) => s.indices_ptr(index, generation), (s) => s.indices_len(index, generation))
|
|
186
184
|
};
|
|
187
185
|
}
|
|
188
|
-
//#endregion
|
|
189
186
|
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 };
|
|
@@ -11,6 +11,20 @@ export class WasmScene {
|
|
|
11
11
|
* Drops the open step unit, if any; see [`Scene::abandon_field_step`].
|
|
12
12
|
*/
|
|
13
13
|
abandon_field_step(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a per-vertex curvature field on the mesh given as a flat pair
|
|
16
|
+
* `[index, generation]`, and returns its raw id: the signed mean
|
|
17
|
+
* curvature at each vertex, in 1/world-units (positive on domes, about
|
|
18
|
+
* `1 / r` on a sphere of radius `r`; negative in bowls; zero on flats).
|
|
19
|
+
* Dead slots and unused vertices read NaN.
|
|
20
|
+
*/
|
|
21
|
+
add_curvature_field(name: string, on: Uint32Array): number;
|
|
22
|
+
/**
|
|
23
|
+
* [`WasmScene::add_curvature_field`] computing nothing yet: the field
|
|
24
|
+
* is due until stepped or updated; see
|
|
25
|
+
* [`Scene::add_curvature_field_deferred`].
|
|
26
|
+
*/
|
|
27
|
+
add_curvature_field_deferred(name: string, on: Uint32Array): number;
|
|
14
28
|
/**
|
|
15
29
|
* Adds a signed distance field on mesh `on` to one or more target
|
|
16
30
|
* meshes, given as flat pairs `[on index, on generation, to index, to
|
|
@@ -65,6 +79,20 @@ export class WasmScene {
|
|
|
65
79
|
* `[origin xyz, normal xyz]`, and returns its raw id.
|
|
66
80
|
*/
|
|
67
81
|
add_section(plane: Float64Array, meshes: Uint32Array, fill: boolean): number;
|
|
82
|
+
/**
|
|
83
|
+
* Adds a per-vertex wall-thickness field on the mesh given as a flat
|
|
84
|
+
* pair `[index, generation]`, and returns its raw id: the distance to
|
|
85
|
+
* the opposite surface along each vertex's smooth normal, in world
|
|
86
|
+
* units. Open sheets and rims read NaN; hits beyond `max_distance`
|
|
87
|
+
* read `Infinity`.
|
|
88
|
+
*/
|
|
89
|
+
add_thickness_field(name: string, on: Uint32Array, max_distance: number): number;
|
|
90
|
+
/**
|
|
91
|
+
* [`WasmScene::add_thickness_field`] computing nothing yet: the field
|
|
92
|
+
* is due until stepped or updated; see
|
|
93
|
+
* [`Scene::add_thickness_field_deferred`].
|
|
94
|
+
*/
|
|
95
|
+
add_thickness_field_deferred(name: string, on: Uint32Array, max_distance: number): number;
|
|
68
96
|
/**
|
|
69
97
|
* A read-only report of the mesh's defects, laid out as in
|
|
70
98
|
* [`crate::edit::encode_analysis`]. `weld_tolerance` (local units,
|
|
@@ -89,6 +117,16 @@ export class WasmScene {
|
|
|
89
117
|
* Opens a history step, or one more nesting level of the open one.
|
|
90
118
|
*/
|
|
91
119
|
begin_step(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Combines mesh B into mesh A in the world and returns `[index,
|
|
122
|
+
* generation, kept triangles, triangles added]` of A (the result
|
|
123
|
+
* replaces A with A's placement; B is unchanged). `op` is 0 (union),
|
|
124
|
+
* 1 (subtract) or 2 (intersect). The boolean undoes in one step;
|
|
125
|
+
* combining a mesh with itself is a no-op for union and intersect,
|
|
126
|
+
* and clears it for subtract. Only positions and triangles cross
|
|
127
|
+
* over; the new vertices take channel defaults.
|
|
128
|
+
*/
|
|
129
|
+
boolean(a_index: number, a_generation: number, b_index: number, b_generation: number, op: number): Uint32Array;
|
|
92
130
|
/**
|
|
93
131
|
* The box around the vertices the live triangles use, in the mesh's
|
|
94
132
|
* stored local coordinates: `[min xyz, max xyz]`. Empty without live
|
|
@@ -145,6 +183,17 @@ export class WasmScene {
|
|
|
145
183
|
* whenever the mesh's positions, triangles or normals change.
|
|
146
184
|
*/
|
|
147
185
|
content_stamp(index: number, generation: number): number;
|
|
186
|
+
/**
|
|
187
|
+
* Cuts a mesh with a world plane `[origin xyz, normal xyz]`: the `+`
|
|
188
|
+
* side stays on the mesh and the `-` side is added as a new mesh with
|
|
189
|
+
* the same placement. Returns `[kept index, kept generation, added
|
|
190
|
+
* index, added generation, kept triangles, removed triangles, cap
|
|
191
|
+
* triangles]`. With `cap` (the usual case) both openings are closed
|
|
192
|
+
* with flat, unfaired patches; without it both parts keep the open rim.
|
|
193
|
+
* The cut undoes in one step; the added mesh stays, like the removed
|
|
194
|
+
* source of [`WasmScene::join`].
|
|
195
|
+
*/
|
|
196
|
+
cut_by_plane(index: number, generation: number, plane: Float64Array, cap: boolean): Uint32Array;
|
|
148
197
|
/**
|
|
149
198
|
* Drops a mesh being added in steps (nothing was added).
|
|
150
199
|
*/
|
|
@@ -250,11 +299,33 @@ export class WasmScene {
|
|
|
250
299
|
* Whether two meshes intersect or touch as placed.
|
|
251
300
|
*/
|
|
252
301
|
intersects(a_index: number, a_generation: number, b_index: number, b_generation: number): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Joins mesh B into mesh A: copies B's geometry into A, bridges the two
|
|
304
|
+
* loops and removes B; see [`Scene::join`]. `loops` holds the two loop
|
|
305
|
+
* ids (`min_vertex, len, hash low, hash high` each, A's first) and
|
|
306
|
+
* `max_edges` is NaN for the default. Returns `[vertices_added,
|
|
307
|
+
* triangles_added, bridge_triangles_added]`.
|
|
308
|
+
*/
|
|
309
|
+
join(a_index: number, a_generation: number, b_index: number, b_generation: number, loops: Uint32Array, max_edges: number): Float64Array;
|
|
253
310
|
/**
|
|
254
311
|
* The world matrix of the local render coordinates,
|
|
255
|
-
* `placement · translate(origin)`, column-major (16 values)
|
|
312
|
+
* `placement · translate(origin)`, column-major (16 values): the
|
|
313
|
+
* rotation columns are scaled, and the last column is
|
|
314
|
+
* `rotation · (scale · origin) + translation`.
|
|
256
315
|
*/
|
|
257
316
|
matrix4(index: number, generation: number): Float64Array;
|
|
317
|
+
/**
|
|
318
|
+
* Scalar measurements of a mesh in world coordinates (its placement
|
|
319
|
+
* applied, so scaled meshes measure scaled): `[area, volume (NaN when
|
|
320
|
+
* the mesh is not watertight), closed (0/1), volume reason (0 closed,
|
|
321
|
+
* 1 open, 2 non-manifold), boundary loops, non-manifold edges,
|
|
322
|
+
* orientation conflicts]`. Area is always defined; volume is `None`
|
|
323
|
+
* with its reason unless the mesh has no boundary and no
|
|
324
|
+
* non-manifold edge. The volume is the absolute signed sum, so
|
|
325
|
+
* inconsistent winding only flags `orientation conflicts` without
|
|
326
|
+
* failing.
|
|
327
|
+
*/
|
|
328
|
+
measure(index: number, generation: number): Float64Array;
|
|
258
329
|
/**
|
|
259
330
|
* The distance between two meshes' surfaces as placed. Empty when it
|
|
260
331
|
* exceeds `max_distance` or a mesh has no triangle, else `[distance,
|
|
@@ -283,7 +354,7 @@ export class WasmScene {
|
|
|
283
354
|
normals_ptr(index: number, generation: number): number;
|
|
284
355
|
/**
|
|
285
356
|
* The placement: the row-major rotation (9 values), then the
|
|
286
|
-
* translation (3 values).
|
|
357
|
+
* translation (3 values), then the scale (3 values).
|
|
287
358
|
*/
|
|
288
359
|
placement(index: number, generation: number): Float64Array;
|
|
289
360
|
/**
|
|
@@ -360,10 +431,11 @@ export class WasmScene {
|
|
|
360
431
|
*/
|
|
361
432
|
set_mode(index: number, generation: number, mode: number): void;
|
|
362
433
|
/**
|
|
363
|
-
* Sets the placement from a row-major rotation (9 values)
|
|
364
|
-
* translation (3 values)
|
|
434
|
+
* Sets the placement from a row-major rotation (9 values), a
|
|
435
|
+
* translation (3 values) and a scale (3 values, each positive; `None`
|
|
436
|
+
* for `[1, 1, 1]`). The rotation must be a proper rotation.
|
|
365
437
|
*/
|
|
366
|
-
set_placement(index: number, generation: number, rotation: Float64Array, translation: Float64Array): void;
|
|
438
|
+
set_placement(index: number, generation: number, rotation: Float64Array, translation: Float64Array, scale?: Float64Array | null): void;
|
|
367
439
|
/**
|
|
368
440
|
* Turns a section's fill on or off.
|
|
369
441
|
*/
|
|
@@ -448,6 +520,8 @@ export interface InitOutput {
|
|
|
448
520
|
readonly computeBounds: (a: number, b: number) => [number, number, number, number];
|
|
449
521
|
readonly computeVertexNormals: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
450
522
|
readonly wasmscene_abandon_field_step: (a: number) => void;
|
|
523
|
+
readonly wasmscene_add_curvature_field: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
524
|
+
readonly wasmscene_add_curvature_field_deferred: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
451
525
|
readonly wasmscene_add_distance_field: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
452
526
|
readonly wasmscene_add_distance_field_deferred: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
453
527
|
readonly wasmscene_add_mesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
@@ -456,9 +530,12 @@ export interface InitOutput {
|
|
|
456
530
|
readonly wasmscene_add_mesh_push_positions: (a: number, b: number, c: number, d: number) => [number, number];
|
|
457
531
|
readonly wasmscene_add_mesh_step: (a: number, b: number, c: number) => [number, number, number];
|
|
458
532
|
readonly wasmscene_add_section: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
533
|
+
readonly wasmscene_add_thickness_field: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
534
|
+
readonly wasmscene_add_thickness_field_deferred: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
459
535
|
readonly wasmscene_analyze: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
460
536
|
readonly wasmscene_begin_add_mesh_upload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
461
537
|
readonly wasmscene_begin_step: (a: number) => void;
|
|
538
|
+
readonly wasmscene_boolean: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
462
539
|
readonly wasmscene_bounds: (a: number, b: number, c: number) => [number, number, number, number];
|
|
463
540
|
readonly wasmscene_can_redo: (a: number) => number;
|
|
464
541
|
readonly wasmscene_can_undo: (a: number) => number;
|
|
@@ -471,6 +548,7 @@ export interface InitOutput {
|
|
|
471
548
|
readonly wasmscene_colors_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
472
549
|
readonly wasmscene_compact: (a: number, b: number, c: number) => [number, number];
|
|
473
550
|
readonly wasmscene_content_stamp: (a: number, b: number, c: number) => [number, number, number];
|
|
551
|
+
readonly wasmscene_cut_by_plane: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
474
552
|
readonly wasmscene_drop_add_mesh: (a: number, b: number) => void;
|
|
475
553
|
readonly wasmscene_edit: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
476
554
|
readonly wasmscene_end_step: (a: number) => [number, number];
|
|
@@ -489,7 +567,9 @@ export interface InitOutput {
|
|
|
489
567
|
readonly wasmscene_indices_len: (a: number, b: number, c: number) => [number, number, number];
|
|
490
568
|
readonly wasmscene_indices_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
491
569
|
readonly wasmscene_intersects: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
570
|
+
readonly wasmscene_join: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
492
571
|
readonly wasmscene_matrix4: (a: number, b: number, c: number) => [number, number, number, number];
|
|
572
|
+
readonly wasmscene_measure: (a: number, b: number, c: number) => [number, number, number, number];
|
|
493
573
|
readonly wasmscene_mesh_distance: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
494
574
|
readonly wasmscene_mode: (a: number, b: number, c: number) => [number, number, number];
|
|
495
575
|
readonly wasmscene_new: () => number;
|
|
@@ -510,7 +590,7 @@ export interface InitOutput {
|
|
|
510
590
|
readonly wasmscene_set_coloring: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
511
591
|
readonly wasmscene_set_defer_fields: (a: number, b: number) => void;
|
|
512
592
|
readonly wasmscene_set_mode: (a: number, b: number, c: number, d: number) => [number, number];
|
|
513
|
-
readonly wasmscene_set_placement: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
593
|
+
readonly wasmscene_set_placement: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
514
594
|
readonly wasmscene_set_section_fill: (a: number, b: number, c: number) => [number, number];
|
|
515
595
|
readonly wasmscene_set_section_meshes: (a: number, b: number, c: number, d: number) => [number, number];
|
|
516
596
|
readonly wasmscene_set_section_plane: (a: number, b: number, c: number, d: number) => [number, number];
|
|
@@ -20,6 +20,46 @@ export class WasmScene {
|
|
|
20
20
|
abandon_field_step() {
|
|
21
21
|
wasm.wasmscene_abandon_field_step(this.__wbg_ptr);
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Adds a per-vertex curvature field on the mesh given as a flat pair
|
|
25
|
+
* `[index, generation]`, and returns its raw id: the signed mean
|
|
26
|
+
* curvature at each vertex, in 1/world-units (positive on domes, about
|
|
27
|
+
* `1 / r` on a sphere of radius `r`; negative in bowls; zero on flats).
|
|
28
|
+
* Dead slots and unused vertices read NaN.
|
|
29
|
+
* @param {string} name
|
|
30
|
+
* @param {Uint32Array} on
|
|
31
|
+
* @returns {number}
|
|
32
|
+
*/
|
|
33
|
+
add_curvature_field(name, on) {
|
|
34
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
|
+
const len0 = WASM_VECTOR_LEN;
|
|
36
|
+
const ptr1 = passArray32ToWasm0(on, wasm.__wbindgen_malloc);
|
|
37
|
+
const len1 = WASM_VECTOR_LEN;
|
|
38
|
+
const ret = wasm.wasmscene_add_curvature_field(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
39
|
+
if (ret[2]) {
|
|
40
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
41
|
+
}
|
|
42
|
+
return ret[0] >>> 0;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* [`WasmScene::add_curvature_field`] computing nothing yet: the field
|
|
46
|
+
* is due until stepped or updated; see
|
|
47
|
+
* [`Scene::add_curvature_field_deferred`].
|
|
48
|
+
* @param {string} name
|
|
49
|
+
* @param {Uint32Array} on
|
|
50
|
+
* @returns {number}
|
|
51
|
+
*/
|
|
52
|
+
add_curvature_field_deferred(name, on) {
|
|
53
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
54
|
+
const len0 = WASM_VECTOR_LEN;
|
|
55
|
+
const ptr1 = passArray32ToWasm0(on, wasm.__wbindgen_malloc);
|
|
56
|
+
const len1 = WASM_VECTOR_LEN;
|
|
57
|
+
const ret = wasm.wasmscene_add_curvature_field_deferred(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
58
|
+
if (ret[2]) {
|
|
59
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
60
|
+
}
|
|
61
|
+
return ret[0] >>> 0;
|
|
62
|
+
}
|
|
23
63
|
/**
|
|
24
64
|
* Adds a signed distance field on mesh `on` to one or more target
|
|
25
65
|
* meshes, given as flat pairs `[on index, on generation, to index, to
|
|
@@ -175,6 +215,48 @@ export class WasmScene {
|
|
|
175
215
|
}
|
|
176
216
|
return ret[0] >>> 0;
|
|
177
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Adds a per-vertex wall-thickness field on the mesh given as a flat
|
|
220
|
+
* pair `[index, generation]`, and returns its raw id: the distance to
|
|
221
|
+
* the opposite surface along each vertex's smooth normal, in world
|
|
222
|
+
* units. Open sheets and rims read NaN; hits beyond `max_distance`
|
|
223
|
+
* read `Infinity`.
|
|
224
|
+
* @param {string} name
|
|
225
|
+
* @param {Uint32Array} on
|
|
226
|
+
* @param {number} max_distance
|
|
227
|
+
* @returns {number}
|
|
228
|
+
*/
|
|
229
|
+
add_thickness_field(name, on, max_distance) {
|
|
230
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
231
|
+
const len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ptr1 = passArray32ToWasm0(on, wasm.__wbindgen_malloc);
|
|
233
|
+
const len1 = WASM_VECTOR_LEN;
|
|
234
|
+
const ret = wasm.wasmscene_add_thickness_field(this.__wbg_ptr, ptr0, len0, ptr1, len1, max_distance);
|
|
235
|
+
if (ret[2]) {
|
|
236
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
237
|
+
}
|
|
238
|
+
return ret[0] >>> 0;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* [`WasmScene::add_thickness_field`] computing nothing yet: the field
|
|
242
|
+
* is due until stepped or updated; see
|
|
243
|
+
* [`Scene::add_thickness_field_deferred`].
|
|
244
|
+
* @param {string} name
|
|
245
|
+
* @param {Uint32Array} on
|
|
246
|
+
* @param {number} max_distance
|
|
247
|
+
* @returns {number}
|
|
248
|
+
*/
|
|
249
|
+
add_thickness_field_deferred(name, on, max_distance) {
|
|
250
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
252
|
+
const ptr1 = passArray32ToWasm0(on, wasm.__wbindgen_malloc);
|
|
253
|
+
const len1 = WASM_VECTOR_LEN;
|
|
254
|
+
const ret = wasm.wasmscene_add_thickness_field_deferred(this.__wbg_ptr, ptr0, len0, ptr1, len1, max_distance);
|
|
255
|
+
if (ret[2]) {
|
|
256
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
257
|
+
}
|
|
258
|
+
return ret[0] >>> 0;
|
|
259
|
+
}
|
|
178
260
|
/**
|
|
179
261
|
* A read-only report of the mesh's defects, laid out as in
|
|
180
262
|
* [`crate::edit::encode_analysis`]. `weld_tolerance` (local units,
|
|
@@ -229,6 +311,30 @@ export class WasmScene {
|
|
|
229
311
|
begin_step() {
|
|
230
312
|
wasm.wasmscene_begin_step(this.__wbg_ptr);
|
|
231
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Combines mesh B into mesh A in the world and returns `[index,
|
|
316
|
+
* generation, kept triangles, triangles added]` of A (the result
|
|
317
|
+
* replaces A with A's placement; B is unchanged). `op` is 0 (union),
|
|
318
|
+
* 1 (subtract) or 2 (intersect). The boolean undoes in one step;
|
|
319
|
+
* combining a mesh with itself is a no-op for union and intersect,
|
|
320
|
+
* and clears it for subtract. Only positions and triangles cross
|
|
321
|
+
* over; the new vertices take channel defaults.
|
|
322
|
+
* @param {number} a_index
|
|
323
|
+
* @param {number} a_generation
|
|
324
|
+
* @param {number} b_index
|
|
325
|
+
* @param {number} b_generation
|
|
326
|
+
* @param {number} op
|
|
327
|
+
* @returns {Uint32Array}
|
|
328
|
+
*/
|
|
329
|
+
boolean(a_index, a_generation, b_index, b_generation, op) {
|
|
330
|
+
const ret = wasm.wasmscene_boolean(this.__wbg_ptr, a_index, a_generation, b_index, b_generation, op);
|
|
331
|
+
if (ret[3]) {
|
|
332
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
333
|
+
}
|
|
334
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
335
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
336
|
+
return v1;
|
|
337
|
+
}
|
|
232
338
|
/**
|
|
233
339
|
* The box around the vertices the live triangles use, in the mesh's
|
|
234
340
|
* stored local coordinates: `[min xyz, max xyz]`. Empty without live
|
|
@@ -383,6 +489,32 @@ export class WasmScene {
|
|
|
383
489
|
}
|
|
384
490
|
return ret[0];
|
|
385
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* Cuts a mesh with a world plane `[origin xyz, normal xyz]`: the `+`
|
|
494
|
+
* side stays on the mesh and the `-` side is added as a new mesh with
|
|
495
|
+
* the same placement. Returns `[kept index, kept generation, added
|
|
496
|
+
* index, added generation, kept triangles, removed triangles, cap
|
|
497
|
+
* triangles]`. With `cap` (the usual case) both openings are closed
|
|
498
|
+
* with flat, unfaired patches; without it both parts keep the open rim.
|
|
499
|
+
* The cut undoes in one step; the added mesh stays, like the removed
|
|
500
|
+
* source of [`WasmScene::join`].
|
|
501
|
+
* @param {number} index
|
|
502
|
+
* @param {number} generation
|
|
503
|
+
* @param {Float64Array} plane
|
|
504
|
+
* @param {boolean} cap
|
|
505
|
+
* @returns {Uint32Array}
|
|
506
|
+
*/
|
|
507
|
+
cut_by_plane(index, generation, plane, cap) {
|
|
508
|
+
const ptr0 = passArrayF64ToWasm0(plane, wasm.__wbindgen_malloc);
|
|
509
|
+
const len0 = WASM_VECTOR_LEN;
|
|
510
|
+
const ret = wasm.wasmscene_cut_by_plane(this.__wbg_ptr, index, generation, ptr0, len0, cap);
|
|
511
|
+
if (ret[3]) {
|
|
512
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
513
|
+
}
|
|
514
|
+
var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
515
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
516
|
+
return v2;
|
|
517
|
+
}
|
|
386
518
|
/**
|
|
387
519
|
* Drops a mesh being added in steps (nothing was added).
|
|
388
520
|
* @param {number} build
|
|
@@ -649,9 +781,36 @@ export class WasmScene {
|
|
|
649
781
|
}
|
|
650
782
|
return ret[0] !== 0;
|
|
651
783
|
}
|
|
784
|
+
/**
|
|
785
|
+
* Joins mesh B into mesh A: copies B's geometry into A, bridges the two
|
|
786
|
+
* loops and removes B; see [`Scene::join`]. `loops` holds the two loop
|
|
787
|
+
* ids (`min_vertex, len, hash low, hash high` each, A's first) and
|
|
788
|
+
* `max_edges` is NaN for the default. Returns `[vertices_added,
|
|
789
|
+
* triangles_added, bridge_triangles_added]`.
|
|
790
|
+
* @param {number} a_index
|
|
791
|
+
* @param {number} a_generation
|
|
792
|
+
* @param {number} b_index
|
|
793
|
+
* @param {number} b_generation
|
|
794
|
+
* @param {Uint32Array} loops
|
|
795
|
+
* @param {number} max_edges
|
|
796
|
+
* @returns {Float64Array}
|
|
797
|
+
*/
|
|
798
|
+
join(a_index, a_generation, b_index, b_generation, loops, max_edges) {
|
|
799
|
+
const ptr0 = passArray32ToWasm0(loops, wasm.__wbindgen_malloc);
|
|
800
|
+
const len0 = WASM_VECTOR_LEN;
|
|
801
|
+
const ret = wasm.wasmscene_join(this.__wbg_ptr, a_index, a_generation, b_index, b_generation, ptr0, len0, max_edges);
|
|
802
|
+
if (ret[3]) {
|
|
803
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
804
|
+
}
|
|
805
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
806
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
807
|
+
return v2;
|
|
808
|
+
}
|
|
652
809
|
/**
|
|
653
810
|
* The world matrix of the local render coordinates,
|
|
654
|
-
* `placement · translate(origin)`, column-major (16 values)
|
|
811
|
+
* `placement · translate(origin)`, column-major (16 values): the
|
|
812
|
+
* rotation columns are scaled, and the last column is
|
|
813
|
+
* `rotation · (scale · origin) + translation`.
|
|
655
814
|
* @param {number} index
|
|
656
815
|
* @param {number} generation
|
|
657
816
|
* @returns {Float64Array}
|
|
@@ -665,6 +824,29 @@ export class WasmScene {
|
|
|
665
824
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
666
825
|
return v1;
|
|
667
826
|
}
|
|
827
|
+
/**
|
|
828
|
+
* Scalar measurements of a mesh in world coordinates (its placement
|
|
829
|
+
* applied, so scaled meshes measure scaled): `[area, volume (NaN when
|
|
830
|
+
* the mesh is not watertight), closed (0/1), volume reason (0 closed,
|
|
831
|
+
* 1 open, 2 non-manifold), boundary loops, non-manifold edges,
|
|
832
|
+
* orientation conflicts]`. Area is always defined; volume is `None`
|
|
833
|
+
* with its reason unless the mesh has no boundary and no
|
|
834
|
+
* non-manifold edge. The volume is the absolute signed sum, so
|
|
835
|
+
* inconsistent winding only flags `orientation conflicts` without
|
|
836
|
+
* failing.
|
|
837
|
+
* @param {number} index
|
|
838
|
+
* @param {number} generation
|
|
839
|
+
* @returns {Float64Array}
|
|
840
|
+
*/
|
|
841
|
+
measure(index, generation) {
|
|
842
|
+
const ret = wasm.wasmscene_measure(this.__wbg_ptr, index, generation);
|
|
843
|
+
if (ret[3]) {
|
|
844
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
845
|
+
}
|
|
846
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
847
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
848
|
+
return v1;
|
|
849
|
+
}
|
|
668
850
|
/**
|
|
669
851
|
* The distance between two meshes' surfaces as placed. Empty when it
|
|
670
852
|
* exceeds `max_distance` or a mesh has no triangle, else `[distance,
|
|
@@ -739,7 +921,7 @@ export class WasmScene {
|
|
|
739
921
|
}
|
|
740
922
|
/**
|
|
741
923
|
* The placement: the row-major rotation (9 values), then the
|
|
742
|
-
* translation (3 values).
|
|
924
|
+
* translation (3 values), then the scale (3 values).
|
|
743
925
|
* @param {number} index
|
|
744
926
|
* @param {number} generation
|
|
745
927
|
* @returns {Float64Array}
|
|
@@ -965,19 +1147,23 @@ export class WasmScene {
|
|
|
965
1147
|
}
|
|
966
1148
|
}
|
|
967
1149
|
/**
|
|
968
|
-
* Sets the placement from a row-major rotation (9 values)
|
|
969
|
-
* translation (3 values)
|
|
1150
|
+
* Sets the placement from a row-major rotation (9 values), a
|
|
1151
|
+
* translation (3 values) and a scale (3 values, each positive; `None`
|
|
1152
|
+
* for `[1, 1, 1]`). The rotation must be a proper rotation.
|
|
970
1153
|
* @param {number} index
|
|
971
1154
|
* @param {number} generation
|
|
972
1155
|
* @param {Float64Array} rotation
|
|
973
1156
|
* @param {Float64Array} translation
|
|
1157
|
+
* @param {Float64Array | null} [scale]
|
|
974
1158
|
*/
|
|
975
|
-
set_placement(index, generation, rotation, translation) {
|
|
1159
|
+
set_placement(index, generation, rotation, translation, scale) {
|
|
976
1160
|
const ptr0 = passArrayF64ToWasm0(rotation, wasm.__wbindgen_malloc);
|
|
977
1161
|
const len0 = WASM_VECTOR_LEN;
|
|
978
1162
|
const ptr1 = passArrayF64ToWasm0(translation, wasm.__wbindgen_malloc);
|
|
979
1163
|
const len1 = WASM_VECTOR_LEN;
|
|
980
|
-
|
|
1164
|
+
var ptr2 = isLikeNone(scale) ? 0 : passArrayF64ToWasm0(scale, wasm.__wbindgen_malloc);
|
|
1165
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1166
|
+
const ret = wasm.wasmscene_set_placement(this.__wbg_ptr, index, generation, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
981
1167
|
if (ret[1]) {
|
|
982
1168
|
throw takeFromExternrefTable0(ret[0]);
|
|
983
1169
|
}
|
|
Binary file
|