okgeometry-api 0.5.0 → 0.5.2
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 +0 -32
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +8 -91
- package/dist/Mesh.js.map +1 -1
- package/dist/engine.d.ts +0 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +0 -37
- package/dist/engine.js.map +1 -1
- package/dist/mesh-boolean.protocol.d.ts +2 -2
- package/dist/mesh-boolean.protocol.d.ts.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/package.json +46 -45
- package/src/Arc.ts +117 -0
- package/src/BufferCodec.ts +181 -0
- package/src/Circle.ts +153 -0
- package/src/Geometry.ts +39 -0
- package/src/Line.ts +144 -0
- package/src/Mesh.ts +1476 -0
- package/src/NurbsCurve.ts +240 -0
- package/src/NurbsSurface.ts +267 -0
- package/src/Plane.ts +132 -0
- package/src/Point.ts +145 -0
- package/src/PolyCurve.ts +306 -0
- package/src/Polygon.ts +75 -0
- package/src/Polyline.ts +153 -0
- package/src/Ray.ts +90 -0
- package/src/Vec3.ts +159 -0
- package/src/engine.ts +92 -0
- package/src/index.ts +45 -0
- package/src/mesh-boolean.pool.ts +481 -0
- package/src/mesh-boolean.protocol.ts +122 -0
- package/src/mesh-boolean.worker.ts +160 -0
- package/src/types.ts +84 -0
- package/src/wasm-base64.ts +2 -0
- package/wasm/okgeometrycore.d.ts +19 -20
- package/wasm/okgeometrycore.js +62 -26
- package/wasm/okgeometrycore_bg.js +47 -0
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/okgeometrycore_bg.wasm.d.ts +2 -2
package/wasm/okgeometrycore.d.ts
CHANGED
|
@@ -159,14 +159,6 @@ export function make_nurbs_curves_compatible(curves_data: Float64Array): Float64
|
|
|
159
159
|
*/
|
|
160
160
|
export function mesh_apply_matrix(vertex_count: number, buffer: Float64Array, matrix: Float64Array): Float64Array;
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
* Compare legacy and nextgen backend paths on the same inputs.
|
|
164
|
-
*
|
|
165
|
-
* Returns:
|
|
166
|
-
* [legacy_ok, nextgen_ok, legacy_ms, nextgen_ms, legacy_faces, nextgen_faces]
|
|
167
|
-
*/
|
|
168
|
-
export function mesh_boolean_compare_backends(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
169
|
-
|
|
170
162
|
/**
|
|
171
163
|
* Perform boolean intersection on two meshes
|
|
172
164
|
*/
|
|
@@ -188,22 +180,29 @@ export function mesh_boolean_intersection(vertex_count_a: number, buffer_a: Floa
|
|
|
188
180
|
export function mesh_boolean_operation(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
189
181
|
|
|
190
182
|
/**
|
|
191
|
-
* Perform boolean operation
|
|
183
|
+
* Perform boolean operation and return stage-level profiling data followed by
|
|
184
|
+
* the result mesh buffer.
|
|
192
185
|
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
186
|
+
* Output format:
|
|
187
|
+
* [profile_len(=9), broadphase_ms, segments_ms, split_ms, classify_ms,
|
|
188
|
+
* extract_ms, cleanup_ms, pair_accepted, pair_rejected, pair_degenerate,
|
|
189
|
+
* mesh_buffer...]
|
|
195
190
|
*/
|
|
196
|
-
export function
|
|
191
|
+
export function mesh_boolean_operation_profiled(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Perform boolean operation with explicit backend and return stage-level
|
|
195
|
+
* profiling data followed by the result mesh buffer.
|
|
196
|
+
*/
|
|
197
|
+
export function mesh_boolean_operation_profiled_with_backend(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, backend: string): Float64Array;
|
|
197
198
|
|
|
198
199
|
/**
|
|
199
|
-
*
|
|
200
|
+
* Perform boolean operation on two meshes with explicit backend selection.
|
|
200
201
|
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* legacy_broadphase_ms, legacy_segments_ms, legacy_split_ms, legacy_classify_ms, legacy_extract_ms, legacy_cleanup_ms,
|
|
204
|
-
* nextgen_broadphase_ms, nextgen_segments_ms, nextgen_split_ms, nextgen_classify_ms, nextgen_extract_ms, nextgen_cleanup_ms]
|
|
202
|
+
* # Parameters
|
|
203
|
+
* * `backend` - "nextgen".
|
|
205
204
|
*/
|
|
206
|
-
export function
|
|
205
|
+
export function mesh_boolean_operation_with_backend(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, backend: string): Float64Array;
|
|
207
206
|
|
|
208
207
|
/**
|
|
209
208
|
* Perform boolean subtraction on two meshes (A - B)
|
|
@@ -597,11 +596,11 @@ export interface InitOutput {
|
|
|
597
596
|
readonly loft_polylines: (a: number, b: number, c: number, d: number) => [number, number];
|
|
598
597
|
readonly make_nurbs_curves_compatible: (a: number, b: number) => [number, number];
|
|
599
598
|
readonly mesh_apply_matrix: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
600
|
-
readonly mesh_boolean_compare_backends: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
601
599
|
readonly mesh_boolean_intersection: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
602
600
|
readonly mesh_boolean_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
601
|
+
readonly mesh_boolean_operation_profiled: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
602
|
+
readonly mesh_boolean_operation_profiled_with_backend: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
603
603
|
readonly mesh_boolean_operation_with_backend: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
604
|
-
readonly mesh_boolean_profile_backends: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
605
604
|
readonly mesh_boolean_subtraction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
606
605
|
readonly mesh_boolean_union: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
607
606
|
readonly mesh_boundary_polylines: (a: number, b: number, c: number) => [number, number];
|
package/wasm/okgeometrycore.js
CHANGED
|
@@ -451,31 +451,6 @@ export function mesh_apply_matrix(vertex_count, buffer, matrix) {
|
|
|
451
451
|
return v3;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
/**
|
|
455
|
-
* Compare legacy and nextgen backend paths on the same inputs.
|
|
456
|
-
*
|
|
457
|
-
* Returns:
|
|
458
|
-
* [legacy_ok, nextgen_ok, legacy_ms, nextgen_ms, legacy_faces, nextgen_faces]
|
|
459
|
-
* @param {number} vertex_count_a
|
|
460
|
-
* @param {Float64Array} buffer_a
|
|
461
|
-
* @param {number} vertex_count_b
|
|
462
|
-
* @param {Float64Array} buffer_b
|
|
463
|
-
* @param {string} operation
|
|
464
|
-
* @returns {Float64Array}
|
|
465
|
-
*/
|
|
466
|
-
export function mesh_boolean_compare_backends(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
467
|
-
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
468
|
-
const len0 = WASM_VECTOR_LEN;
|
|
469
|
-
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
470
|
-
const len1 = WASM_VECTOR_LEN;
|
|
471
|
-
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
472
|
-
const len2 = WASM_VECTOR_LEN;
|
|
473
|
-
const ret = wasm.mesh_boolean_compare_backends(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
474
|
-
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
475
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
476
|
-
return v4;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
454
|
/**
|
|
480
455
|
* Perform boolean intersection on two meshes
|
|
481
456
|
* @param {number} vertex_count_a
|
|
@@ -527,11 +502,65 @@ export function mesh_boolean_operation(vertex_count_a, buffer_a, vertex_count_b,
|
|
|
527
502
|
return v4;
|
|
528
503
|
}
|
|
529
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Perform boolean operation and return stage-level profiling data followed by
|
|
507
|
+
* the result mesh buffer.
|
|
508
|
+
*
|
|
509
|
+
* Output format:
|
|
510
|
+
* [profile_len(=9), broadphase_ms, segments_ms, split_ms, classify_ms,
|
|
511
|
+
* extract_ms, cleanup_ms, pair_accepted, pair_rejected, pair_degenerate,
|
|
512
|
+
* mesh_buffer...]
|
|
513
|
+
* @param {number} vertex_count_a
|
|
514
|
+
* @param {Float64Array} buffer_a
|
|
515
|
+
* @param {number} vertex_count_b
|
|
516
|
+
* @param {Float64Array} buffer_b
|
|
517
|
+
* @param {string} operation
|
|
518
|
+
* @returns {Float64Array}
|
|
519
|
+
*/
|
|
520
|
+
export function mesh_boolean_operation_profiled(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
521
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
522
|
+
const len0 = WASM_VECTOR_LEN;
|
|
523
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
524
|
+
const len1 = WASM_VECTOR_LEN;
|
|
525
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
526
|
+
const len2 = WASM_VECTOR_LEN;
|
|
527
|
+
const ret = wasm.mesh_boolean_operation_profiled(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
528
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
529
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
530
|
+
return v4;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Perform boolean operation with explicit backend and return stage-level
|
|
535
|
+
* profiling data followed by the result mesh buffer.
|
|
536
|
+
* @param {number} vertex_count_a
|
|
537
|
+
* @param {Float64Array} buffer_a
|
|
538
|
+
* @param {number} vertex_count_b
|
|
539
|
+
* @param {Float64Array} buffer_b
|
|
540
|
+
* @param {string} operation
|
|
541
|
+
* @param {string} backend
|
|
542
|
+
* @returns {Float64Array}
|
|
543
|
+
*/
|
|
544
|
+
export function mesh_boolean_operation_profiled_with_backend(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation, backend) {
|
|
545
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
546
|
+
const len0 = WASM_VECTOR_LEN;
|
|
547
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
548
|
+
const len1 = WASM_VECTOR_LEN;
|
|
549
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
550
|
+
const len2 = WASM_VECTOR_LEN;
|
|
551
|
+
const ptr3 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
552
|
+
const len3 = WASM_VECTOR_LEN;
|
|
553
|
+
const ret = wasm.mesh_boolean_operation_profiled_with_backend(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
554
|
+
var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
555
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
556
|
+
return v5;
|
|
557
|
+
}
|
|
558
|
+
|
|
530
559
|
/**
|
|
531
560
|
* Perform boolean operation on two meshes with explicit backend selection.
|
|
532
561
|
*
|
|
533
562
|
* # Parameters
|
|
534
|
-
* * `backend` - "
|
|
563
|
+
* * `backend` - "nextgen".
|
|
535
564
|
* @param {number} vertex_count_a
|
|
536
565
|
* @param {Float64Array} buffer_a
|
|
537
566
|
* @param {number} vertex_count_b
|
|
@@ -1634,6 +1663,13 @@ function __wbg_get_imports() {
|
|
|
1634
1663
|
const ret = globalThis.__okgeometry_boolean_should_cancel();
|
|
1635
1664
|
return ret;
|
|
1636
1665
|
},
|
|
1666
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
1667
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1668
|
+
},
|
|
1669
|
+
__wbg_now_a3af9a2f4bbaa4d1: function() {
|
|
1670
|
+
const ret = Date.now();
|
|
1671
|
+
return ret;
|
|
1672
|
+
},
|
|
1637
1673
|
__wbindgen_init_externref_table: function() {
|
|
1638
1674
|
const table = wasm.__wbindgen_externrefs;
|
|
1639
1675
|
const offset = table.grow(4);
|
|
@@ -500,6 +500,53 @@ export function mesh_boolean_operation(vertex_count_a, buffer_a, vertex_count_b,
|
|
|
500
500
|
return v4;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Perform boolean operation and return stage-level profiling data followed by mesh buffer.
|
|
505
|
+
* @param {number} vertex_count_a
|
|
506
|
+
* @param {Float64Array} buffer_a
|
|
507
|
+
* @param {number} vertex_count_b
|
|
508
|
+
* @param {Float64Array} buffer_b
|
|
509
|
+
* @param {string} operation
|
|
510
|
+
* @returns {Float64Array}
|
|
511
|
+
*/
|
|
512
|
+
export function mesh_boolean_operation_profiled(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
513
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
514
|
+
const len0 = WASM_VECTOR_LEN;
|
|
515
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
516
|
+
const len1 = WASM_VECTOR_LEN;
|
|
517
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
518
|
+
const len2 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.mesh_boolean_operation_profiled(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
520
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
521
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
522
|
+
return v4;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Perform boolean operation with explicit backend and return stage-level profiling data.
|
|
527
|
+
* @param {number} vertex_count_a
|
|
528
|
+
* @param {Float64Array} buffer_a
|
|
529
|
+
* @param {number} vertex_count_b
|
|
530
|
+
* @param {Float64Array} buffer_b
|
|
531
|
+
* @param {string} operation
|
|
532
|
+
* @param {string} backend
|
|
533
|
+
* @returns {Float64Array}
|
|
534
|
+
*/
|
|
535
|
+
export function mesh_boolean_operation_profiled_with_backend(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation, backend) {
|
|
536
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
537
|
+
const len0 = WASM_VECTOR_LEN;
|
|
538
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
539
|
+
const len1 = WASM_VECTOR_LEN;
|
|
540
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
541
|
+
const len2 = WASM_VECTOR_LEN;
|
|
542
|
+
const ptr3 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
543
|
+
const len3 = WASM_VECTOR_LEN;
|
|
544
|
+
const ret = wasm.mesh_boolean_operation_profiled_with_backend(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
545
|
+
var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
546
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
547
|
+
return v5;
|
|
548
|
+
}
|
|
549
|
+
|
|
503
550
|
/**
|
|
504
551
|
* Perform boolean subtraction on two meshes (A - B)
|
|
505
552
|
* @param {number} vertex_count_a
|
|
Binary file
|
|
@@ -25,11 +25,11 @@ export const loft_nurbs_surface: (a: number, b: number) => [number, number];
|
|
|
25
25
|
export const loft_polylines: (a: number, b: number, c: number, d: number) => [number, number];
|
|
26
26
|
export const make_nurbs_curves_compatible: (a: number, b: number) => [number, number];
|
|
27
27
|
export const mesh_apply_matrix: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
28
|
-
export const mesh_boolean_compare_backends: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
29
28
|
export const mesh_boolean_intersection: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
30
29
|
export const mesh_boolean_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
30
|
+
export const mesh_boolean_operation_profiled: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
31
|
+
export const mesh_boolean_operation_profiled_with_backend: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
31
32
|
export const mesh_boolean_operation_with_backend: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
32
|
-
export const mesh_boolean_profile_backends: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
33
33
|
export const mesh_boolean_subtraction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
34
34
|
export const mesh_boolean_union: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
35
35
|
export const mesh_boundary_polylines: (a: number, b: number, c: number) => [number, number];
|