brepkit-wasm 0.5.2 → 0.5.3

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/brepkit_wasm.d.ts CHANGED
@@ -591,6 +591,13 @@ export class BrepKernel {
591
591
  * Returns an array of vertex handles (`u32[]`).
592
592
  */
593
593
  getFaceVertices(face: number): Uint32Array;
594
+ /**
595
+ * Get all wires of a face (outer wire first, then inner/hole wires).
596
+ *
597
+ * # Errors
598
+ * Returns an error if the face handle is invalid.
599
+ */
600
+ getFaceWires(face: number): Uint32Array;
594
601
  /**
595
602
  * Get the orientation of a shape.
596
603
  *
@@ -724,6 +731,18 @@ export class BrepKernel {
724
731
  * Returns an error if the IGES data is malformed.
725
732
  */
726
733
  importIges(data: Uint8Array): Uint32Array;
734
+ /**
735
+ * Import a triangle mesh from flat vertex/index arrays.
736
+ *
737
+ * `positions` is a flat `[x0,y0,z0, x1,y1,z1, ...]` array.
738
+ * `indices` is a flat `[i0,i1,i2, i3,i4,i5, ...]` array of triangle
739
+ * vertex indices. Returns a solid handle.
740
+ *
741
+ * # Errors
742
+ *
743
+ * Returns an error if the arrays are malformed or mesh import fails.
744
+ */
745
+ importIndexedMesh(positions: Float64Array, indices: Uint32Array): number;
727
746
  /**
728
747
  * Import an OBJ file and return a solid handle.
729
748
  *
@@ -1107,6 +1126,26 @@ export class BrepKernel {
1107
1126
  * Returns `true` if the point is inside the polygon (winding number test).
1108
1127
  */
1109
1128
  pointInPolygon2d(polygon_coords: Float64Array, px: number, py: number): boolean;
1129
+ /**
1130
+ * Compute minimum distance from a point to an edge.
1131
+ *
1132
+ * Returns `[distance, closest_x, closest_y, closest_z]`.
1133
+ *
1134
+ * # Errors
1135
+ *
1136
+ * Returns an error if the edge handle is invalid.
1137
+ */
1138
+ pointToEdgeDistance(px: number, py: number, pz: number, edge: number): Float64Array;
1139
+ /**
1140
+ * Compute minimum distance from a point to a face.
1141
+ *
1142
+ * Returns `[distance, closest_x, closest_y, closest_z]`.
1143
+ *
1144
+ * # Errors
1145
+ *
1146
+ * Returns an error if the face handle is invalid.
1147
+ */
1148
+ pointToFaceDistance(px: number, py: number, pz: number, face: number): Float64Array;
1110
1149
  /**
1111
1150
  * Compute minimum distance from a point to a solid.
1112
1151
  *
@@ -1453,6 +1453,23 @@ export class BrepKernel {
1453
1453
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1454
1454
  return v1;
1455
1455
  }
1456
+ /**
1457
+ * Get all wires of a face (outer wire first, then inner/hole wires).
1458
+ *
1459
+ * # Errors
1460
+ * Returns an error if the face handle is invalid.
1461
+ * @param {number} face
1462
+ * @returns {Uint32Array}
1463
+ */
1464
+ getFaceWires(face) {
1465
+ const ret = wasm.brepkernel_getFaceWires(this.__wbg_ptr, face);
1466
+ if (ret[3]) {
1467
+ throw takeFromExternrefTable0(ret[2]);
1468
+ }
1469
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1470
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1471
+ return v1;
1472
+ }
1456
1473
  /**
1457
1474
  * Get the orientation of a shape.
1458
1475
  *
@@ -1765,6 +1782,31 @@ export class BrepKernel {
1765
1782
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1766
1783
  return v2;
1767
1784
  }
1785
+ /**
1786
+ * Import a triangle mesh from flat vertex/index arrays.
1787
+ *
1788
+ * `positions` is a flat `[x0,y0,z0, x1,y1,z1, ...]` array.
1789
+ * `indices` is a flat `[i0,i1,i2, i3,i4,i5, ...]` array of triangle
1790
+ * vertex indices. Returns a solid handle.
1791
+ *
1792
+ * # Errors
1793
+ *
1794
+ * Returns an error if the arrays are malformed or mesh import fails.
1795
+ * @param {Float64Array} positions
1796
+ * @param {Uint32Array} indices
1797
+ * @returns {number}
1798
+ */
1799
+ importIndexedMesh(positions, indices) {
1800
+ const ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
1801
+ const len0 = WASM_VECTOR_LEN;
1802
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1803
+ const len1 = WASM_VECTOR_LEN;
1804
+ const ret = wasm.brepkernel_importIndexedMesh(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1805
+ if (ret[2]) {
1806
+ throw takeFromExternrefTable0(ret[1]);
1807
+ }
1808
+ return ret[0] >>> 0;
1809
+ }
1768
1810
  /**
1769
1811
  * Import an OBJ file and return a solid handle.
1770
1812
  *
@@ -2655,6 +2697,52 @@ export class BrepKernel {
2655
2697
  }
2656
2698
  return ret[0] !== 0;
2657
2699
  }
2700
+ /**
2701
+ * Compute minimum distance from a point to an edge.
2702
+ *
2703
+ * Returns `[distance, closest_x, closest_y, closest_z]`.
2704
+ *
2705
+ * # Errors
2706
+ *
2707
+ * Returns an error if the edge handle is invalid.
2708
+ * @param {number} px
2709
+ * @param {number} py
2710
+ * @param {number} pz
2711
+ * @param {number} edge
2712
+ * @returns {Float64Array}
2713
+ */
2714
+ pointToEdgeDistance(px, py, pz, edge) {
2715
+ const ret = wasm.brepkernel_pointToEdgeDistance(this.__wbg_ptr, px, py, pz, edge);
2716
+ if (ret[3]) {
2717
+ throw takeFromExternrefTable0(ret[2]);
2718
+ }
2719
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2720
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2721
+ return v1;
2722
+ }
2723
+ /**
2724
+ * Compute minimum distance from a point to a face.
2725
+ *
2726
+ * Returns `[distance, closest_x, closest_y, closest_z]`.
2727
+ *
2728
+ * # Errors
2729
+ *
2730
+ * Returns an error if the face handle is invalid.
2731
+ * @param {number} px
2732
+ * @param {number} py
2733
+ * @param {number} pz
2734
+ * @param {number} face
2735
+ * @returns {Float64Array}
2736
+ */
2737
+ pointToFaceDistance(px, py, pz, face) {
2738
+ const ret = wasm.brepkernel_pointToFaceDistance(this.__wbg_ptr, px, py, pz, face);
2739
+ if (ret[3]) {
2740
+ throw takeFromExternrefTable0(ret[2]);
2741
+ }
2742
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2743
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2744
+ return v1;
2745
+ }
2658
2746
  /**
2659
2747
  * Compute minimum distance from a point to a solid.
2660
2748
  *
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "brepkit-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for brepkit — browser-native B-Rep solid modeling",
5
- "version": "0.5.2",
5
+ "version": "0.5.3",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",