okgeometry-api 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Mesh.d.ts +42 -0
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +81 -0
- package/dist/Mesh.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/dist/wasm-bindings.d.ts +44 -2
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +95 -2
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +3 -3
- package/src/Mesh.ts +97 -0
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +36 -2
- package/src/wasm-bindings.js +100 -2
package/src/wasm-bindings.d.ts
CHANGED
|
@@ -474,11 +474,21 @@ export function mesh_evaluate(vertex_count: number, buffer: Float64Array, u: num
|
|
|
474
474
|
|
|
475
475
|
/**
|
|
476
476
|
* Export a mesh to OBJ format
|
|
477
|
-
* Takes
|
|
478
|
-
*
|
|
477
|
+
* Takes the standard mesh buffer (`[vertexCount, ...positions, ...indices]`,
|
|
478
|
+
* same format as `mesh_to_buffers` / `Mesh.rawBuffer`) and returns OBJ text.
|
|
479
479
|
*/
|
|
480
480
|
export function mesh_export_obj(vertex_count: number, buffer: Float64Array): string;
|
|
481
481
|
|
|
482
|
+
/**
|
|
483
|
+
* Export a mesh (standard buffer format) to ASCII STL text.
|
|
484
|
+
*/
|
|
485
|
+
export function mesh_export_stl_ascii(vertex_count: number, buffer: Float64Array, name: string): string;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Export a mesh (standard buffer format) to binary STL bytes.
|
|
489
|
+
*/
|
|
490
|
+
export function mesh_export_stl_binary(vertex_count: number, buffer: Float64Array): Uint8Array;
|
|
491
|
+
|
|
482
492
|
/**
|
|
483
493
|
* Push/pull a planar face set by moving its coplanar connected region.
|
|
484
494
|
*/
|
|
@@ -564,6 +574,17 @@ export function mesh_get_stats(vertex_count: number, buffer: Float64Array): Floa
|
|
|
564
574
|
*/
|
|
565
575
|
export function mesh_import_obj(obj_data: string): Float64Array;
|
|
566
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Import STL data (binary or ASCII, auto-detected) and return the standard
|
|
579
|
+
* mesh buffer (`[vertexCount, ...positions, ...indices]`). STL stores an
|
|
580
|
+
* unindexed triangle soup, so coincident vertices are welded.
|
|
581
|
+
*
|
|
582
|
+
* `weld_tolerance`: absolute distance under which vertices merge; `<= 0`
|
|
583
|
+
* selects an automatic tolerance from the bounding box. Returns an empty
|
|
584
|
+
* buffer on parse failure.
|
|
585
|
+
*/
|
|
586
|
+
export function mesh_import_stl(data: Uint8Array, weld_tolerance: number): Float64Array;
|
|
587
|
+
|
|
567
588
|
/**
|
|
568
589
|
* Check if triangulated mesh is a closed volume (no welded boundary edges).
|
|
569
590
|
*/
|
|
@@ -649,6 +670,15 @@ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: numb
|
|
|
649
670
|
*/
|
|
650
671
|
export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
|
|
651
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
|
|
675
|
+
* `outside` = the solid on the negative side of the surface, `inside` = the
|
|
676
|
+
* positive side; each is capped by the portion of the surface inside the
|
|
677
|
+
* solid, welded into a watertight result. Same packed layout as the other
|
|
678
|
+
* split exports.
|
|
679
|
+
*/
|
|
680
|
+
export function mesh_solid_split_by_surface(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
681
|
+
|
|
652
682
|
export function mesh_solid_split_plane(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number, operation: string): Float64Array;
|
|
653
683
|
|
|
654
684
|
/**
|
|
@@ -1018,6 +1048,8 @@ export interface InitOutput {
|
|
|
1018
1048
|
readonly mesh_create_sphere: (a: number, b: number, c: number) => [number, number];
|
|
1019
1049
|
readonly mesh_evaluate: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1020
1050
|
readonly mesh_export_obj: (a: number, b: number, c: number) => [number, number];
|
|
1051
|
+
readonly mesh_export_stl_ascii: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1052
|
+
readonly mesh_export_stl_binary: (a: number, b: number, c: number) => [number, number];
|
|
1021
1053
|
readonly mesh_extrude_face: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1022
1054
|
readonly mesh_extrude_planar_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1023
1055
|
readonly mesh_find_face_group_by_normal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
@@ -1033,6 +1065,7 @@ export interface InitOutput {
|
|
|
1033
1065
|
readonly mesh_get_smooth_face_group: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1034
1066
|
readonly mesh_get_stats: (a: number, b: number, c: number) => [number, number];
|
|
1035
1067
|
readonly mesh_import_obj: (a: number, b: number) => [number, number];
|
|
1068
|
+
readonly mesh_import_stl: (a: number, b: number, c: number) => [number, number];
|
|
1036
1069
|
readonly mesh_is_closed_volume: (a: number, b: number, c: number) => number;
|
|
1037
1070
|
readonly mesh_manifold_port_import_roundtrip_debug: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1038
1071
|
readonly mesh_manifold_port_import_stage_hashes_debug: (a: number, b: number, c: number, d: number) => [number, number];
|
|
@@ -1048,6 +1081,7 @@ export interface InitOutput {
|
|
|
1048
1081
|
readonly mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
1049
1082
|
readonly mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1050
1083
|
readonly mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
1084
|
+
readonly mesh_solid_split_by_surface: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
1051
1085
|
readonly mesh_solid_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
1052
1086
|
readonly mesh_surface_difference_all: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1053
1087
|
readonly mesh_surface_split: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
package/src/wasm-bindings.js
CHANGED
|
@@ -1688,8 +1688,8 @@ export function mesh_evaluate(vertex_count, buffer, u, v) {
|
|
|
1688
1688
|
|
|
1689
1689
|
/**
|
|
1690
1690
|
* Export a mesh to OBJ format
|
|
1691
|
-
* Takes
|
|
1692
|
-
*
|
|
1691
|
+
* Takes the standard mesh buffer (`[vertexCount, ...positions, ...indices]`,
|
|
1692
|
+
* same format as `mesh_to_buffers` / `Mesh.rawBuffer`) and returns OBJ text.
|
|
1693
1693
|
* @param {number} vertex_count
|
|
1694
1694
|
* @param {Float64Array} buffer
|
|
1695
1695
|
* @returns {string}
|
|
@@ -1709,6 +1709,45 @@ export function mesh_export_obj(vertex_count, buffer) {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
1711
|
|
|
1712
|
+
/**
|
|
1713
|
+
* Export a mesh (standard buffer format) to ASCII STL text.
|
|
1714
|
+
* @param {number} vertex_count
|
|
1715
|
+
* @param {Float64Array} buffer
|
|
1716
|
+
* @param {string} name
|
|
1717
|
+
* @returns {string}
|
|
1718
|
+
*/
|
|
1719
|
+
export function mesh_export_stl_ascii(vertex_count, buffer, name) {
|
|
1720
|
+
let deferred3_0;
|
|
1721
|
+
let deferred3_1;
|
|
1722
|
+
try {
|
|
1723
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1724
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1725
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1726
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1727
|
+
const ret = wasm.mesh_export_stl_ascii(vertex_count, ptr0, len0, ptr1, len1);
|
|
1728
|
+
deferred3_0 = ret[0];
|
|
1729
|
+
deferred3_1 = ret[1];
|
|
1730
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1731
|
+
} finally {
|
|
1732
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Export a mesh (standard buffer format) to binary STL bytes.
|
|
1738
|
+
* @param {number} vertex_count
|
|
1739
|
+
* @param {Float64Array} buffer
|
|
1740
|
+
* @returns {Uint8Array}
|
|
1741
|
+
*/
|
|
1742
|
+
export function mesh_export_stl_binary(vertex_count, buffer) {
|
|
1743
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1744
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1745
|
+
const ret = wasm.mesh_export_stl_binary(vertex_count, ptr0, len0);
|
|
1746
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1747
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1748
|
+
return v2;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1712
1751
|
/**
|
|
1713
1752
|
* Push/pull a planar face set by moving its coplanar connected region.
|
|
1714
1753
|
* @param {number} vertex_count
|
|
@@ -1974,6 +2013,27 @@ export function mesh_import_obj(obj_data) {
|
|
|
1974
2013
|
return v2;
|
|
1975
2014
|
}
|
|
1976
2015
|
|
|
2016
|
+
/**
|
|
2017
|
+
* Import STL data (binary or ASCII, auto-detected) and return the standard
|
|
2018
|
+
* mesh buffer (`[vertexCount, ...positions, ...indices]`). STL stores an
|
|
2019
|
+
* unindexed triangle soup, so coincident vertices are welded.
|
|
2020
|
+
*
|
|
2021
|
+
* `weld_tolerance`: absolute distance under which vertices merge; `<= 0`
|
|
2022
|
+
* selects an automatic tolerance from the bounding box. Returns an empty
|
|
2023
|
+
* buffer on parse failure.
|
|
2024
|
+
* @param {Uint8Array} data
|
|
2025
|
+
* @param {number} weld_tolerance
|
|
2026
|
+
* @returns {Float64Array}
|
|
2027
|
+
*/
|
|
2028
|
+
export function mesh_import_stl(data, weld_tolerance) {
|
|
2029
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2030
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2031
|
+
const ret = wasm.mesh_import_stl(ptr0, len0, weld_tolerance);
|
|
2032
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2033
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2034
|
+
return v2;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
1977
2037
|
/**
|
|
1978
2038
|
* Check if triangulated mesh is a closed volume (no welded boundary edges).
|
|
1979
2039
|
* @param {number} vertex_count
|
|
@@ -2272,6 +2332,32 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
|
|
|
2272
2332
|
return v2;
|
|
2273
2333
|
}
|
|
2274
2334
|
|
|
2335
|
+
/**
|
|
2336
|
+
* Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
|
|
2337
|
+
* `outside` = the solid on the negative side of the surface, `inside` = the
|
|
2338
|
+
* positive side; each is capped by the portion of the surface inside the
|
|
2339
|
+
* solid, welded into a watertight result. Same packed layout as the other
|
|
2340
|
+
* split exports.
|
|
2341
|
+
* @param {number} vertex_count_a
|
|
2342
|
+
* @param {Float64Array} buffer_a
|
|
2343
|
+
* @param {number} vertex_count_b
|
|
2344
|
+
* @param {Float64Array} buffer_b
|
|
2345
|
+
* @param {string} operation
|
|
2346
|
+
* @returns {Float64Array}
|
|
2347
|
+
*/
|
|
2348
|
+
export function mesh_solid_split_by_surface(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
2349
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
2350
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2351
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
2352
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2353
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2354
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2355
|
+
const ret = wasm.mesh_solid_split_by_surface(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
2356
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2357
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2358
|
+
return v4;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2275
2361
|
/**
|
|
2276
2362
|
* @param {number} vertex_count
|
|
2277
2363
|
* @param {Float64Array} buffer
|
|
@@ -3150,6 +3236,11 @@ function getArrayF64FromWasm0(ptr, len) {
|
|
|
3150
3236
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
3151
3237
|
}
|
|
3152
3238
|
|
|
3239
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
3240
|
+
ptr = ptr >>> 0;
|
|
3241
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3153
3244
|
let cachedFloat32ArrayMemory0 = null;
|
|
3154
3245
|
function getFloat32ArrayMemory0() {
|
|
3155
3246
|
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
@@ -3179,6 +3270,13 @@ function getUint8ArrayMemory0() {
|
|
|
3179
3270
|
return cachedUint8ArrayMemory0;
|
|
3180
3271
|
}
|
|
3181
3272
|
|
|
3273
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
3274
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
3275
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
3276
|
+
WASM_VECTOR_LEN = arg.length;
|
|
3277
|
+
return ptr;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3182
3280
|
function passArrayF64ToWasm0(arg, malloc) {
|
|
3183
3281
|
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
3184
3282
|
getFloat64ArrayMemory0().set(arg, ptr / 8);
|