okgeometry-api 1.24.0 → 1.26.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.
@@ -230,6 +230,16 @@ export function brep_mesh_intersection_curves_op(brep_json: string, vertex_count
230
230
  */
231
231
  export function brep_primitive(kind: string, params: Float64Array): string;
232
232
 
233
+ /**
234
+ * Rebuild every NURBS face surface of a BREP with the given degrees and
235
+ * control counts, preserving each face's parameter domain so trims and
236
+ * edges stay coherent. Each face replacement is gated by `tolerance`
237
+ * (non-positive = accept all fits); planar faces pass through untouched.
238
+ * Returns JSON `{"maxDeviation": .., "rebuiltFaces": .., "skippedFaces": ..,
239
+ * "planarFaces": .., "brep": {...}}` or `{"error": "..."}`.
240
+ */
241
+ export function brep_rebuild_surfaces(json: string, degree_u: number, degree_v: number, count_u: number, count_v: number, tolerance: number): string;
242
+
233
243
  /**
234
244
  * Revolve a profile curve into a BREP. Returns JSON.
235
245
  */
@@ -795,6 +805,17 @@ export function mesh_extrude_face(vertex_count: number, buffer: Float64Array, fa
795
805
  */
796
806
  export function mesh_extrude_planar_curve(coords: Float64Array, nx: number, ny: number, nz: number, height: number, closed: boolean): Float64Array;
797
807
 
808
+ /**
809
+ * Feature-edge chains of a mesh for chamfer highlighting: every connected
810
+ * chain of edges separating the same two smooth face groups — the exact
811
+ * grouping `mesh_chamfer_edges` expands picks to, so highlighting a chain
812
+ * shows precisely what one pick will chamfer. Packed as
813
+ * `[chainCount, (closed, pointCount, x,y,z ...)...]`; closed chains omit the
814
+ * duplicate seam point. A mesh with no feature edges returns `[0]`; an
815
+ * invalid mesh returns an empty buffer (see `geometry_last_error`).
816
+ */
817
+ export function mesh_feature_edge_chains(vertex_count: number, buffer: Float64Array): Float64Array;
818
+
798
819
  /**
799
820
  * Find the best matching coplanar connected face group by normal and optional near-point.
800
821
  * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
@@ -1163,6 +1184,17 @@ export function nurbs_curve_offset(data: Float64Array, distance: number, nx: num
1163
1184
  */
1164
1185
  export function nurbs_curve_plane_intersect(data: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
1165
1186
 
1187
+ /**
1188
+ * Rebuild a NURBS curve with the given degree and control point count via
1189
+ * global least-squares fitting (Rhino-style Rebuild). Geometrically closed
1190
+ * inputs produce a periodic (seamlessly closed) result; output is always
1191
+ * non-rational. Input uses the standard curve buffer format
1192
+ * [degree, n, cps(xyz)..., weights..., knots...]; output prepends the fit
1193
+ * report: [maxDeviation, avgDeviation, degree, n, cps..., weights...,
1194
+ * knots...]. Returns an empty buffer on failure (see `geometry_last_error`).
1195
+ */
1196
+ export function nurbs_curve_rebuild(data: Float64Array, degree: number, count: number): Float64Array;
1197
+
1166
1198
  /**
1167
1199
  * Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
1168
1200
  *
@@ -1281,6 +1313,16 @@ export function nurbs_surface_plane_intersect(surface_data: Float64Array, nx: nu
1281
1313
  */
1282
1314
  export function nurbs_surface_primitive(kind: string, params: Float64Array): Float64Array;
1283
1315
 
1316
+ /**
1317
+ * Rebuild a NURBS surface with the given degrees and control counts via the
1318
+ * two-stage least-squares scheme. Closed directions stay closed (periodic
1319
+ * basis); poles stay exactly degenerate; output is non-rational. Input uses
1320
+ * the standard surface buffer format; output prepends the fit report:
1321
+ * [maxDeviation, avgDeviation, ...surface buffer]. Returns an empty buffer
1322
+ * on failure (see `geometry_last_error`).
1323
+ */
1324
+ export function nurbs_surface_rebuild(data: Float64Array, degree_u: number, degree_v: number, count_u: number, count_v: number): Float64Array;
1325
+
1284
1326
  /**
1285
1327
  * Exact surface of revolution from a profile curve (A8.1).
1286
1328
  */
@@ -1592,6 +1634,7 @@ export interface InitOutput {
1592
1634
  readonly brep_loft_curves: (a: number, b: number) => [number, number];
1593
1635
  readonly brep_mesh_intersection_curves_op: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1594
1636
  readonly brep_primitive: (a: number, b: number, c: number, d: number) => [number, number];
1637
+ readonly brep_rebuild_surfaces: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1595
1638
  readonly brep_revolve_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
1596
1639
  readonly brep_sheet_from_surface: (a: number, b: number) => [number, number];
1597
1640
  readonly brep_split_sheet_by_sheet_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -1678,6 +1721,7 @@ export interface InitOutput {
1678
1721
  readonly mesh_export_stl_binary: (a: number, b: number, c: number) => [number, number];
1679
1722
  readonly mesh_extrude_face: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1680
1723
  readonly mesh_extrude_planar_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1724
+ readonly mesh_feature_edge_chains: (a: number, b: number, c: number) => [number, number];
1681
1725
  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];
1682
1726
  readonly mesh_find_face_group_by_triangle_index: (a: number, b: number, c: number, d: number) => [number, number];
1683
1727
  readonly mesh_get_bounds: (a: number, b: number, c: number) => [number, number];
@@ -1729,6 +1773,7 @@ export interface InitOutput {
1729
1773
  readonly nurbs_curve_curve_intersect_params: (a: number, b: number, c: number, d: number) => [number, number];
1730
1774
  readonly nurbs_curve_offset: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1731
1775
  readonly nurbs_curve_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1776
+ readonly nurbs_curve_rebuild: (a: number, b: number, c: number, d: number) => [number, number];
1732
1777
  readonly nurbs_curve_split_at_params: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1733
1778
  readonly nurbs_curve_surface_intersect_exact: (a: number, b: number, c: number, d: number) => [number, number];
1734
1779
  readonly nurbs_surface_closest_point: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -1744,6 +1789,7 @@ export interface InitOutput {
1744
1789
  readonly nurbs_surface_offset: (a: number, b: number, c: number, d: number) => [number, number];
1745
1790
  readonly nurbs_surface_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1746
1791
  readonly nurbs_surface_primitive: (a: number, b: number, c: number, d: number) => [number, number];
1792
+ readonly nurbs_surface_rebuild: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1747
1793
  readonly nurbs_surface_revolve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
1748
1794
  readonly nurbs_surface_ruled: (a: number, b: number, c: number, d: number) => [number, number];
1749
1795
  readonly nurbs_surface_split: (a: number, b: number, c: number, d: number) => [number, number];
@@ -569,6 +569,36 @@ export function brep_primitive(kind, params) {
569
569
  }
570
570
  }
571
571
 
572
+ /**
573
+ * Rebuild every NURBS face surface of a BREP with the given degrees and
574
+ * control counts, preserving each face's parameter domain so trims and
575
+ * edges stay coherent. Each face replacement is gated by `tolerance`
576
+ * (non-positive = accept all fits); planar faces pass through untouched.
577
+ * Returns JSON `{"maxDeviation": .., "rebuiltFaces": .., "skippedFaces": ..,
578
+ * "planarFaces": .., "brep": {...}}` or `{"error": "..."}`.
579
+ * @param {string} json
580
+ * @param {number} degree_u
581
+ * @param {number} degree_v
582
+ * @param {number} count_u
583
+ * @param {number} count_v
584
+ * @param {number} tolerance
585
+ * @returns {string}
586
+ */
587
+ export function brep_rebuild_surfaces(json, degree_u, degree_v, count_u, count_v, tolerance) {
588
+ let deferred2_0;
589
+ let deferred2_1;
590
+ try {
591
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
592
+ const len0 = WASM_VECTOR_LEN;
593
+ const ret = wasm.brep_rebuild_surfaces(ptr0, len0, degree_u, degree_v, count_u, count_v, tolerance);
594
+ deferred2_0 = ret[0];
595
+ deferred2_1 = ret[1];
596
+ return getStringFromWasm0(ret[0], ret[1]);
597
+ } finally {
598
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
599
+ }
600
+ }
601
+
572
602
  /**
573
603
  * Revolve a profile curve into a BREP. Returns JSON.
574
604
  * @param {Float64Array} curve_data
@@ -2438,6 +2468,27 @@ export function mesh_extrude_planar_curve(coords, nx, ny, nz, height, closed) {
2438
2468
  return v2;
2439
2469
  }
2440
2470
 
2471
+ /**
2472
+ * Feature-edge chains of a mesh for chamfer highlighting: every connected
2473
+ * chain of edges separating the same two smooth face groups — the exact
2474
+ * grouping `mesh_chamfer_edges` expands picks to, so highlighting a chain
2475
+ * shows precisely what one pick will chamfer. Packed as
2476
+ * `[chainCount, (closed, pointCount, x,y,z ...)...]`; closed chains omit the
2477
+ * duplicate seam point. A mesh with no feature edges returns `[0]`; an
2478
+ * invalid mesh returns an empty buffer (see `geometry_last_error`).
2479
+ * @param {number} vertex_count
2480
+ * @param {Float64Array} buffer
2481
+ * @returns {Float64Array}
2482
+ */
2483
+ export function mesh_feature_edge_chains(vertex_count, buffer) {
2484
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
2485
+ const len0 = WASM_VECTOR_LEN;
2486
+ const ret = wasm.mesh_feature_edge_chains(vertex_count, ptr0, len0);
2487
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2488
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2489
+ return v2;
2490
+ }
2491
+
2441
2492
  /**
2442
2493
  * Find the best matching coplanar connected face group by normal and optional near-point.
2443
2494
  * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
@@ -3496,6 +3547,28 @@ export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
3496
3547
  return v2;
3497
3548
  }
3498
3549
 
3550
+ /**
3551
+ * Rebuild a NURBS curve with the given degree and control point count via
3552
+ * global least-squares fitting (Rhino-style Rebuild). Geometrically closed
3553
+ * inputs produce a periodic (seamlessly closed) result; output is always
3554
+ * non-rational. Input uses the standard curve buffer format
3555
+ * [degree, n, cps(xyz)..., weights..., knots...]; output prepends the fit
3556
+ * report: [maxDeviation, avgDeviation, degree, n, cps..., weights...,
3557
+ * knots...]. Returns an empty buffer on failure (see `geometry_last_error`).
3558
+ * @param {Float64Array} data
3559
+ * @param {number} degree
3560
+ * @param {number} count
3561
+ * @returns {Float64Array}
3562
+ */
3563
+ export function nurbs_curve_rebuild(data, degree, count) {
3564
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
3565
+ const len0 = WASM_VECTOR_LEN;
3566
+ const ret = wasm.nurbs_curve_rebuild(ptr0, len0, degree, count);
3567
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3568
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3569
+ return v2;
3570
+ }
3571
+
3499
3572
  /**
3500
3573
  * Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
3501
3574
  *
@@ -3791,6 +3864,29 @@ export function nurbs_surface_primitive(kind, params) {
3791
3864
  return v3;
3792
3865
  }
3793
3866
 
3867
+ /**
3868
+ * Rebuild a NURBS surface with the given degrees and control counts via the
3869
+ * two-stage least-squares scheme. Closed directions stay closed (periodic
3870
+ * basis); poles stay exactly degenerate; output is non-rational. Input uses
3871
+ * the standard surface buffer format; output prepends the fit report:
3872
+ * [maxDeviation, avgDeviation, ...surface buffer]. Returns an empty buffer
3873
+ * on failure (see `geometry_last_error`).
3874
+ * @param {Float64Array} data
3875
+ * @param {number} degree_u
3876
+ * @param {number} degree_v
3877
+ * @param {number} count_u
3878
+ * @param {number} count_v
3879
+ * @returns {Float64Array}
3880
+ */
3881
+ export function nurbs_surface_rebuild(data, degree_u, degree_v, count_u, count_v) {
3882
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
3883
+ const len0 = WASM_VECTOR_LEN;
3884
+ const ret = wasm.nurbs_surface_rebuild(ptr0, len0, degree_u, degree_v, count_u, count_v);
3885
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3886
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3887
+ return v2;
3888
+ }
3889
+
3794
3890
  /**
3795
3891
  * Exact surface of revolution from a profile curve (A8.1).
3796
3892
  * @param {Float64Array} curve_data