okgeometry-api 1.14.0 → 1.15.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,42 @@ 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
+ * TRIM-EXACT intersection curves between two BREPs (solids OR sheets): the
158
+ * parametric boolean's SSI → clip → convergence stages run and the fitted 3D
159
+ * intersection edges come back WITHOUT classification/assembly.
160
+ *
161
+ * A closed intersection loop may come back as several contiguous pieces
162
+ * (split at surface seams and face-boundary crossings); the pieces chain
163
+ * end-to-end exactly. Coincident (overlapping) face pairs contribute no
164
+ * curves.
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_op(a_json: string, b_json: string, tolerance: number): Float64Array;
172
+
126
173
  /**
127
174
  * Loft through profile curves into a BREP.
128
175
  * Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
129
176
  */
130
177
  export function brep_loft_curves(data: Float64Array): string;
131
178
 
179
+ /**
180
+ * Intersection curves between a BREP and a triangle mesh.
181
+ *
182
+ * TESSELLATION-BASED (documented approximation): the BREP is tessellated at
183
+ * `tolerance` (pass `<= 0` for the deterministic auto display tolerance)
184
+ * and intersected with the mesh via BVH-pruned tri-tri crossing + chaining.
185
+ *
186
+ * Mesh input is the standard `[vertexCount, positions..., indices...]`
187
+ * buffer. Returns the standard polyline group packing
188
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]`; empty on failure.
189
+ */
190
+ export function brep_mesh_intersection_curves_op(brep_json: string, vertex_count: number, mesh_buffer: Float64Array, tolerance: number): Float64Array;
191
+
132
192
  /**
133
193
  * BREP primitives.
134
194
  * kind: "box" [minx,miny,minz, maxx,maxy,maxz]
@@ -515,6 +575,22 @@ export function mesh_chamfer_all_edges(mesh_type: string, params: Float64Array,
515
575
  */
516
576
  export function mesh_clip_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
517
577
 
578
+ /**
579
+ * Clip a polyline by an OPEN oriented sheet: split it at every sheet
580
+ * crossing and classify each piece by the SIGNED SIDE of the sheet. This is
581
+ * side classification, NOT containment (unlike `mesh_clip_polyline`, which
582
+ * requires a closed volume): pieces far from the sheet still classify by
583
+ * the nearest facet's normal. `inside` = the positive side, in FRONT of the
584
+ * sheet normal; `outside` = behind it. The sheet may be any non-empty
585
+ * triangle mesh, open or closed; its stored winding defines the normals.
586
+ *
587
+ * Returns two concatenated polyline buffers — inside pieces first, then
588
+ * outside pieces — each encoded as `[num_polylines, n1, x,y,z,..., ...]`
589
+ * (identical packing to `mesh_clip_polyline`). Returns an empty buffer on
590
+ * failure (degenerate polyline/sheet).
591
+ */
592
+ export function mesh_clip_polyline_by_sheet(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
593
+
518
594
  /**
519
595
  * Compute planar curve normal from ordered points.
520
596
  */
@@ -734,6 +810,22 @@ export function mesh_planar_face_evaluate(vertex_count: number, buffer: Float64A
734
810
  */
735
811
  export function mesh_plane_intersect(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
736
812
 
813
+ /**
814
+ * Compute all transversal crossing points of a polyline with a triangle
815
+ * mesh. Works on OPEN meshes (sheets) — the mesh is NOT required to be a
816
+ * closed volume, unlike `mesh_clip_polyline`.
817
+ *
818
+ * `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
819
+ * (segment `i` runs `points[i] → points[(i+1) % n]`; open polylines have
820
+ * n−1 segments, closed ones n).
821
+ *
822
+ * Packing: `[count, (x, y, z, segmentIndex, segmentT, triangleIndex)·count]`,
823
+ * sorted by (segmentIndex, segmentT). Shared-edge/vertex crossings dedupe to
824
+ * one hit (smallest triangle index kept); coplanar sliding overlaps yield no
825
+ * hits. Returns an empty buffer on failure (degenerate polyline/mesh).
826
+ */
827
+ export function mesh_polyline_intersection_points(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
828
+
737
829
  /**
738
830
  * Shift closed boolean cutter curve and adjust height.
739
831
  * Returns [height, epsilon, pointCount, x,y,z,...]
@@ -789,6 +881,20 @@ export function mesh_solid_split_plane(vertex_count: number, buffer: Float64Arra
789
881
  */
790
882
  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
883
 
884
+ /**
885
+ * Intersect a polyline with a triangle mesh (open sheets allowed) and split
886
+ * it into pieces at every crossing. Hit points become the shared endpoints
887
+ * of adjacent pieces; a closed loop is opened at the first hit (N hits → N
888
+ * pieces), an open polyline yields N + 1 pieces. With no crossings the
889
+ * original polyline comes back as one piece.
890
+ *
891
+ * Packing: a single flat polyline-group buffer
892
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]` (same group encoding as
893
+ * `mesh_clip_polyline`, but ONE list — pieces are not classified). Returns
894
+ * an empty buffer on failure.
895
+ */
896
+ export function mesh_split_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
897
+
792
898
  /**
793
899
  * Trim an OPEN host surface by all closed cutter meshes in one WASM call.
794
900
  *
@@ -835,6 +941,20 @@ export function mesh_translate(vertex_count: number, buffer: Float64Array, dx: n
835
941
  */
836
942
  export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float64Array): Float64Array;
837
943
 
944
+ /**
945
+ * Find all intersections between two NURBS curves, with exact parameters.
946
+ *
947
+ * Inputs are standard NURBS curve encodings
948
+ * `[degree, num_cp, cp_xyz..., weights..., knots...]` (the same format
949
+ * consumed by `sample_nurbs_curve` / produced by `build_nurbs_curve`).
950
+ *
951
+ * Packing: `[count, (x, y, z, paramA, paramB)·count]`. Parameters are
952
+ * normalized to [0, 1]; results are sorted by `paramA`. Coincident
953
+ * (overlapping) curve runs yield NO points (identical curves return
954
+ * `[0]`). Returns an empty buffer on malformed input.
955
+ */
956
+ export function nurbs_curve_curve_intersect_params(curve_a_data: Float64Array, curve_b_data: Float64Array): Float64Array;
957
+
838
958
  /**
839
959
  * Intersect a NURBS curve with a plane.
840
960
  * Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
@@ -842,6 +962,43 @@ export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float6
842
962
  */
843
963
  export function nurbs_curve_plane_intersect(data: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
844
964
 
965
+ /**
966
+ * Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
967
+ *
968
+ * Splitting is exact (knot insertion), so every returned piece lies exactly
969
+ * on the input curve. Parameters are sorted/deduplicated/clamped internally;
970
+ * closed curves are opened at the FIRST parameter (N interior parameters →
971
+ * N pieces), open curves yield N + 1 pieces. With no valid parameters the
972
+ * (clamped) curve comes back as the single piece.
973
+ *
974
+ * `closed_hint` is an explicit topology override: `> 0` forces closed
975
+ * (seam-rejoin) semantics, `0` forces open semantics (an open curve whose
976
+ * endpoints merely coincide keeps N + 1 pieces), `< 0` infers closedness
977
+ * geometrically from the endpoint distance (the historical behavior).
978
+ *
979
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
980
+ * is the standard NURBS curve encoding (same multi-curve packing as
981
+ * `brep_face_iso_curves_trimmed`). Returns an empty buffer on malformed
982
+ * input.
983
+ */
984
+ export function nurbs_curve_split_at_params(curve_data: Float64Array, params: Float64Array, closed_hint: number): Float64Array;
985
+
986
+ /**
987
+ * Find all isolated intersections of a NURBS curve with a NURBS surface,
988
+ * with exact parameters.
989
+ *
990
+ * `curve_data` is the standard NURBS curve encoding; `surface_data` is the
991
+ * standard NURBS surface encoding `[degree_u, degree_v, num_u, num_v,
992
+ * cp(flat)..., weights..., knots_u..., knots_v...]` (same as
993
+ * `nurbs_surface_evaluate`).
994
+ *
995
+ * Packing: `[count, (x, y, z, t, u, v)·count]`. All parameters are
996
+ * normalized to [0, 1]; results are sorted by `t`. Curve segments lying ON
997
+ * the surface (coincident runs) yield no points. Returns an empty buffer on
998
+ * malformed input.
999
+ */
1000
+ export function nurbs_curve_surface_intersect_exact(curve_data: Float64Array, surface_data: Float64Array): Float64Array;
1001
+
845
1002
  /**
846
1003
  * Closest point on the surface to (x, y, z).
847
1004
  * Returns [u, v, px, py, pz] with u, v normalized to [0,1].
@@ -937,6 +1094,24 @@ export function nurbs_surface_split(data: Float64Array, u_dir: boolean, t: numbe
937
1094
  */
938
1095
  export function nurbs_surface_surface_intersect(data_a: Float64Array, data_b: Float64Array, tess: number): Float64Array;
939
1096
 
1097
+ /**
1098
+ * EXACT intersection curves of two FULL (untrimmed) NURBS surfaces: the
1099
+ * parametric boolean's SSI pipeline (seeded tri-tri, chaining, tangent-plane
1100
+ * relaxation) fitted to tolerance-verified interpolating NURBS curves —
1101
+ * unlike `nurbs_surface_surface_intersect`, which returns tessellated
1102
+ * polylines.
1103
+ *
1104
+ * Inputs are standard NURBS surface encodings; `tolerance` is absolute
1105
+ * (floored relative to the combined model scale kernel-side). Closed loops
1106
+ * come back as ONE closed curve; coincident (overlapping) surfaces yield no
1107
+ * curves (their overlap is a 2D region).
1108
+ *
1109
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
1110
+ * is the standard NURBS curve encoding. Returns an empty buffer on
1111
+ * malformed input.
1112
+ */
1113
+ export function nurbs_surface_surface_intersect_curves(surf_a_data: Float64Array, surf_b_data: Float64Array, tolerance: number): Float64Array;
1114
+
940
1115
  /**
941
1116
  * Curvature-adaptive tessellation against a chordal tolerance.
942
1117
  * Returns the standard mesh buffer [vertexCount, positions..., indices...].
@@ -1078,7 +1253,9 @@ export interface InitOutput {
1078
1253
  readonly arc_length: (a: number, b: number, c: number) => number;
1079
1254
  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
1255
  readonly brep_boolean_op: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1256
+ readonly brep_clip_curve_op: (a: number, b: number, c: number, d: number) => [number, number];
1081
1257
  readonly brep_closest_face: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1258
+ readonly brep_curve_intersection_op: (a: number, b: number, c: number, d: number) => [number, number];
1082
1259
  readonly brep_edges: (a: number, b: number, c: number) => [number, number];
1083
1260
  readonly brep_extract_face: (a: number, b: number, c: number) => [number, number];
1084
1261
  readonly brep_extract_faces: (a: number, b: number) => [number, number];
@@ -1094,7 +1271,9 @@ export interface InitOutput {
1094
1271
  readonly brep_face_trim_bounds: (a: number, b: number, c: number) => [number, number];
1095
1272
  readonly brep_from_mesh_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1096
1273
  readonly brep_info: (a: number, b: number) => [number, number];
1274
+ readonly brep_intersection_curves_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1097
1275
  readonly brep_loft_curves: (a: number, b: number) => [number, number];
1276
+ readonly brep_mesh_intersection_curves_op: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1098
1277
  readonly brep_primitive: (a: number, b: number, c: number, d: number) => [number, number];
1099
1278
  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
1279
  readonly brep_sheet_from_surface: (a: number, b: number) => [number, number];
@@ -1159,6 +1338,7 @@ export interface InitOutput {
1159
1338
  readonly mesh_build_render_buffers: (a: number, b: number, c: number, d: number) => [number, number];
1160
1339
  readonly mesh_chamfer_all_edges: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1161
1340
  readonly mesh_clip_polyline: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1341
+ readonly mesh_clip_polyline_by_sheet: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1162
1342
  readonly mesh_compute_planar_curve_normal: (a: number, b: number, c: number) => [number, number];
1163
1343
  readonly mesh_contains_point: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
1164
1344
  readonly mesh_create_box: (a: number, b: number, c: number) => [number, number];
@@ -1196,6 +1376,7 @@ export interface InitOutput {
1196
1376
  readonly mesh_patch_from_points: (a: number, b: number) => [number, number];
1197
1377
  readonly mesh_planar_face_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1198
1378
  readonly mesh_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1379
+ readonly mesh_polyline_intersection_points: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1199
1380
  readonly mesh_prepare_boolean_cutter_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1200
1381
  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
1382
  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 +1386,7 @@ export interface InitOutput {
1205
1386
  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
1387
  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
1388
  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];
1389
+ readonly mesh_split_polyline: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1208
1390
  readonly mesh_surface_difference_all: (a: number, b: number, c: number, d: number) => [number, number];
1209
1391
  readonly mesh_surface_split: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1210
1392
  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 +1394,10 @@ export interface InitOutput {
1212
1394
  readonly mesh_topology_metrics_raw: (a: number, b: number, c: number) => [number, number];
1213
1395
  readonly mesh_translate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1214
1396
  readonly nurbs_curve_curve_intersect: (a: number, b: number, c: number, d: number) => [number, number];
1397
+ readonly nurbs_curve_curve_intersect_params: (a: number, b: number, c: number, d: number) => [number, number];
1215
1398
  readonly nurbs_curve_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1399
+ readonly nurbs_curve_split_at_params: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1400
+ readonly nurbs_curve_surface_intersect_exact: (a: number, b: number, c: number, d: number) => [number, number];
1216
1401
  readonly nurbs_surface_closest_point: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1217
1402
  readonly nurbs_surface_curvature: (a: number, b: number, c: number, d: number) => [number, number];
1218
1403
  readonly nurbs_surface_derivatives: (a: number, b: number, c: number, d: number) => [number, number];
@@ -1229,6 +1414,7 @@ export interface InitOutput {
1229
1414
  readonly nurbs_surface_ruled: (a: number, b: number, c: number, d: number) => [number, number];
1230
1415
  readonly nurbs_surface_split: (a: number, b: number, c: number, d: number) => [number, number];
1231
1416
  readonly nurbs_surface_surface_intersect: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1417
+ readonly nurbs_surface_surface_intersect_curves: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1232
1418
  readonly nurbs_surface_tessellate_adaptive: (a: number, b: number, c: number, d: number) => [number, number];
1233
1419
  readonly nurbs_surface_tessellate_render: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1234
1420
  readonly offset_polycurve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];