okgeometry-api 1.14.0 → 1.16.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.
@@ -20,12 +20,42 @@ export function arc_point_at(cx: number, cy: number, cz: number, nx: number, ny:
20
20
  */
21
21
  export function brep_boolean_op(a_json: string, b_json: string, op: string, tolerance: number): string;
22
22
 
23
+ /**
24
+ * Boolean-intersection clip of an exact NURBS curve against a CLOSED solid
25
+ * BREP: the curve is split exactly (knot insertion) at every boundary
26
+ * crossing and each piece is classified by containment. Every returned
27
+ * piece lies exactly on the input curve; closed curves merge the run
28
+ * spanning the parameter seam (same convention as `mesh_clip_polyline`).
29
+ *
30
+ * Packing: `[insideCount, (bufLen, curveData…)·insideCount,
31
+ * outsideCount, (bufLen, curveData…)·outsideCount]` — two concatenated
32
+ * multi-curve packings, inside pieces first. Returns an empty buffer on
33
+ * failure (malformed input, or a BREP that is not a closed solid).
34
+ */
35
+ export function brep_clip_curve_op(curve_data: Float64Array, brep_json: string): Float64Array;
36
+
23
37
  /**
24
38
  * Closest BREP face to a 3D point. Returns [faceIndex, u, v, distance,
25
39
  * isNurbs] ((u, v) in the surface's KNOT domain) or empty on failure.
26
40
  */
27
41
  export function brep_closest_face(json: string, x: number, y: number, z: number): Float64Array;
28
42
 
43
+ /**
44
+ * Find all points where a NURBS curve pierces a BREP's faces: per face, the
45
+ * curve is intersected with the EXACT surface and kept only when the hit
46
+ * lies INSIDE the face's trimmed region; crossings on shared edges are
47
+ * deduplicated (smallest face index kept).
48
+ *
49
+ * `curve_data` is the standard NURBS curve encoding. Hits are sorted by
50
+ * curve parameter (normalized [0, 1]); (u, v) are in the face's OWN
51
+ * parameter space (knot domain for NURBS faces, plane-frame coordinates for
52
+ * planar faces).
53
+ *
54
+ * Packing: `[count, (x, y, z, curveParam, faceIndex, u, v)·count]`.
55
+ * Returns an empty buffer on malformed input.
56
+ */
57
+ export function brep_curve_intersection_op(brep_json: string, curve_data: Float64Array): Float64Array;
58
+
29
59
  /**
30
60
  * All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
31
61
  */
@@ -123,12 +153,59 @@ export function brep_from_mesh_buffer(vertex_count: number, buffer: Float64Array
123
153
  */
124
154
  export function brep_info(json: string): Float64Array;
125
155
 
156
+ /**
157
+ * [`brep_intersection_curves_op`] with the per-face-pair pieces JOINED into
158
+ * maximal curves: greedy reversal-aware endpoint chaining, exact degree
159
+ * elevation to the chain maximum, exact `join_arcs` knot concatenation
160
+ * (junction multiplicity = degree, no re-parameterization), and a per-curve
161
+ * verification gate (dense samples within 5·tolerance of BOTH operands'
162
+ * surfaces — a chain failing the gate comes back unjoined, never corrupted).
163
+ * A closed intersection loop (e.g. plane through a cylinder) comes back as
164
+ * ONE closed curve.
165
+ *
166
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
167
+ * curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
168
+ * a pipeline error) — distinguishable from `[0]`, which means the operands
169
+ * genuinely do not intersect.
170
+ */
171
+ export function brep_intersection_curves_joined_op(a_json: string, b_json: string, tolerance: number): Float64Array;
172
+
173
+ /**
174
+ * TRIM-EXACT intersection curves between two BREPs (solids OR sheets): the
175
+ * parametric boolean's SSI → clip → convergence stages run and the fitted 3D
176
+ * intersection edges come back WITHOUT classification/assembly.
177
+ *
178
+ * A closed intersection loop may come back as several contiguous pieces
179
+ * (split at surface seams and face-boundary crossings); the pieces chain
180
+ * end-to-end exactly. Coincident (overlapping) face pairs contribute no
181
+ * curves.
182
+ *
183
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
184
+ * curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
185
+ * a pipeline error) — distinguishable from `[0]`, which means the operands
186
+ * genuinely do not intersect.
187
+ */
188
+ export function brep_intersection_curves_op(a_json: string, b_json: string, tolerance: number): Float64Array;
189
+
126
190
  /**
127
191
  * Loft through profile curves into a BREP.
128
192
  * Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
129
193
  */
130
194
  export function brep_loft_curves(data: Float64Array): string;
131
195
 
196
+ /**
197
+ * Intersection curves between a BREP and a triangle mesh.
198
+ *
199
+ * TESSELLATION-BASED (documented approximation): the BREP is tessellated at
200
+ * `tolerance` (pass `<= 0` for the deterministic auto display tolerance)
201
+ * and intersected with the mesh via BVH-pruned tri-tri crossing + chaining.
202
+ *
203
+ * Mesh input is the standard `[vertexCount, positions..., indices...]`
204
+ * buffer. Returns the standard polyline group packing
205
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]`; empty on failure.
206
+ */
207
+ export function brep_mesh_intersection_curves_op(brep_json: string, vertex_count: number, mesh_buffer: Float64Array, tolerance: number): Float64Array;
208
+
132
209
  /**
133
210
  * BREP primitives.
134
211
  * kind: "box" [minx,miny,minz, maxx,maxy,maxz]
@@ -515,6 +592,22 @@ export function mesh_chamfer_all_edges(mesh_type: string, params: Float64Array,
515
592
  */
516
593
  export function mesh_clip_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
517
594
 
595
+ /**
596
+ * Clip a polyline by an OPEN oriented sheet: split it at every sheet
597
+ * crossing and classify each piece by the SIGNED SIDE of the sheet. This is
598
+ * side classification, NOT containment (unlike `mesh_clip_polyline`, which
599
+ * requires a closed volume): pieces far from the sheet still classify by
600
+ * the nearest facet's normal. `inside` = the positive side, in FRONT of the
601
+ * sheet normal; `outside` = behind it. The sheet may be any non-empty
602
+ * triangle mesh, open or closed; its stored winding defines the normals.
603
+ *
604
+ * Returns two concatenated polyline buffers — inside pieces first, then
605
+ * outside pieces — each encoded as `[num_polylines, n1, x,y,z,..., ...]`
606
+ * (identical packing to `mesh_clip_polyline`). Returns an empty buffer on
607
+ * failure (degenerate polyline/sheet).
608
+ */
609
+ export function mesh_clip_polyline_by_sheet(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
610
+
518
611
  /**
519
612
  * Compute planar curve normal from ordered points.
520
613
  */
@@ -734,6 +827,22 @@ export function mesh_planar_face_evaluate(vertex_count: number, buffer: Float64A
734
827
  */
735
828
  export function mesh_plane_intersect(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
736
829
 
830
+ /**
831
+ * Compute all transversal crossing points of a polyline with a triangle
832
+ * mesh. Works on OPEN meshes (sheets) — the mesh is NOT required to be a
833
+ * closed volume, unlike `mesh_clip_polyline`.
834
+ *
835
+ * `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
836
+ * (segment `i` runs `points[i] → points[(i+1) % n]`; open polylines have
837
+ * n−1 segments, closed ones n).
838
+ *
839
+ * Packing: `[count, (x, y, z, segmentIndex, segmentT, triangleIndex)·count]`,
840
+ * sorted by (segmentIndex, segmentT). Shared-edge/vertex crossings dedupe to
841
+ * one hit (smallest triangle index kept); coplanar sliding overlaps yield no
842
+ * hits. Returns an empty buffer on failure (degenerate polyline/mesh).
843
+ */
844
+ export function mesh_polyline_intersection_points(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
845
+
737
846
  /**
738
847
  * Shift closed boolean cutter curve and adjust height.
739
848
  * Returns [height, epsilon, pointCount, x,y,z,...]
@@ -789,6 +898,20 @@ export function mesh_solid_split_plane(vertex_count: number, buffer: Float64Arra
789
898
  */
790
899
  export function mesh_split_by_surface_to_brep(vertex_count: number, buffer: Float64Array, surface_data: Float64Array, tolerance: number, normal_angle_tol_deg: number, max_faces: number): string;
791
900
 
901
+ /**
902
+ * Intersect a polyline with a triangle mesh (open sheets allowed) and split
903
+ * it into pieces at every crossing. Hit points become the shared endpoints
904
+ * of adjacent pieces; a closed loop is opened at the first hit (N hits → N
905
+ * pieces), an open polyline yields N + 1 pieces. With no crossings the
906
+ * original polyline comes back as one piece.
907
+ *
908
+ * Packing: a single flat polyline-group buffer
909
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]` (same group encoding as
910
+ * `mesh_clip_polyline`, but ONE list — pieces are not classified). Returns
911
+ * an empty buffer on failure.
912
+ */
913
+ export function mesh_split_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
914
+
792
915
  /**
793
916
  * Trim an OPEN host surface by all closed cutter meshes in one WASM call.
794
917
  *
@@ -835,6 +958,20 @@ export function mesh_translate(vertex_count: number, buffer: Float64Array, dx: n
835
958
  */
836
959
  export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float64Array): Float64Array;
837
960
 
961
+ /**
962
+ * Find all intersections between two NURBS curves, with exact parameters.
963
+ *
964
+ * Inputs are standard NURBS curve encodings
965
+ * `[degree, num_cp, cp_xyz..., weights..., knots...]` (the same format
966
+ * consumed by `sample_nurbs_curve` / produced by `build_nurbs_curve`).
967
+ *
968
+ * Packing: `[count, (x, y, z, paramA, paramB)·count]`. Parameters are
969
+ * normalized to [0, 1]; results are sorted by `paramA`. Coincident
970
+ * (overlapping) curve runs yield NO points (identical curves return
971
+ * `[0]`). Returns an empty buffer on malformed input.
972
+ */
973
+ export function nurbs_curve_curve_intersect_params(curve_a_data: Float64Array, curve_b_data: Float64Array): Float64Array;
974
+
838
975
  /**
839
976
  * Intersect a NURBS curve with a plane.
840
977
  * Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
@@ -842,6 +979,43 @@ export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float6
842
979
  */
843
980
  export function nurbs_curve_plane_intersect(data: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
844
981
 
982
+ /**
983
+ * Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
984
+ *
985
+ * Splitting is exact (knot insertion), so every returned piece lies exactly
986
+ * on the input curve. Parameters are sorted/deduplicated/clamped internally;
987
+ * closed curves are opened at the FIRST parameter (N interior parameters →
988
+ * N pieces), open curves yield N + 1 pieces. With no valid parameters the
989
+ * (clamped) curve comes back as the single piece.
990
+ *
991
+ * `closed_hint` is an explicit topology override: `> 0` forces closed
992
+ * (seam-rejoin) semantics, `0` forces open semantics (an open curve whose
993
+ * endpoints merely coincide keeps N + 1 pieces), `< 0` infers closedness
994
+ * geometrically from the endpoint distance (the historical behavior).
995
+ *
996
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
997
+ * is the standard NURBS curve encoding (same multi-curve packing as
998
+ * `brep_face_iso_curves_trimmed`). Returns an empty buffer on malformed
999
+ * input.
1000
+ */
1001
+ export function nurbs_curve_split_at_params(curve_data: Float64Array, params: Float64Array, closed_hint: number): Float64Array;
1002
+
1003
+ /**
1004
+ * Find all isolated intersections of a NURBS curve with a NURBS surface,
1005
+ * with exact parameters.
1006
+ *
1007
+ * `curve_data` is the standard NURBS curve encoding; `surface_data` is the
1008
+ * standard NURBS surface encoding `[degree_u, degree_v, num_u, num_v,
1009
+ * cp(flat)..., weights..., knots_u..., knots_v...]` (same as
1010
+ * `nurbs_surface_evaluate`).
1011
+ *
1012
+ * Packing: `[count, (x, y, z, t, u, v)·count]`. All parameters are
1013
+ * normalized to [0, 1]; results are sorted by `t`. Curve segments lying ON
1014
+ * the surface (coincident runs) yield no points. Returns an empty buffer on
1015
+ * malformed input.
1016
+ */
1017
+ export function nurbs_curve_surface_intersect_exact(curve_data: Float64Array, surface_data: Float64Array): Float64Array;
1018
+
845
1019
  /**
846
1020
  * Closest point on the surface to (x, y, z).
847
1021
  * Returns [u, v, px, py, pz] with u, v normalized to [0,1].
@@ -937,6 +1111,24 @@ export function nurbs_surface_split(data: Float64Array, u_dir: boolean, t: numbe
937
1111
  */
938
1112
  export function nurbs_surface_surface_intersect(data_a: Float64Array, data_b: Float64Array, tess: number): Float64Array;
939
1113
 
1114
+ /**
1115
+ * EXACT intersection curves of two FULL (untrimmed) NURBS surfaces: the
1116
+ * parametric boolean's SSI pipeline (seeded tri-tri, chaining, tangent-plane
1117
+ * relaxation) fitted to tolerance-verified interpolating NURBS curves —
1118
+ * unlike `nurbs_surface_surface_intersect`, which returns tessellated
1119
+ * polylines.
1120
+ *
1121
+ * Inputs are standard NURBS surface encodings; `tolerance` is absolute
1122
+ * (floored relative to the combined model scale kernel-side). Closed loops
1123
+ * come back as ONE closed curve; coincident (overlapping) surfaces yield no
1124
+ * curves (their overlap is a 2D region).
1125
+ *
1126
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
1127
+ * is the standard NURBS curve encoding. Returns an empty buffer on
1128
+ * malformed input.
1129
+ */
1130
+ export function nurbs_surface_surface_intersect_curves(surf_a_data: Float64Array, surf_b_data: Float64Array, tolerance: number): Float64Array;
1131
+
940
1132
  /**
941
1133
  * Curvature-adaptive tessellation against a chordal tolerance.
942
1134
  * Returns the standard mesh buffer [vertexCount, positions..., indices...].
@@ -1078,7 +1270,9 @@ export interface InitOutput {
1078
1270
  readonly arc_length: (a: number, b: number, c: number) => number;
1079
1271
  readonly arc_point_at: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1080
1272
  readonly brep_boolean_op: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1273
+ readonly brep_clip_curve_op: (a: number, b: number, c: number, d: number) => [number, number];
1081
1274
  readonly brep_closest_face: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1275
+ readonly brep_curve_intersection_op: (a: number, b: number, c: number, d: number) => [number, number];
1082
1276
  readonly brep_edges: (a: number, b: number, c: number) => [number, number];
1083
1277
  readonly brep_extract_face: (a: number, b: number, c: number) => [number, number];
1084
1278
  readonly brep_extract_faces: (a: number, b: number) => [number, number];
@@ -1094,7 +1288,10 @@ export interface InitOutput {
1094
1288
  readonly brep_face_trim_bounds: (a: number, b: number, c: number) => [number, number];
1095
1289
  readonly brep_from_mesh_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1096
1290
  readonly brep_info: (a: number, b: number) => [number, number];
1291
+ readonly brep_intersection_curves_joined_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1292
+ readonly brep_intersection_curves_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1097
1293
  readonly brep_loft_curves: (a: number, b: number) => [number, number];
1294
+ readonly brep_mesh_intersection_curves_op: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1098
1295
  readonly brep_primitive: (a: number, b: number, c: number, d: number) => [number, number];
1099
1296
  readonly brep_revolve_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
1100
1297
  readonly brep_sheet_from_surface: (a: number, b: number) => [number, number];
@@ -1159,6 +1356,7 @@ export interface InitOutput {
1159
1356
  readonly mesh_build_render_buffers: (a: number, b: number, c: number, d: number) => [number, number];
1160
1357
  readonly mesh_chamfer_all_edges: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1161
1358
  readonly mesh_clip_polyline: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1359
+ readonly mesh_clip_polyline_by_sheet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1162
1360
  readonly mesh_compute_planar_curve_normal: (a: number, b: number, c: number) => [number, number];
1163
1361
  readonly mesh_contains_point: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
1164
1362
  readonly mesh_create_box: (a: number, b: number, c: number) => [number, number];
@@ -1196,6 +1394,7 @@ export interface InitOutput {
1196
1394
  readonly mesh_patch_from_points: (a: number, b: number) => [number, number];
1197
1395
  readonly mesh_planar_face_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1198
1396
  readonly mesh_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1397
+ readonly mesh_polyline_intersection_points: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1199
1398
  readonly mesh_prepare_boolean_cutter_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1200
1399
  readonly mesh_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
1201
1400
  readonly mesh_raycast_all: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
@@ -1205,6 +1404,7 @@ export interface InitOutput {
1205
1404
  readonly mesh_solid_split_by_surface: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1206
1405
  readonly mesh_solid_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
1207
1406
  readonly mesh_split_by_surface_to_brep: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1407
+ readonly mesh_split_polyline: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1208
1408
  readonly mesh_surface_difference_all: (a: number, b: number, c: number, d: number) => [number, number];
1209
1409
  readonly mesh_surface_split: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1210
1410
  readonly mesh_surface_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
@@ -1212,7 +1412,10 @@ export interface InitOutput {
1212
1412
  readonly mesh_topology_metrics_raw: (a: number, b: number, c: number) => [number, number];
1213
1413
  readonly mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1214
1414
  readonly nurbs_curve_curve_intersect: (a: number, b: number, c: number, d: number) => [number, number];
1415
+ readonly nurbs_curve_curve_intersect_params: (a: number, b: number, c: number, d: number) => [number, number];
1215
1416
  readonly nurbs_curve_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1417
+ readonly nurbs_curve_split_at_params: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1418
+ readonly nurbs_curve_surface_intersect_exact: (a: number, b: number, c: number, d: number) => [number, number];
1216
1419
  readonly nurbs_surface_closest_point: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1217
1420
  readonly nurbs_surface_curvature: (a: number, b: number, c: number, d: number) => [number, number];
1218
1421
  readonly nurbs_surface_derivatives: (a: number, b: number, c: number, d: number) => [number, number];
@@ -1229,6 +1432,7 @@ export interface InitOutput {
1229
1432
  readonly nurbs_surface_ruled: (a: number, b: number, c: number, d: number) => [number, number];
1230
1433
  readonly nurbs_surface_split: (a: number, b: number, c: number, d: number) => [number, number];
1231
1434
  readonly nurbs_surface_surface_intersect: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1435
+ readonly nurbs_surface_surface_intersect_curves: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1232
1436
  readonly nurbs_surface_tessellate_adaptive: (a: number, b: number, c: number, d: number) => [number, number];
1233
1437
  readonly nurbs_surface_tessellate_render: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1234
1438
  readonly offset_polycurve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];