okgeometry-api 0.5.8 → 1.0.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/wasm/README.md CHANGED
@@ -100,3 +100,5 @@ Available viewers:
100
100
  ## License
101
101
 
102
102
  Copyright Mostafa El Ayoubi / Orkestra Online. All rights reserved.
103
+
104
+ Boolean-kernel structural ports inspired by Manifold are tracked in [`MANIFOLD_PORT_ATTRIBUTION.md`](./MANIFOLD_PORT_ATTRIBUTION.md).
@@ -164,36 +164,27 @@ export function mesh_apply_matrix(vertex_count: number, buffer: Float64Array, ma
164
164
  */
165
165
  export function mesh_boolean_intersection(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
166
166
 
167
- /**
168
- * Perform boolean operation on two meshes
169
- *
170
- * # Parameters
171
- * * `vertex_count_a` - Number of vertices in mesh A
172
- * * `buffer_a` - Buffer for mesh A [vertices..., indices...]
173
- * * `vertex_count_b` - Number of vertices in mesh B
174
- * * `buffer_b` - Buffer for mesh B [vertices..., indices...]
175
- * * `operation` - Operation type: "union", "intersection", or "subtraction"
176
- *
177
- * # Returns
178
- * Result mesh buffer [vertices..., indices...]
179
- */
167
+ export function mesh_boolean_last_debug_marker(): number;
168
+
180
169
  export function mesh_boolean_operation(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
181
170
 
182
171
  /**
183
- * Debug helper: perform boolean operation with explicit backend and return a
184
- * textual status, including kernel error reason on failure.
172
+ * Debug helper: perform boolean operation and return a textual status,
173
+ * including kernel error reason on failure.
185
174
  */
186
- export function mesh_boolean_operation_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, backend: string): string;
175
+ export function mesh_boolean_operation_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
187
176
 
188
177
  /**
189
178
  * Perform boolean operation and return stage-level profiling data followed by
190
179
  * the result mesh buffer.
191
180
  *
192
181
  * Output format:
193
- * [profile_len(=42), broadphase_ms, segments_ms, split_ms, classify_ms,
194
- * classify_seed_ms, classify_strict_ms, classify_open_component_ms,
182
+ * [profile_len(=95), broadphase_ms, segments_ms, split_ms,
183
+ * split_touched_faces_a, split_source_faces_a, split_touched_faces_b, split_source_faces_b,
184
+ * classify_ms, classify_seed_ms, classify_strict_ms, classify_open_component_ms,
195
185
  * extract_ms, extract_primary_ms, extract_fallback_ms,
196
- * cleanup_ms, finalize_ms, pair_accepted, pair_rejected, pair_degenerate,
186
+ * cleanup_ms, finalize_ms, finalize_cap_ms, finalize_recap_ms, finalize_stitch_ms,
187
+ * pair_accepted, pair_rejected, pair_degenerate,
197
188
  * core_passes, core_total_ms, conservative_runs, conservative_ms, nudge_runs, nudge_ms,
198
189
  * recompose_runs, recompose_ms, repair_runs, repair_ms,
199
190
  * repair_loops, repair_loops_capped, repair_loop_vertices, repair_loop_max_vertices,
@@ -204,24 +195,63 @@ export function mesh_boolean_operation_debug(vertex_count_a: number, buffer_a: F
204
195
  * arrangement_adj_non_manifold_edges_total, arrangement_adj_non_manifold_limit_total,
205
196
  * arrangement_adj_non_manifold_tolerated_attempts,
206
197
  * arrangement_adj_fallback_non_manifold_excess_total,
198
+ * subtraction_ultra_cases, subtraction_ultra_component_fallback_runs,
199
+ * subtraction_ultra_open_bounds_total, subtraction_ultra_open_bounds_max,
200
+ * subtraction_ultra_best_boundary_total, subtraction_ultra_best_non_manifold_total,
201
+ * subtraction_ultra_scoped_faces_total, subtraction_ultra_scoped_faces_max,
202
+ * subtraction_ultra_scoped_strict_evals_total, subtraction_ultra_scoped_strict_evals_max,
203
+ * finalize_stitch_rebuild_ms, finalize_stitch_recap_ms,
204
+ * finalize_stitch_attempts, finalize_stitch_kept,
205
+ * finalize_stitch_rebuild_collect_ms, finalize_stitch_rebuild_weld_ms,
206
+ * finalize_stitch_rebuild_commit_ms, finalize_stitch_rebuild_faces_in,
207
+ * finalize_stitch_rebuild_faces_out,
208
+ * whole_partial_attempts, whole_partial_accepts,
209
+ * whole_partial_total_ms, whole_partial_split_ms,
210
+ * whole_partial_boundary_build_ms,
211
+ * whole_partial_split_triangle_fast_faces,
212
+ * whole_partial_split_cdt_faces,
213
+ * whole_partial_split_cdt_points_total,
214
+ * whole_partial_split_cdt_constraints_total,
215
+ * whole_partial_split_cdt_segment_constraints_total,
216
+ * whole_partial_split_cdt_triangles_total,
217
+ * whole_partial_triangle_cdt_single_segment_faces,
218
+ * whole_partial_triangle_cdt_two_segment_faces,
219
+ * whole_partial_triangle_cdt_three_plus_segment_faces,
220
+ * whole_partial_triangle_cdt_all_boundary_segment_faces,
221
+ * whole_partial_triangle_cdt_mixed_boundary_segment_faces,
222
+ * whole_partial_triangle_cdt_any_interior_segment_faces,
223
+ * whole_partial_classify_source_ms, whole_partial_classify_touched_ms,
224
+ * whole_partial_extract_ms, whole_partial_extract_untouched_ms,
225
+ * whole_partial_extract_interface_ms, whole_partial_extract_touched_ms,
226
+ * whole_partial_finalize_ms,
227
+ * whole_partial_interface_faces_total,
228
+ * whole_partial_interface_faces_emitted,
229
+ * whole_partial_interface_boundary_edge_hits,
230
+ * whole_partial_interface_raw_edge_fallbacks,
231
+ * whole_partial_touched_faces_total,
232
+ * whole_partial_touched_faces_emitted,
233
+ * whole_partial_touched_patch_attempts,
234
+ * whole_partial_touched_patch_direct_regions,
235
+ * whole_partial_touched_patch_triangulated_faces,
236
+ * whole_partial_touched_fallback_faces,
237
+ * whole_partial_touched_lineage_vertices,
238
+ * whole_partial_touched_welded_vertices,
239
+ * whole_partial_raw_boundary_untouched_edges,
240
+ * whole_partial_raw_boundary_interface_edges,
241
+ * whole_partial_raw_boundary_touched_edges,
242
+ * whole_partial_raw_boundary_mixed_edges,
243
+ * whole_partial_raw_non_manifold_untouched_edges,
244
+ * whole_partial_raw_non_manifold_interface_edges,
245
+ * whole_partial_raw_non_manifold_touched_edges,
246
+ * whole_partial_raw_non_manifold_mixed_edges,
247
+ * whole_partial_boundary_edges_total,
248
+ * whole_partial_non_manifold_edges_total,
249
+ * whole_partial_face_ratio_vs_a_total,
250
+ * whole_partial_loop_plausible_total,
207
251
  * mesh_buffer...]
208
252
  */
209
253
  export function mesh_boolean_operation_profiled(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
210
254
 
211
- /**
212
- * Perform boolean operation with explicit backend and return stage-level
213
- * profiling data followed by the result mesh buffer.
214
- */
215
- 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;
216
-
217
- /**
218
- * Perform boolean operation on two meshes with explicit backend selection.
219
- *
220
- * # Parameters
221
- * * `backend` - "nextgen".
222
- */
223
- 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;
224
-
225
255
  /**
226
256
  * Perform boolean subtraction on two meshes (A - B)
227
257
  */
@@ -232,6 +262,12 @@ export function mesh_boolean_subtraction(vertex_count_a: number, buffer_a: Float
232
262
  */
233
263
  export function mesh_boolean_union(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
234
264
 
265
+ export function mesh_boolean_whole_partial_candidate(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
266
+
267
+ export function mesh_boolean_whole_partial_candidate_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
268
+
269
+ export function mesh_boolean_whole_partial_candidate_debug_full(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
270
+
235
271
  /**
236
272
  * Extract boundary (perimeter) edges from a mesh as polylines.
237
273
  * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
@@ -453,6 +489,12 @@ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: numb
453
489
  */
454
490
  export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
455
491
 
492
+ /**
493
+ * Return welded-edge topology metrics for a triangulated mesh buffer:
494
+ * `[boundary_edges, non_manifold_edges]`.
495
+ */
496
+ export function mesh_topology_metrics(vertex_count: number, buffer: Float64Array): Float64Array;
497
+
456
498
  /**
457
499
  * Translate a mesh by an offset vector and return new buffers
458
500
  */
@@ -616,12 +658,13 @@ export interface InitOutput {
616
658
  readonly mesh_apply_matrix: (a: number, b: number, c: number, d: number, e: number) => [number, number];
617
659
  readonly mesh_boolean_intersection: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
618
660
  readonly mesh_boolean_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
619
- readonly mesh_boolean_operation_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
661
+ readonly mesh_boolean_operation_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
620
662
  readonly mesh_boolean_operation_profiled: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
621
- 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];
622
- 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];
623
663
  readonly mesh_boolean_subtraction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
624
664
  readonly mesh_boolean_union: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
665
+ readonly mesh_boolean_whole_partial_candidate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
666
+ readonly mesh_boolean_whole_partial_candidate_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
667
+ readonly mesh_boolean_whole_partial_candidate_debug_full: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
625
668
  readonly mesh_boundary_polylines: (a: number, b: number, c: number) => [number, number];
626
669
  readonly mesh_build_coplanar_connected_face_groups: (a: number, b: number, c: number) => [number, number];
627
670
  readonly mesh_chamfer_all_edges: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -659,6 +702,7 @@ export interface InitOutput {
659
702
  readonly mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
660
703
  readonly mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
661
704
  readonly mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
705
+ readonly mesh_topology_metrics: (a: number, b: number, c: number) => [number, number];
662
706
  readonly mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
663
707
  readonly nurbs_curve_curve_intersect: (a: number, b: number, c: number, d: number) => [number, number];
664
708
  readonly nurbs_curve_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
@@ -678,6 +722,7 @@ export interface InitOutput {
678
722
  readonly tessellate_nurbs_surface: (a: number, b: number) => [number, number];
679
723
  readonly test_wasm: () => [number, number];
680
724
  readonly version: () => [number, number];
725
+ readonly mesh_boolean_last_debug_marker: () => number;
681
726
  readonly ray_distance_to_point: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
682
727
  readonly __wbindgen_externrefs: WebAssembly.Table;
683
728
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -471,17 +471,14 @@ export function mesh_boolean_intersection(vertex_count_a, buffer_a, vertex_count
471
471
  }
472
472
 
473
473
  /**
474
- * Perform boolean operation on two meshes
475
- *
476
- * # Parameters
477
- * * `vertex_count_a` - Number of vertices in mesh A
478
- * * `buffer_a` - Buffer for mesh A [vertices..., indices...]
479
- * * `vertex_count_b` - Number of vertices in mesh B
480
- * * `buffer_b` - Buffer for mesh B [vertices..., indices...]
481
- * * `operation` - Operation type: "union", "intersection", or "subtraction"
482
- *
483
- * # Returns
484
- * Result mesh buffer [vertices..., indices...]
474
+ * @returns {number}
475
+ */
476
+ export function mesh_boolean_last_debug_marker() {
477
+ const ret = wasm.mesh_boolean_last_debug_marker();
478
+ return ret >>> 0;
479
+ }
480
+
481
+ /**
485
482
  * @param {number} vertex_count_a
486
483
  * @param {Float64Array} buffer_a
487
484
  * @param {number} vertex_count_b
@@ -503,19 +500,18 @@ export function mesh_boolean_operation(vertex_count_a, buffer_a, vertex_count_b,
503
500
  }
504
501
 
505
502
  /**
506
- * Debug helper: perform boolean operation with explicit backend and return a
507
- * textual status, including kernel error reason on failure.
503
+ * Debug helper: perform boolean operation and return a textual status,
504
+ * including kernel error reason on failure.
508
505
  * @param {number} vertex_count_a
509
506
  * @param {Float64Array} buffer_a
510
507
  * @param {number} vertex_count_b
511
508
  * @param {Float64Array} buffer_b
512
509
  * @param {string} operation
513
- * @param {string} backend
514
510
  * @returns {string}
515
511
  */
516
- export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation, backend) {
517
- let deferred5_0;
518
- let deferred5_1;
512
+ export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
513
+ let deferred4_0;
514
+ let deferred4_1;
519
515
  try {
520
516
  const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
521
517
  const len0 = WASM_VECTOR_LEN;
@@ -523,14 +519,12 @@ export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_co
523
519
  const len1 = WASM_VECTOR_LEN;
524
520
  const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
525
521
  const len2 = WASM_VECTOR_LEN;
526
- const ptr3 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
527
- const len3 = WASM_VECTOR_LEN;
528
- const ret = wasm.mesh_boolean_operation_debug(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2, ptr3, len3);
529
- deferred5_0 = ret[0];
530
- deferred5_1 = ret[1];
522
+ const ret = wasm.mesh_boolean_operation_debug(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
523
+ deferred4_0 = ret[0];
524
+ deferred4_1 = ret[1];
531
525
  return getStringFromWasm0(ret[0], ret[1]);
532
526
  } finally {
533
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
527
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
534
528
  }
535
529
  }
536
530
 
@@ -539,10 +533,12 @@ export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_co
539
533
  * the result mesh buffer.
540
534
  *
541
535
  * Output format:
542
- * [profile_len(=42), broadphase_ms, segments_ms, split_ms, classify_ms,
543
- * classify_seed_ms, classify_strict_ms, classify_open_component_ms,
536
+ * [profile_len(=95), broadphase_ms, segments_ms, split_ms,
537
+ * split_touched_faces_a, split_source_faces_a, split_touched_faces_b, split_source_faces_b,
538
+ * classify_ms, classify_seed_ms, classify_strict_ms, classify_open_component_ms,
544
539
  * extract_ms, extract_primary_ms, extract_fallback_ms,
545
- * cleanup_ms, finalize_ms, pair_accepted, pair_rejected, pair_degenerate,
540
+ * cleanup_ms, finalize_ms, finalize_cap_ms, finalize_recap_ms, finalize_stitch_ms,
541
+ * pair_accepted, pair_rejected, pair_degenerate,
546
542
  * core_passes, core_total_ms, conservative_runs, conservative_ms, nudge_runs, nudge_ms,
547
543
  * recompose_runs, recompose_ms, repair_runs, repair_ms,
548
544
  * repair_loops, repair_loops_capped, repair_loop_vertices, repair_loop_max_vertices,
@@ -553,6 +549,59 @@ export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_co
553
549
  * arrangement_adj_non_manifold_edges_total, arrangement_adj_non_manifold_limit_total,
554
550
  * arrangement_adj_non_manifold_tolerated_attempts,
555
551
  * arrangement_adj_fallback_non_manifold_excess_total,
552
+ * subtraction_ultra_cases, subtraction_ultra_component_fallback_runs,
553
+ * subtraction_ultra_open_bounds_total, subtraction_ultra_open_bounds_max,
554
+ * subtraction_ultra_best_boundary_total, subtraction_ultra_best_non_manifold_total,
555
+ * subtraction_ultra_scoped_faces_total, subtraction_ultra_scoped_faces_max,
556
+ * subtraction_ultra_scoped_strict_evals_total, subtraction_ultra_scoped_strict_evals_max,
557
+ * finalize_stitch_rebuild_ms, finalize_stitch_recap_ms,
558
+ * finalize_stitch_attempts, finalize_stitch_kept,
559
+ * finalize_stitch_rebuild_collect_ms, finalize_stitch_rebuild_weld_ms,
560
+ * finalize_stitch_rebuild_commit_ms, finalize_stitch_rebuild_faces_in,
561
+ * finalize_stitch_rebuild_faces_out,
562
+ * whole_partial_attempts, whole_partial_accepts,
563
+ * whole_partial_total_ms, whole_partial_split_ms,
564
+ * whole_partial_boundary_build_ms,
565
+ * whole_partial_split_triangle_fast_faces,
566
+ * whole_partial_split_cdt_faces,
567
+ * whole_partial_split_cdt_points_total,
568
+ * whole_partial_split_cdt_constraints_total,
569
+ * whole_partial_split_cdt_segment_constraints_total,
570
+ * whole_partial_split_cdt_triangles_total,
571
+ * whole_partial_triangle_cdt_single_segment_faces,
572
+ * whole_partial_triangle_cdt_two_segment_faces,
573
+ * whole_partial_triangle_cdt_three_plus_segment_faces,
574
+ * whole_partial_triangle_cdt_all_boundary_segment_faces,
575
+ * whole_partial_triangle_cdt_mixed_boundary_segment_faces,
576
+ * whole_partial_triangle_cdt_any_interior_segment_faces,
577
+ * whole_partial_classify_source_ms, whole_partial_classify_touched_ms,
578
+ * whole_partial_extract_ms, whole_partial_extract_untouched_ms,
579
+ * whole_partial_extract_interface_ms, whole_partial_extract_touched_ms,
580
+ * whole_partial_finalize_ms,
581
+ * whole_partial_interface_faces_total,
582
+ * whole_partial_interface_faces_emitted,
583
+ * whole_partial_interface_boundary_edge_hits,
584
+ * whole_partial_interface_raw_edge_fallbacks,
585
+ * whole_partial_touched_faces_total,
586
+ * whole_partial_touched_faces_emitted,
587
+ * whole_partial_touched_patch_attempts,
588
+ * whole_partial_touched_patch_direct_regions,
589
+ * whole_partial_touched_patch_triangulated_faces,
590
+ * whole_partial_touched_fallback_faces,
591
+ * whole_partial_touched_lineage_vertices,
592
+ * whole_partial_touched_welded_vertices,
593
+ * whole_partial_raw_boundary_untouched_edges,
594
+ * whole_partial_raw_boundary_interface_edges,
595
+ * whole_partial_raw_boundary_touched_edges,
596
+ * whole_partial_raw_boundary_mixed_edges,
597
+ * whole_partial_raw_non_manifold_untouched_edges,
598
+ * whole_partial_raw_non_manifold_interface_edges,
599
+ * whole_partial_raw_non_manifold_touched_edges,
600
+ * whole_partial_raw_non_manifold_mixed_edges,
601
+ * whole_partial_boundary_edges_total,
602
+ * whole_partial_non_manifold_edges_total,
603
+ * whole_partial_face_ratio_vs_a_total,
604
+ * whole_partial_loop_plausible_total,
556
605
  * mesh_buffer...]
557
606
  * @param {number} vertex_count_a
558
607
  * @param {Float64Array} buffer_a
@@ -575,95 +624,104 @@ export function mesh_boolean_operation_profiled(vertex_count_a, buffer_a, vertex
575
624
  }
576
625
 
577
626
  /**
578
- * Perform boolean operation with explicit backend and return stage-level
579
- * profiling data followed by the result mesh buffer.
627
+ * Perform boolean subtraction on two meshes (A - B)
580
628
  * @param {number} vertex_count_a
581
629
  * @param {Float64Array} buffer_a
582
630
  * @param {number} vertex_count_b
583
631
  * @param {Float64Array} buffer_b
584
- * @param {string} operation
585
- * @param {string} backend
586
632
  * @returns {Float64Array}
587
633
  */
588
- export function mesh_boolean_operation_profiled_with_backend(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation, backend) {
634
+ export function mesh_boolean_subtraction(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
589
635
  const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
590
636
  const len0 = WASM_VECTOR_LEN;
591
637
  const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
592
638
  const len1 = WASM_VECTOR_LEN;
593
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
594
- const len2 = WASM_VECTOR_LEN;
595
- const ptr3 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
596
- const len3 = WASM_VECTOR_LEN;
597
- const ret = wasm.mesh_boolean_operation_profiled_with_backend(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2, ptr3, len3);
598
- var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
639
+ const ret = wasm.mesh_boolean_subtraction(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
640
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
599
641
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
600
- return v5;
642
+ return v3;
643
+ }
644
+
645
+ /**
646
+ * Perform boolean union on two meshes
647
+ * @param {number} vertex_count_a
648
+ * @param {Float64Array} buffer_a
649
+ * @param {number} vertex_count_b
650
+ * @param {Float64Array} buffer_b
651
+ * @returns {Float64Array}
652
+ */
653
+ export function mesh_boolean_union(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
654
+ const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
655
+ const len0 = WASM_VECTOR_LEN;
656
+ const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
657
+ const len1 = WASM_VECTOR_LEN;
658
+ const ret = wasm.mesh_boolean_union(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
659
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
660
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
661
+ return v3;
601
662
  }
602
663
 
603
664
  /**
604
- * Perform boolean operation on two meshes with explicit backend selection.
605
- *
606
- * # Parameters
607
- * * `backend` - "nextgen".
608
665
  * @param {number} vertex_count_a
609
666
  * @param {Float64Array} buffer_a
610
667
  * @param {number} vertex_count_b
611
668
  * @param {Float64Array} buffer_b
612
669
  * @param {string} operation
613
- * @param {string} backend
614
670
  * @returns {Float64Array}
615
671
  */
616
- export function mesh_boolean_operation_with_backend(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation, backend) {
672
+ export function mesh_boolean_whole_partial_candidate(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
617
673
  const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
618
674
  const len0 = WASM_VECTOR_LEN;
619
675
  const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
620
676
  const len1 = WASM_VECTOR_LEN;
621
677
  const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
622
678
  const len2 = WASM_VECTOR_LEN;
623
- const ptr3 = passStringToWasm0(backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
624
- const len3 = WASM_VECTOR_LEN;
625
- const ret = wasm.mesh_boolean_operation_with_backend(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2, ptr3, len3);
626
- var v5 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
679
+ const ret = wasm.mesh_boolean_whole_partial_candidate(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
680
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
627
681
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
628
- return v5;
682
+ return v4;
629
683
  }
630
684
 
631
685
  /**
632
- * Perform boolean subtraction on two meshes (A - B)
633
686
  * @param {number} vertex_count_a
634
687
  * @param {Float64Array} buffer_a
635
688
  * @param {number} vertex_count_b
636
689
  * @param {Float64Array} buffer_b
690
+ * @param {string} operation
637
691
  * @returns {Float64Array}
638
692
  */
639
- export function mesh_boolean_subtraction(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
693
+ export function mesh_boolean_whole_partial_candidate_debug(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
640
694
  const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
641
695
  const len0 = WASM_VECTOR_LEN;
642
696
  const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
643
697
  const len1 = WASM_VECTOR_LEN;
644
- const ret = wasm.mesh_boolean_subtraction(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
645
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
698
+ const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
699
+ const len2 = WASM_VECTOR_LEN;
700
+ const ret = wasm.mesh_boolean_whole_partial_candidate_debug(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
701
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
646
702
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
647
- return v3;
703
+ return v4;
648
704
  }
649
705
 
650
706
  /**
651
- * Perform boolean union on two meshes
652
707
  * @param {number} vertex_count_a
653
708
  * @param {Float64Array} buffer_a
654
709
  * @param {number} vertex_count_b
655
710
  * @param {Float64Array} buffer_b
711
+ * @param {string} operation
656
712
  * @returns {Float64Array}
657
713
  */
658
- export function mesh_boolean_union(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
714
+ export function mesh_boolean_whole_partial_candidate_debug_full(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
659
715
  const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
660
716
  const len0 = WASM_VECTOR_LEN;
661
717
  const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
662
718
  const len1 = WASM_VECTOR_LEN;
663
- const ret = wasm.mesh_boolean_union(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
664
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
719
+ const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
720
+ const len2 = WASM_VECTOR_LEN;
721
+ const ret = wasm.mesh_boolean_whole_partial_candidate_debug_full(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
722
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
665
723
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
666
- return v3;
724
+ return v4;
667
725
  }
668
726
 
669
727
  /**
@@ -1327,6 +1385,22 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
1327
1385
  return v2;
1328
1386
  }
1329
1387
 
1388
+ /**
1389
+ * Return welded-edge topology metrics for a triangulated mesh buffer:
1390
+ * `[boundary_edges, non_manifold_edges]`.
1391
+ * @param {number} vertex_count
1392
+ * @param {Float64Array} buffer
1393
+ * @returns {Float64Array}
1394
+ */
1395
+ export function mesh_topology_metrics(vertex_count, buffer) {
1396
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1397
+ const len0 = WASM_VECTOR_LEN;
1398
+ const ret = wasm.mesh_topology_metrics(vertex_count, ptr0, len0);
1399
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1400
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1401
+ return v2;
1402
+ }
1403
+
1330
1404
  /**
1331
1405
  * Translate a mesh by an offset vector and return new buffers
1332
1406
  * @param {number} vertex_count
@@ -1703,17 +1777,28 @@ export function version() {
1703
1777
  function __wbg_get_imports() {
1704
1778
  const import0 = {
1705
1779
  __proto__: null,
1706
- __wbg___okgeometry_boolean_should_cancel_3e76652b5286d323: function() {
1780
+ __wbg___okgeometry_boolean_should_cancel_3e7948069660dc47: function() {
1707
1781
  const ret = globalThis.__okgeometry_boolean_should_cancel();
1708
1782
  return ret;
1709
1783
  },
1710
1784
  __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
1711
1785
  throw new Error(getStringFromWasm0(arg0, arg1));
1712
1786
  },
1787
+ __wbg_error_9a7fe3f932034cde: function(arg0) {
1788
+ console.error(arg0);
1789
+ },
1790
+ __wbg_log_6b5ca2e6124b2808: function(arg0) {
1791
+ console.log(arg0);
1792
+ },
1713
1793
  __wbg_now_a3af9a2f4bbaa4d1: function() {
1714
1794
  const ret = Date.now();
1715
1795
  return ret;
1716
1796
  },
1797
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1798
+ // Cast intrinsic for `Ref(String) -> Externref`.
1799
+ const ret = getStringFromWasm0(arg0, arg1);
1800
+ return ret;
1801
+ },
1717
1802
  __wbindgen_init_externref_table: function() {
1718
1803
  const table = wasm.__wbindgen_externrefs;
1719
1804
  const offset = table.grow(4);
Binary file
@@ -27,12 +27,13 @@ export const make_nurbs_curves_compatible: (a: number, b: number) => [number, nu
27
27
  export const mesh_apply_matrix: (a: number, b: number, c: number, d: number, e: number) => [number, number];
28
28
  export const mesh_boolean_intersection: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
29
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_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
30
+ export const mesh_boolean_operation_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
31
31
  export const mesh_boolean_operation_profiled: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
32
- 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];
33
- 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];
34
32
  export const mesh_boolean_subtraction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
35
33
  export const mesh_boolean_union: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
34
+ export const mesh_boolean_whole_partial_candidate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
35
+ export const mesh_boolean_whole_partial_candidate_debug: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
36
+ export const mesh_boolean_whole_partial_candidate_debug_full: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
36
37
  export const mesh_boundary_polylines: (a: number, b: number, c: number) => [number, number];
37
38
  export const mesh_build_coplanar_connected_face_groups: (a: number, b: number, c: number) => [number, number];
38
39
  export const mesh_chamfer_all_edges: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -70,6 +71,7 @@ export const mesh_raycast_all: (a: number, b: number, c: number, d: number, e: n
70
71
  export const mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
71
72
  export const mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
72
73
  export const mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
74
+ export const mesh_topology_metrics: (a: number, b: number, c: number) => [number, number];
73
75
  export const mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
74
76
  export const nurbs_curve_curve_intersect: (a: number, b: number, c: number, d: number) => [number, number];
75
77
  export const nurbs_curve_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
@@ -89,6 +91,7 @@ export const sweep_polylines: (a: number, b: number, c: number, d: number, e: nu
89
91
  export const tessellate_nurbs_surface: (a: number, b: number) => [number, number];
90
92
  export const test_wasm: () => [number, number];
91
93
  export const version: () => [number, number];
94
+ export const mesh_boolean_last_debug_marker: () => number;
92
95
  export const ray_distance_to_point: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
93
96
  export const __wbindgen_externrefs: WebAssembly.Table;
94
97
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
package/wasm/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Mostafa El Ayoubi <m.elayoubi@orkestra.online>"
6
6
  ],
7
7
  "description": "Production-grade geometry engine in Rust compiled to WASM for OkNodes",
8
- "version": "0.1.0",
8
+ "version": "1.0.0",
9
9
  "files": [
10
10
  "okgeometrycore_bg.wasm",
11
11
  "okgeometrycore.js",