okgeometry-api 1.26.1 → 1.27.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.
Files changed (99) hide show
  1. package/dist/Arc.js +1 -1
  2. package/dist/Arc.js.map +1 -1
  3. package/dist/Brep.js +1 -1
  4. package/dist/Brep.js.map +1 -1
  5. package/dist/Circle.js +1 -1
  6. package/dist/Circle.js.map +1 -1
  7. package/dist/Line.js +1 -1
  8. package/dist/Line.js.map +1 -1
  9. package/dist/Mesh.d.ts +41 -0
  10. package/dist/Mesh.d.ts.map +1 -1
  11. package/dist/Mesh.js +235 -21
  12. package/dist/Mesh.js.map +1 -1
  13. package/dist/MeshSurface.js +1 -1
  14. package/dist/MeshSurface.js.map +1 -1
  15. package/dist/NurbsCurve.js +1 -1
  16. package/dist/NurbsCurve.js.map +1 -1
  17. package/dist/NurbsSurface.js +1 -1
  18. package/dist/NurbsSurface.js.map +1 -1
  19. package/dist/PolyCurve.js +1 -1
  20. package/dist/PolyCurve.js.map +1 -1
  21. package/dist/Polyline.js +1 -1
  22. package/dist/Polyline.js.map +1 -1
  23. package/dist/Ray.js +1 -1
  24. package/dist/Ray.js.map +1 -1
  25. package/dist/SculptSession.js +1 -1
  26. package/dist/SculptSession.js.map +1 -1
  27. package/dist/engine-threaded.d.ts +2 -0
  28. package/dist/engine-threaded.d.ts.map +1 -0
  29. package/dist/engine-threaded.js +33 -0
  30. package/dist/engine-threaded.js.map +1 -0
  31. package/dist/engine.d.ts +21 -0
  32. package/dist/engine.d.ts.map +1 -1
  33. package/dist/engine.js +42 -0
  34. package/dist/engine.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/mesh-boolean.pool.d.ts +23 -1
  40. package/dist/mesh-boolean.pool.d.ts.map +1 -1
  41. package/dist/mesh-boolean.pool.js +97 -12
  42. package/dist/mesh-boolean.pool.js.map +1 -1
  43. package/dist/mesh-boolean.protocol.d.ts +21 -1
  44. package/dist/mesh-boolean.protocol.d.ts.map +1 -1
  45. package/dist/mesh-boolean.protocol.js.map +1 -1
  46. package/dist/mesh-boolean.worker.d.ts.map +1 -1
  47. package/dist/mesh-boolean.worker.js +94 -1
  48. package/dist/mesh-boolean.worker.js.map +1 -1
  49. package/dist/wasm-active.d.ts +20 -0
  50. package/dist/wasm-active.d.ts.map +1 -0
  51. package/dist/wasm-active.js +26 -0
  52. package/dist/wasm-active.js.map +1 -0
  53. package/dist/wasm-base64-threaded.d.ts +2 -0
  54. package/dist/wasm-base64-threaded.d.ts.map +1 -0
  55. package/dist/wasm-base64-threaded.js +3 -0
  56. package/dist/wasm-base64-threaded.js.map +1 -0
  57. package/dist/wasm-base64.d.ts +1 -1
  58. package/dist/wasm-base64.d.ts.map +1 -1
  59. package/dist/wasm-base64.js +1 -1
  60. package/dist/wasm-base64.js.map +1 -1
  61. package/dist/wasm-bindings-threaded.d.ts +2664 -0
  62. package/dist/wasm-bindings-threaded.d.ts.map +1 -0
  63. package/dist/wasm-bindings-threaded.js +5008 -0
  64. package/dist/wasm-bindings-threaded.js.map +1 -0
  65. package/dist/wasm-bindings.d.ts +130 -0
  66. package/dist/wasm-bindings.d.ts.map +1 -1
  67. package/dist/wasm-bindings.js +208 -0
  68. package/dist/wasm-bindings.js.map +1 -1
  69. package/dist/workerHelpers-threaded.d.ts +2 -0
  70. package/dist/workerHelpers-threaded.d.ts.map +1 -0
  71. package/dist/workerHelpers-threaded.js +100 -0
  72. package/dist/workerHelpers-threaded.js.map +1 -0
  73. package/package.json +8 -3
  74. package/src/Arc.ts +117 -117
  75. package/src/Brep.ts +1 -1
  76. package/src/Circle.ts +166 -166
  77. package/src/Line.ts +171 -171
  78. package/src/Mesh.ts +300 -45
  79. package/src/MeshSurface.ts +1 -1
  80. package/src/NurbsCurve.ts +655 -655
  81. package/src/NurbsSurface.ts +721 -721
  82. package/src/PolyCurve.ts +203 -203
  83. package/src/Polyline.ts +316 -316
  84. package/src/Ray.ts +90 -90
  85. package/src/SculptSession.ts +377 -377
  86. package/src/engine-threaded.ts +39 -0
  87. package/src/engine.ts +46 -0
  88. package/src/index.ts +1 -1
  89. package/src/mesh-boolean.pool.ts +208 -86
  90. package/src/mesh-boolean.protocol.ts +44 -1
  91. package/src/mesh-boolean.worker.ts +170 -56
  92. package/src/wasm-active.ts +31 -0
  93. package/src/wasm-base64-threaded.ts +2 -0
  94. package/src/wasm-base64.ts +1 -1
  95. package/src/wasm-bindings-threaded.d.ts +1989 -0
  96. package/src/wasm-bindings-threaded.js +5235 -0
  97. package/src/wasm-bindings.d.ts +104 -0
  98. package/src/wasm-bindings.js +225 -0
  99. package/src/workerHelpers-threaded.js +107 -0
@@ -2026,6 +2026,17 @@ export function mesh_boundary_edge_segments(vertex_count, buffer) {
2026
2026
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2027
2027
  return v2;
2028
2028
  }
2029
+ /**
2030
+ * Handle variant of `mesh_boundary_edge_segments`.
2031
+ * @param {number} id
2032
+ * @returns {Float64Array}
2033
+ */
2034
+ export function mesh_boundary_edge_segments_h(id) {
2035
+ const ret = wasm.mesh_boundary_edge_segments_h(id);
2036
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2037
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2038
+ return v1;
2039
+ }
2029
2040
  /**
2030
2041
  * Extract boundary (perimeter) edges from a mesh as polylines.
2031
2042
  * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
@@ -2080,6 +2091,18 @@ export function mesh_build_render_buffers(vertex_count, buffer, crease_angle_deg
2080
2091
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2081
2092
  return v2;
2082
2093
  }
2094
+ /**
2095
+ * Handle variant of `mesh_build_render_buffers`.
2096
+ * @param {number} id
2097
+ * @param {number} crease_angle_deg
2098
+ * @returns {Float32Array}
2099
+ */
2100
+ export function mesh_build_render_buffers_h(id, crease_angle_deg) {
2101
+ const ret = wasm.mesh_build_render_buffers_h(id, crease_angle_deg);
2102
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2103
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2104
+ return v1;
2105
+ }
2083
2106
  /**
2084
2107
  * Chamfer all edges of a primitive mesh (flat bevel)
2085
2108
  *
@@ -2410,6 +2433,17 @@ export function mesh_feature_edge_chains(vertex_count, buffer) {
2410
2433
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2411
2434
  return v2;
2412
2435
  }
2436
+ /**
2437
+ * Handle variant of `mesh_feature_edge_chains`.
2438
+ * @param {number} id
2439
+ * @returns {Float64Array}
2440
+ */
2441
+ export function mesh_feature_edge_chains_h(id) {
2442
+ const ret = wasm.mesh_feature_edge_chains_h(id);
2443
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2444
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2445
+ return v1;
2446
+ }
2413
2447
  /**
2414
2448
  * Find the best matching coplanar connected face group by normal and optional near-point.
2415
2449
  * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
@@ -2432,6 +2466,24 @@ export function mesh_find_face_group_by_normal(vertex_count, buffer, nx, ny, nz,
2432
2466
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2433
2467
  return v2;
2434
2468
  }
2469
+ /**
2470
+ * Handle variant of `mesh_find_face_group_by_normal`.
2471
+ * @param {number} id
2472
+ * @param {number} nx
2473
+ * @param {number} ny
2474
+ * @param {number} nz
2475
+ * @param {number} near_x
2476
+ * @param {number} near_y
2477
+ * @param {number} near_z
2478
+ * @param {boolean} use_near_point
2479
+ * @returns {Float64Array}
2480
+ */
2481
+ export function mesh_find_face_group_by_normal_h(id, nx, ny, nz, near_x, near_y, near_z, use_near_point) {
2482
+ const ret = wasm.mesh_find_face_group_by_normal_h(id, nx, ny, nz, near_x, near_y, near_z, use_near_point);
2483
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2484
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2485
+ return v1;
2486
+ }
2435
2487
  /**
2436
2488
  * Find the coplanar connected face group containing triangle_index.
2437
2489
  * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
@@ -2448,6 +2500,18 @@ export function mesh_find_face_group_by_triangle_index(vertex_count, buffer, tri
2448
2500
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2449
2501
  return v2;
2450
2502
  }
2503
+ /**
2504
+ * Handle variant of `mesh_find_face_group_by_triangle_index`.
2505
+ * @param {number} id
2506
+ * @param {number} triangle_index
2507
+ * @returns {Float64Array}
2508
+ */
2509
+ export function mesh_find_face_group_by_triangle_index_h(id, triangle_index) {
2510
+ const ret = wasm.mesh_find_face_group_by_triangle_index_h(id, triangle_index);
2511
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2512
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2513
+ return v1;
2514
+ }
2451
2515
  /**
2452
2516
  * Axis-aligned bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
2453
2517
  * @param {number} vertex_count
@@ -2478,6 +2542,18 @@ export function mesh_get_coplanar_face_group_centroid(vertex_count, buffer, face
2478
2542
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2479
2543
  return v2;
2480
2544
  }
2545
+ /**
2546
+ * Handle variant of `mesh_get_coplanar_face_group_centroid`.
2547
+ * @param {number} id
2548
+ * @param {number} face_index
2549
+ * @returns {Float64Array}
2550
+ */
2551
+ export function mesh_get_coplanar_face_group_centroid_h(id, face_index) {
2552
+ const ret = wasm.mesh_get_coplanar_face_group_centroid_h(id, face_index);
2553
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2554
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2555
+ return v1;
2556
+ }
2481
2557
  /**
2482
2558
  * Edge-connected coplanar triangle indices as [count, i0, i1, ...].
2483
2559
  * @param {number} vertex_count
@@ -2493,6 +2569,18 @@ export function mesh_get_coplanar_face_indices(vertex_count, buffer, face_index)
2493
2569
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2494
2570
  return v2;
2495
2571
  }
2572
+ /**
2573
+ * Handle variant of `mesh_get_coplanar_face_indices`.
2574
+ * @param {number} id
2575
+ * @param {number} face_index
2576
+ * @returns {Float64Array}
2577
+ */
2578
+ export function mesh_get_coplanar_face_indices_h(id, face_index) {
2579
+ const ret = wasm.mesh_get_coplanar_face_indices_h(id, face_index);
2580
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2581
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2582
+ return v1;
2583
+ }
2496
2584
  /**
2497
2585
  * Coplanar connected face region projected to a plane basis.
2498
2586
  * Output format:
@@ -2535,6 +2623,17 @@ export function mesh_get_edge_vertex_pairs(vertex_count, buffer) {
2535
2623
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2536
2624
  return v2;
2537
2625
  }
2626
+ /**
2627
+ * Handle variant of `mesh_get_edge_vertex_pairs`.
2628
+ * @param {number} id
2629
+ * @returns {Float64Array}
2630
+ */
2631
+ export function mesh_get_edge_vertex_pairs_h(id) {
2632
+ const ret = wasm.mesh_get_edge_vertex_pairs_h(id);
2633
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2634
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2635
+ return v1;
2636
+ }
2538
2637
  /**
2539
2638
  * Face area.
2540
2639
  * @param {number} vertex_count
@@ -2571,6 +2670,18 @@ export function mesh_get_face_boundary_loops(vertex_count, buffer, face_index) {
2571
2670
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2572
2671
  return v2;
2573
2672
  }
2673
+ /**
2674
+ * Handle variant of `mesh_get_face_boundary_loops`.
2675
+ * @param {number} id
2676
+ * @param {number} face_index
2677
+ * @returns {Float64Array}
2678
+ */
2679
+ export function mesh_get_face_boundary_loops_h(id, face_index) {
2680
+ const ret = wasm.mesh_get_face_boundary_loops_h(id, face_index);
2681
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2682
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2683
+ return v1;
2684
+ }
2574
2685
  /**
2575
2686
  * Face centroid as [x, y, z].
2576
2687
  * @param {number} vertex_count
@@ -2621,6 +2732,19 @@ export function mesh_get_smooth_face_group(vertex_count, buffer, face_index, max
2621
2732
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2622
2733
  return v2;
2623
2734
  }
2735
+ /**
2736
+ * Handle variant of `mesh_get_smooth_face_group`.
2737
+ * @param {number} id
2738
+ * @param {number} face_index
2739
+ * @param {number} max_angle_deg
2740
+ * @returns {Float64Array}
2741
+ */
2742
+ export function mesh_get_smooth_face_group_h(id, face_index, max_angle_deg) {
2743
+ const ret = wasm.mesh_get_smooth_face_group_h(id, face_index, max_angle_deg);
2744
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2745
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2746
+ return v1;
2747
+ }
2624
2748
  /**
2625
2749
  * Get mesh statistics
2626
2750
  * Returns [vertex_count, face_count, edge_count]
@@ -2973,6 +3097,42 @@ export function mesh_raycast_all(vertex_count, buffer, ox, oy, oz, dx, dy, dz, m
2973
3097
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2974
3098
  return v2;
2975
3099
  }
3100
+ /**
3101
+ * Handle variant of `mesh_raycast_all` — reuses the stored mesh's cached BVH.
3102
+ * @param {number} id
3103
+ * @param {number} ox
3104
+ * @param {number} oy
3105
+ * @param {number} oz
3106
+ * @param {number} dx
3107
+ * @param {number} dy
3108
+ * @param {number} dz
3109
+ * @param {number} max_distance
3110
+ * @returns {Float64Array}
3111
+ */
3112
+ export function mesh_raycast_all_h(id, ox, oy, oz, dx, dy, dz, max_distance) {
3113
+ const ret = wasm.mesh_raycast_all_h(id, ox, oy, oz, dx, dy, dz, max_distance);
3114
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3115
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3116
+ return v1;
3117
+ }
3118
+ /**
3119
+ * Handle variant of `mesh_raycast` — reuses the stored mesh's cached BVH.
3120
+ * @param {number} id
3121
+ * @param {number} ox
3122
+ * @param {number} oy
3123
+ * @param {number} oz
3124
+ * @param {number} dx
3125
+ * @param {number} dy
3126
+ * @param {number} dz
3127
+ * @param {number} max_distance
3128
+ * @returns {Float64Array}
3129
+ */
3130
+ export function mesh_raycast_h(id, ox, oy, oz, dx, dy, dz, max_distance) {
3131
+ const ret = wasm.mesh_raycast_h(id, ox, oy, oz, dx, dy, dz, max_distance);
3132
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3133
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3134
+ return v1;
3135
+ }
2976
3136
  /**
2977
3137
  * Raycast against many meshes packed as:
2978
3138
  * [meshCount, meshLen0, meshRaw0..., meshLen1, meshRaw1..., ...]
@@ -3035,6 +3195,17 @@ export function mesh_repair_diagnostics(vertex_count, buffer) {
3035
3195
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3036
3196
  return v2;
3037
3197
  }
3198
+ /**
3199
+ * Handle variant of `mesh_repair_diagnostics`.
3200
+ * @param {number} id
3201
+ * @returns {Float64Array}
3202
+ */
3203
+ export function mesh_repair_diagnostics_h(id) {
3204
+ const ret = wasm.mesh_repair_diagnostics_h(id);
3205
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3206
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3207
+ return v1;
3208
+ }
3038
3209
  /**
3039
3210
  * Rotate a mesh around an arbitrary axis and return new buffers
3040
3211
  * Axis is defined by (ax, ay, az), angle in radians
@@ -3201,6 +3372,43 @@ export function mesh_split_polyline(vertex_count, buffer, points, closed) {
3201
3372
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3202
3373
  return v3;
3203
3374
  }
3375
+ /**
3376
+ * Store a mesh buffer `[vertexCount, x,y,z..., i0,i1,i2...]` WASM-side.
3377
+ * Returns a non-zero id, or 0 on invalid input.
3378
+ * @param {number} vertex_count
3379
+ * @param {Float64Array} buffer
3380
+ * @returns {number}
3381
+ */
3382
+ export function mesh_store(vertex_count, buffer) {
3383
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
3384
+ const len0 = WASM_VECTOR_LEN;
3385
+ const ret = wasm.mesh_store(vertex_count, ptr0, len0);
3386
+ return ret >>> 0;
3387
+ }
3388
+ /**
3389
+ * Approximate bytes held by stored mesh raw buffers (diagnostics/tests).
3390
+ * Excludes lazy raycast caches.
3391
+ * @returns {number}
3392
+ */
3393
+ export function mesh_store_bytes() {
3394
+ const ret = wasm.mesh_store_bytes();
3395
+ return ret;
3396
+ }
3397
+ /**
3398
+ * Number of stored meshes (diagnostics/tests).
3399
+ * @returns {number}
3400
+ */
3401
+ export function mesh_store_count() {
3402
+ const ret = wasm.mesh_store_count();
3403
+ return ret >>> 0;
3404
+ }
3405
+ /**
3406
+ * Release a stored mesh and free its memory (idempotent).
3407
+ * @param {number} id
3408
+ */
3409
+ export function mesh_store_free(id) {
3410
+ wasm.mesh_store_free(id);
3411
+ }
3204
3412
  /**
3205
3413
  * Trim an OPEN host surface by all closed cutter meshes in one WASM call.
3206
3414
  *