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
@@ -0,0 +1,2664 @@
1
+ /**
2
+ * Get the length of an arc.
3
+ * @param {number} radius
4
+ * @param {number} start_angle
5
+ * @param {number} end_angle
6
+ * @returns {number}
7
+ */
8
+ export function arc_length(radius: number, start_angle: number, end_angle: number): number;
9
+ /**
10
+ * Evaluate a point on an arc at parameter t ∈ [0,1].
11
+ * Returns [x, y, z].
12
+ * @param {number} cx
13
+ * @param {number} cy
14
+ * @param {number} cz
15
+ * @param {number} nx
16
+ * @param {number} ny
17
+ * @param {number} nz
18
+ * @param {number} radius
19
+ * @param {number} start_angle
20
+ * @param {number} end_angle
21
+ * @param {number} t
22
+ * @returns {Float64Array}
23
+ */
24
+ export function arc_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, start_angle: number, end_angle: number, t: number): Float64Array;
25
+ /**
26
+ * Parametric BREP boolean: exact surface–surface intersection curves with
27
+ * trimmed-surface output. Operands may be closed solids OR open sheets —
28
+ * the kernel dispatches on closedness (oriented-sheet convention: a sheet's
29
+ * "inside" is the FRONT of its normal):
30
+ * - closed × closed: full volumetric boolean.
31
+ * - sheet × solid: subtract keeps the sheet outside the solid, intersect
32
+ * keeps the inside.
33
+ * - solid × sheet: subtract keeps the capped half BEHIND the sheet normal,
34
+ * intersect the front half.
35
+ * - sheet × sheet: a sheet's material is its FRONT half-space, so union
36
+ * stitches A-BACK + B-BACK at the intersection edges (front pieces are
37
+ * interior to the union material; uncut pieces are kept, coincident
38
+ * overlaps keep A's copy); subtract keeps A's back pieces; intersect
39
+ * A's front pieces.
40
+ * - union of a solid and a sheet is not defined and returns an error.
41
+ * op: "union" | "intersect" | "subtract".
42
+ * Returns the result BREP as JSON, or {"error": "..."} on failure.
43
+ * @param {string} a_json
44
+ * @param {string} b_json
45
+ * @param {string} op
46
+ * @param {number} tolerance
47
+ * @returns {string}
48
+ */
49
+ export function brep_boolean_op(a_json: string, b_json: string, op: string, tolerance: number): string;
50
+ /**
51
+ * Boolean-intersection clip of an exact NURBS curve against a CLOSED solid
52
+ * BREP: the curve is split exactly (knot insertion) at every boundary
53
+ * crossing and each piece is classified by containment. Every returned
54
+ * piece lies exactly on the input curve; closed curves merge the run
55
+ * spanning the parameter seam (same convention as `mesh_clip_polyline`).
56
+ *
57
+ * Packing: `[insideCount, (bufLen, curveData…)·insideCount,
58
+ * outsideCount, (bufLen, curveData…)·outsideCount]` — two concatenated
59
+ * multi-curve packings, inside pieces first. Returns an empty buffer on
60
+ * failure (malformed input, or a BREP that is not a closed solid).
61
+ * @param {Float64Array} curve_data
62
+ * @param {string} brep_json
63
+ * @returns {Float64Array}
64
+ */
65
+ export function brep_clip_curve_op(curve_data: Float64Array, brep_json: string): Float64Array;
66
+ /**
67
+ * Closest BREP face to a 3D point. Returns [faceIndex, u, v, distance,
68
+ * isNurbs] ((u, v) in the surface's KNOT domain) or empty on failure.
69
+ * @param {string} json
70
+ * @param {number} x
71
+ * @param {number} y
72
+ * @param {number} z
73
+ * @returns {Float64Array}
74
+ */
75
+ export function brep_closest_face(json: string, x: number, y: number, z: number): Float64Array;
76
+ /**
77
+ * Find all points where a NURBS curve pierces a BREP's faces: per face, the
78
+ * curve is intersected with the EXACT surface and kept only when the hit
79
+ * lies INSIDE the face's trimmed region; crossings on shared edges are
80
+ * deduplicated (smallest face index kept).
81
+ *
82
+ * `curve_data` is the standard NURBS curve encoding. Hits are sorted by
83
+ * curve parameter (normalized [0, 1]); (u, v) are in the face's OWN
84
+ * parameter space (knot domain for NURBS faces, plane-frame coordinates for
85
+ * planar faces).
86
+ *
87
+ * Packing: `[count, (x, y, z, curveParam, faceIndex, u, v)·count]`.
88
+ * Returns an empty buffer on malformed input.
89
+ * @param {string} brep_json
90
+ * @param {Float64Array} curve_data
91
+ * @returns {Float64Array}
92
+ */
93
+ export function brep_curve_intersection_op(brep_json: string, curve_data: Float64Array): Float64Array;
94
+ /**
95
+ * All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
96
+ * @param {string} json
97
+ * @param {number} tolerance
98
+ * @returns {Float64Array}
99
+ */
100
+ export function brep_edges(json: string, tolerance: number): Float64Array;
101
+ /**
102
+ * Extract one face as a standalone single-face TRIMMED sheet BREP (trim
103
+ * loops, pcurves, edges and vertices preserved). Returns JSON, empty on
104
+ * failure.
105
+ * @param {string} json
106
+ * @param {number} face_index
107
+ * @returns {string}
108
+ */
109
+ export function brep_extract_face(json: string, face_index: number): string;
110
+ /**
111
+ * ALL faces as standalone single-face trimmed sheet BREPs, in one crossing
112
+ * (the source JSON is parsed once). Returns a JSON ARRAY aligned with face
113
+ * indices; faces that fail to extract are `null`.
114
+ * @param {string} json
115
+ * @returns {string}
116
+ */
117
+ export function brep_extract_faces(json: string): string;
118
+ /**
119
+ * Extrude a profile curve into a BREP (closed profile → capped solid,
120
+ * open profile → sheet). Returns JSON.
121
+ * @param {Float64Array} curve_data
122
+ * @param {number} dx
123
+ * @param {number} dy
124
+ * @param {number} dz
125
+ * @param {number} height
126
+ * @returns {string}
127
+ */
128
+ export function brep_extrude_curve(curve_data: Float64Array, dx: number, dy: number, dz: number, height: number): string;
129
+ /**
130
+ * Exact (u, v) of a point on a specific BREP face (closest-point Newton for
131
+ * NURBS, frame projection for planes). Returns [u, v, distance, isNurbs].
132
+ * @param {string} json
133
+ * @param {number} face_index
134
+ * @param {number} x
135
+ * @param {number} y
136
+ * @param {number} z
137
+ * @returns {Float64Array}
138
+ */
139
+ export function brep_face_closest_uv(json: string, face_index: number, x: number, y: number, z: number): Float64Array;
140
+ /**
141
+ * Iso-parametric curve of a NURBS face's backing surface (untrimmed).
142
+ * Returns curve data, or empty for planar faces.
143
+ * @param {string} json
144
+ * @param {number} face_index
145
+ * @param {number} t
146
+ * @param {boolean} u_dir
147
+ * @returns {Float64Array}
148
+ */
149
+ export function brep_face_iso_curve(json: string, face_index: number, t: number, u_dir: boolean): Float64Array;
150
+ /**
151
+ * Exact isocurve(s) of a BREP face at KNOT-domain parameter `t`, CLIPPED to
152
+ * the face's trimmed region. `u_dir = true` runs along u at fixed v = t.
153
+ * Line pieces (planar faces) are encoded as degree-1 NURBS.
154
+ * Packing: [curveCount, (bufLen, curveData…)·curveCount] where curveData is
155
+ * the standard NURBS curve encoding.
156
+ * @param {string} json
157
+ * @param {number} face_index
158
+ * @param {number} t
159
+ * @param {boolean} u_dir
160
+ * @returns {Float64Array}
161
+ */
162
+ export function brep_face_iso_curves_trimmed(json: string, face_index: number, t: number, u_dir: boolean): Float64Array;
163
+ /**
164
+ * Like `brep_face_iso_curves_trimmed`, but `t` is NORMALIZED [0, 1] across
165
+ * the face's trim extent in the fixed direction — callers don't need the
166
+ * surface knot domain. Same packing.
167
+ * @param {string} json
168
+ * @param {number} face_index
169
+ * @param {number} t
170
+ * @param {boolean} u_dir
171
+ * @returns {Float64Array}
172
+ */
173
+ export function brep_face_iso_curves_trimmed_normalized(json: string, face_index: number, t: number, u_dir: boolean): Float64Array;
174
+ /**
175
+ * Geometric backing of a face.
176
+ * Returns [0, ox,oy,oz, ux,uy,uz, vx,vy,vz] for planes,
177
+ * or [1, surface_data...] for NURBS faces.
178
+ * @param {string} json
179
+ * @param {number} face_index
180
+ * @returns {Float64Array}
181
+ */
182
+ export function brep_face_surface(json: string, face_index: number): Float64Array;
183
+ /**
184
+ * Underlying surface of a face CROPPED to its trim extent, ALWAYS as a NURBS
185
+ * surface (planar faces become exact degree-1 patches). Returns surface
186
+ * data, empty on failure.
187
+ * @param {string} json
188
+ * @param {number} face_index
189
+ * @returns {Float64Array}
190
+ */
191
+ export function brep_face_surface_cropped(json: string, face_index: number): Float64Array;
192
+ /**
193
+ * Batch variant of `brep_face_surface_cropped` for all faces in one
194
+ * crossing. Packing: [faceCount, (bufLen, surfaceData…)·faceCount], aligned
195
+ * with face indices — a face that fails to crop gets bufLen 0.
196
+ * @param {string} json
197
+ * @returns {Float64Array}
198
+ */
199
+ export function brep_face_surfaces_cropped(json: string): Float64Array;
200
+ /**
201
+ * Tessellate a single BREP face. Returns the standard mesh buffer.
202
+ * @param {string} json
203
+ * @param {number} face_index
204
+ * @param {number} tolerance
205
+ * @returns {Float64Array}
206
+ */
207
+ export function brep_face_tessellate(json: string, face_index: number, tolerance: number): Float64Array;
208
+ /**
209
+ * UV bounding box of a face's trim loops in surface parameter space:
210
+ * [u_min, u_max, v_min, v_max]. Empty on failure.
211
+ * @param {string} json
212
+ * @param {number} face_index
213
+ * @returns {Float64Array}
214
+ */
215
+ export function brep_face_trim_bounds(json: string, face_index: number): Float64Array;
216
+ /**
217
+ * Convert a closed manifold triangle mesh into a planar-face BREP.
218
+ * `normal_angle_tol_deg` ≤ 0 selects the default (≈0.057°); `max_faces` 0 =
219
+ * default guard (4096). Returns BREP JSON or {"error": ...}.
220
+ * @param {number} vertex_count
221
+ * @param {Float64Array} buffer
222
+ * @param {number} normal_angle_tol_deg
223
+ * @param {number} max_faces
224
+ * @returns {string}
225
+ */
226
+ export function brep_from_mesh_buffer(vertex_count: number, buffer: Float64Array, normal_angle_tol_deg: number, max_faces: number): string;
227
+ /**
228
+ * BREP structure summary: [face_count, edge_count, vertex_count, is_closed].
229
+ * @param {string} json
230
+ * @returns {Float64Array}
231
+ */
232
+ export function brep_info(json: string): Float64Array;
233
+ /**
234
+ * [`brep_intersection_curves_op`] with the per-face-pair pieces JOINED into
235
+ * maximal curves: greedy reversal-aware endpoint chaining, exact degree
236
+ * elevation to the chain maximum, exact `join_arcs` knot concatenation
237
+ * (junction multiplicity = degree, no re-parameterization), and a per-curve
238
+ * verification gate (dense samples within 5·tolerance of BOTH operands'
239
+ * surfaces — a chain failing the gate comes back unjoined, never corrupted).
240
+ * A closed intersection loop (e.g. plane through a cylinder) comes back as
241
+ * ONE closed curve.
242
+ *
243
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
244
+ * curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
245
+ * a pipeline error) — distinguishable from `[0]`, which means the operands
246
+ * genuinely do not intersect.
247
+ * @param {string} a_json
248
+ * @param {string} b_json
249
+ * @param {number} tolerance
250
+ * @returns {Float64Array}
251
+ */
252
+ export function brep_intersection_curves_joined_op(a_json: string, b_json: string, tolerance: number): Float64Array;
253
+ /**
254
+ * TRIM-EXACT intersection curves between two BREPs (solids OR sheets): the
255
+ * parametric boolean's SSI → clip → convergence stages run and the fitted 3D
256
+ * intersection edges come back WITHOUT classification/assembly.
257
+ *
258
+ * A closed intersection loop may come back as several contiguous pieces
259
+ * (split at surface seams and face-boundary crossings); the pieces chain
260
+ * end-to-end exactly. Coincident (overlapping) face pairs contribute no
261
+ * curves.
262
+ *
263
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
264
+ * curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
265
+ * a pipeline error) — distinguishable from `[0]`, which means the operands
266
+ * genuinely do not intersect.
267
+ * @param {string} a_json
268
+ * @param {string} b_json
269
+ * @param {number} tolerance
270
+ * @returns {Float64Array}
271
+ */
272
+ export function brep_intersection_curves_op(a_json: string, b_json: string, tolerance: number): Float64Array;
273
+ /**
274
+ * Loft through profile curves into a BREP.
275
+ * Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
276
+ * @param {Float64Array} data
277
+ * @returns {string}
278
+ */
279
+ export function brep_loft_curves(data: Float64Array): string;
280
+ /**
281
+ * Intersection curves between a BREP and a triangle mesh.
282
+ *
283
+ * TESSELLATION-BASED (documented approximation): the BREP is tessellated at
284
+ * `tolerance` (pass `<= 0` for the deterministic auto display tolerance)
285
+ * and intersected with the mesh via BVH-pruned tri-tri crossing + chaining.
286
+ *
287
+ * Mesh input is the standard `[vertexCount, positions..., indices...]`
288
+ * buffer. Returns the standard polyline group packing
289
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]`; empty on failure.
290
+ * @param {string} brep_json
291
+ * @param {number} vertex_count
292
+ * @param {Float64Array} mesh_buffer
293
+ * @param {number} tolerance
294
+ * @returns {Float64Array}
295
+ */
296
+ export function brep_mesh_intersection_curves_op(brep_json: string, vertex_count: number, mesh_buffer: Float64Array, tolerance: number): Float64Array;
297
+ /**
298
+ * BREP primitives.
299
+ * kind: "box" [minx,miny,minz, maxx,maxy,maxz]
300
+ * "cylinder" [bx,by,bz, ax,ay,az, radius, height]
301
+ * "sphere" [cx,cy,cz, radius]
302
+ * "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
303
+ * "torus" [cx,cy,cz, major, minor]
304
+ * Returns the BREP as JSON ("" on failure).
305
+ * @param {string} kind
306
+ * @param {Float64Array} params
307
+ * @returns {string}
308
+ */
309
+ export function brep_primitive(kind: string, params: Float64Array): string;
310
+ /**
311
+ * Rebuild every NURBS face surface of a BREP with the given degrees and
312
+ * control counts, preserving each face's parameter domain so trims and
313
+ * edges stay coherent. Each face replacement is gated by `tolerance`
314
+ * (non-positive = accept all fits); planar faces pass through untouched.
315
+ * Returns JSON `{"maxDeviation": .., "rebuiltFaces": .., "skippedFaces": ..,
316
+ * "planarFaces": .., "brep": {...}}` or `{"error": "..."}`.
317
+ * @param {string} json
318
+ * @param {number} degree_u
319
+ * @param {number} degree_v
320
+ * @param {number} count_u
321
+ * @param {number} count_v
322
+ * @param {number} tolerance
323
+ * @returns {string}
324
+ */
325
+ export function brep_rebuild_surfaces(json: string, degree_u: number, degree_v: number, count_u: number, count_v: number, tolerance: number): string;
326
+ /**
327
+ * Revolve a profile curve into a BREP. Returns JSON.
328
+ * @param {Float64Array} curve_data
329
+ * @param {number} ox
330
+ * @param {number} oy
331
+ * @param {number} oz
332
+ * @param {number} ax
333
+ * @param {number} ay
334
+ * @param {number} az
335
+ * @param {number} angle
336
+ * @returns {string}
337
+ */
338
+ export function brep_revolve_curve(curve_data: Float64Array, ox: number, oy: number, oz: number, ax: number, ay: number, az: number, angle: number): string;
339
+ /**
340
+ * Untrimmed sheet BREP from a NURBS surface. Returns JSON.
341
+ * @param {Float64Array} surface_data
342
+ * @returns {string}
343
+ */
344
+ export function brep_sheet_from_surface(surface_data: Float64Array): string;
345
+ /**
346
+ * Split an OPEN sheet BREP `a` by another OPEN sheet BREP `b`.
347
+ * Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
348
+ * `inside` = a's pieces in FRONT of b's oriented normal, `outside` = the
349
+ * pieces behind it (matching the oriented-sheet convention of
350
+ * `mesh_clip_polyline` and the sheet boolean dispatch).
351
+ * @param {string} a_json
352
+ * @param {string} b_json
353
+ * @param {number} tolerance
354
+ * @returns {string}
355
+ */
356
+ export function brep_split_sheet_by_sheet_op(a_json: string, b_json: string, tolerance: number): string;
357
+ /**
358
+ * Split an OPEN sheet BREP by a CLOSED solid BREP into containment sides.
359
+ * Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
360
+ * `inside` = the sheet pieces contained in the solid (ON-boundary pieces
361
+ * count as inside), `outside` = the rest. Both preserve the sheet's exact
362
+ * trimmed faces, pcurves and edges.
363
+ * @param {string} sheet_json
364
+ * @param {string} solid_json
365
+ * @param {number} tolerance
366
+ * @returns {string}
367
+ */
368
+ export function brep_split_sheet_by_solid_op(sheet_json: string, solid_json: string, tolerance: number): string;
369
+ /**
370
+ * Split a closed solid BREP by a sheet BREP into BOTH capped halves.
371
+ * Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
372
+ * Sides follow the sheet normal (negative = behind it), matching
373
+ * `mesh_solid_split_by_surface`.
374
+ * @param {string} solid_json
375
+ * @param {string} sheet_json
376
+ * @param {number} tolerance
377
+ * @returns {string}
378
+ */
379
+ export function brep_split_solid_by_sheet_op(solid_json: string, sheet_json: string, tolerance: number): string;
380
+ /**
381
+ * Tessellate a BREP into the standard mesh buffer
382
+ * [vertexCount, positions..., indices...]. Crack-free across shared edges.
383
+ * @param {string} json
384
+ * @param {number} tolerance
385
+ * @returns {Float64Array}
386
+ */
387
+ export function brep_tessellate(json: string, tolerance: number): Float64Array;
388
+ /**
389
+ * Tessellate a BREP with per-face triangle ranges for face-level picking.
390
+ * `tolerance <= 0` selects the deterministic auto display tolerance (from the
391
+ * BREP's own extent), so triangle indices from a previously produced
392
+ * auto-tolerance display mesh stay valid across calls.
393
+ * Packing: [vertexCount, indexCount, rangeCount,
394
+ * positions(3·vc), indices(ic), (face, firstTri, triCount)·rc].
395
+ * @param {string} json
396
+ * @param {number} tolerance
397
+ * @returns {Float64Array}
398
+ */
399
+ export function brep_tessellate_with_face_ranges(json: string, tolerance: number): Float64Array;
400
+ /**
401
+ * Apply a row-major 4x4 matrix to a BREP. Returns transformed JSON.
402
+ * @param {string} json
403
+ * @param {Float64Array} matrix
404
+ * @returns {string}
405
+ */
406
+ export function brep_transform(json: string, matrix: Float64Array): string;
407
+ /**
408
+ * Validate a BREP. Returns a JSON report:
409
+ * {"isClosed":bool,"boundaryEdgeCount":n,"maxCoherenceError":e,"issues":[...]}
410
+ * @param {string} json
411
+ * @param {number} tolerance
412
+ * @returns {string}
413
+ */
414
+ export function brep_validate(json: string, tolerance: number): string;
415
+ /**
416
+ * Volume and surface area from tessellation: [volume, area].
417
+ * @param {string} json
418
+ * @param {number} tolerance
419
+ * @returns {Float64Array}
420
+ */
421
+ export function brep_volume_area(json: string, tolerance: number): Float64Array;
422
+ /**
423
+ * Wireframe of the whole BREP in ONE crossing: per face, `u_count` +
424
+ * `v_count` iso-parametric curves at evenly spaced INTERIOR normalized
425
+ * parameters, clipped to each face's trimmed region. The body JSON is
426
+ * parsed ONCE for the entire sweep. Same packing as
427
+ * `brep_face_iso_curves_trimmed_normalized`; faces that fail to evaluate
428
+ * are skipped atomically.
429
+ * @param {string} json
430
+ * @param {number} u_count
431
+ * @param {number} v_count
432
+ * @returns {Float64Array}
433
+ */
434
+ export function brep_wireframe_curves(json: string, u_count: number, v_count: number): Float64Array;
435
+ /**
436
+ * Build a NURBS curve from raw control points with kernel-managed knots and weights.
437
+ *
438
+ * * `degree` - Requested degree (clamped to the valid range for the point count)
439
+ * * `coords` - Flat control points [x,y,z, x,y,z, ...]. For closed curves the
440
+ * first point must NOT be repeated at the end.
441
+ * * `closed` - When true, builds a periodic (C^{degree-1}) closed loop;
442
+ * otherwise a clamped curve interpolating the first/last control points.
443
+ *
444
+ * Returns the encoded curve [degree, num_cp, cp_xyz..., weights..., knots...]
445
+ * (the same format consumed by `sample_nurbs_curve` / `evaluate_nurbs_curve_at`),
446
+ * or an empty buffer on failure.
447
+ * @param {number} degree
448
+ * @param {Float64Array} coords
449
+ * @param {boolean} closed
450
+ * @returns {Float64Array}
451
+ */
452
+ export function build_nurbs_curve(degree: number, coords: Float64Array, closed: boolean): Float64Array;
453
+ /**
454
+ * Chamfer corners of a polyline by cutting each corner with a straight segment.
455
+ * Input: flat coords [x1,y1,z1, ...], distance from corner to cut.
456
+ * Output: encoded polycurve segments [segment_count, type, ...data, ...]
457
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
458
+ * @param {Float64Array} coords
459
+ * @param {number} distance
460
+ * @returns {Float64Array}
461
+ */
462
+ export function chamfer_polycurve(coords: Float64Array, distance: number): Float64Array;
463
+ /**
464
+ * Chamfer polyline corners with closed support and optional corner
465
+ * selection. `coords` is a flat point list (closed inputs without the
466
+ * duplicate seam point); `corner_indices` empty = all eligible corners.
467
+ * Returns the flat chamfered point list (closed outputs again without the
468
+ * seam duplicate), or empty on failure (see `geometry_last_error`).
469
+ * @param {Float64Array} coords
470
+ * @param {boolean} closed
471
+ * @param {number} distance
472
+ * @param {Float64Array} corner_indices
473
+ * @returns {Float64Array}
474
+ */
475
+ export function chamfer_polyline_corners(coords: Float64Array, closed: boolean, distance: number, corner_indices: Float64Array): Float64Array;
476
+ /**
477
+ * Get the circumference of a circle.
478
+ * @param {number} radius
479
+ * @returns {number}
480
+ */
481
+ export function circle_length(radius: number): number;
482
+ /**
483
+ * Evaluate a point on a circle at parameter t ∈ [0,1].
484
+ * Returns [x, y, z].
485
+ * @param {number} cx
486
+ * @param {number} cy
487
+ * @param {number} cz
488
+ * @param {number} nx
489
+ * @param {number} ny
490
+ * @param {number} nz
491
+ * @param {number} radius
492
+ * @param {number} t
493
+ * @returns {Float64Array}
494
+ */
495
+ export function circle_point_at(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, t: number): Float64Array;
496
+ /**
497
+ * Create an arc and return sampled points
498
+ * @param {number} cx
499
+ * @param {number} cy
500
+ * @param {number} cz
501
+ * @param {number} nx
502
+ * @param {number} ny
503
+ * @param {number} nz
504
+ * @param {number} radius
505
+ * @param {number} start_angle
506
+ * @param {number} end_angle
507
+ * @param {number} samples
508
+ * @returns {Float64Array}
509
+ */
510
+ export function create_arc(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, start_angle: number, end_angle: number, samples: number): Float64Array;
511
+ /**
512
+ * Create a circle and return sampled points
513
+ * @param {number} cx
514
+ * @param {number} cy
515
+ * @param {number} cz
516
+ * @param {number} nx
517
+ * @param {number} ny
518
+ * @param {number} nz
519
+ * @param {number} radius
520
+ * @param {number} samples
521
+ * @returns {Float64Array}
522
+ */
523
+ export function create_circle(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, samples: number): Float64Array;
524
+ /**
525
+ * Create a line segment and return sampled points
526
+ * @param {number} x1
527
+ * @param {number} y1
528
+ * @param {number} z1
529
+ * @param {number} x2
530
+ * @param {number} y2
531
+ * @param {number} z2
532
+ * @param {number} samples
533
+ * @returns {Float64Array}
534
+ */
535
+ export function create_line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, samples: number): Float64Array;
536
+ /**
537
+ * Create a polyline and return the points
538
+ * @param {Float64Array} coords
539
+ * @param {number} samples_per_segment
540
+ * @returns {Float64Array}
541
+ */
542
+ export function create_polyline(coords: Float64Array, samples_per_segment: number): Float64Array;
543
+ /**
544
+ * 2D REGION boolean between two CLOSED, COPLANAR curves (Rhino CurveBoolean).
545
+ *
546
+ * Both inputs are standard NURBS curve encodings (the TS layer coerces
547
+ * circles/arcs/polylines/polycurves to exact NURBS first). The curves are
548
+ * projected onto a common plane (fitted from A, coplanarity verified),
549
+ * tessellated to polygons, arranged in 2D, classified by inside-A/inside-B
550
+ * (nonzero winding), and the result loops emitted per op. CLOSURE is
551
+ * verified kernel-side: each curve's endpoints must coincide within a
552
+ * scale-relative tolerance, open curves error out (never silently
553
+ * chord-closed).
554
+ *
555
+ * `op`: 0 = union, 1 = subtract (A − B), 2 = intersect.
556
+ *
557
+ * Result loops are POLYLINE (degree-1 NURBS) closed curves — Rhino-parity
558
+ * fidelity. Tessellation samples include every distinct interior knot value,
559
+ * so degree-1 polygon corners and C0 kinks are preserved EXACTLY, and
560
+ * consecutive collinear points are collapsed so straight runs come back as
561
+ * single segments. Outer boundaries are CCW (positive plane-signed area),
562
+ * holes CW. CCW is measured about a DETERMINISTIC plane normal: the normal
563
+ * fitted from curve A, flipped so its dominant world-axis component is
564
+ * positive (for XY-plane curves the reference is +Z). The orientation is
565
+ * therefore independent of the inputs' drawing direction. Callers
566
+ * reconstruct nesting from the winding sign.
567
+ *
568
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (same multi-curve
569
+ * packing as `nurbs_curve_split_at_params`). An EMPTY buffer signals an error
570
+ * (non-coplanar / open input / malformed input); a valid but EMPTY result
571
+ * (e.g. disjoint intersect) is the non-empty `[0]` packing.
572
+ * @param {Float64Array} a_data
573
+ * @param {Float64Array} b_data
574
+ * @param {number} op
575
+ * @returns {Float64Array}
576
+ */
577
+ export function curve_region_boolean(a_data: Float64Array, b_data: Float64Array, op: number): Float64Array;
578
+ /**
579
+ * SPLIT two CLOSED, COPLANAR curves into ALL region boundaries (Rhino
580
+ * "region split"): the arrangement of A and B partitions the plane into the
581
+ * pieces inside-A-only, inside-B-only and inside-both; each bounded region's
582
+ * outer and hole loops are returned as their own closed curves.
583
+ *
584
+ * Inputs, plane/coplanarity handling, fidelity and orientation follow
585
+ * `curve_region_boolean`. Same multi-curve packing; empty buffer on error.
586
+ * @param {Float64Array} a_data
587
+ * @param {Float64Array} b_data
588
+ * @returns {Float64Array}
589
+ */
590
+ export function curve_region_split(a_data: Float64Array, b_data: Float64Array): Float64Array;
591
+ /**
592
+ * Serialize a curve to a list of points for Three.js rendering
593
+ * Returns a flat array of coordinates: [x1, y1, z1, x2, y2, z2, ...]
594
+ * @param {string} curve_type
595
+ * @param {Float64Array} params
596
+ * @param {number} samples
597
+ * @returns {Float64Array}
598
+ */
599
+ export function curve_to_points(curve_type: string, params: Float64Array, samples: number): Float64Array;
600
+ /**
601
+ * Evaluate a NURBS curve at normalized parameter t in [0,1].
602
+ * Returns [x, y, z].
603
+ * @param {Float64Array} data
604
+ * @param {number} t
605
+ * @returns {Float64Array}
606
+ */
607
+ export function evaluate_nurbs_curve_at(data: Float64Array, t: number): Float64Array;
608
+ /**
609
+ * Extrude a circle and return mesh buffers
610
+ * @param {number} cx
611
+ * @param {number} cy
612
+ * @param {number} cz
613
+ * @param {number} nx
614
+ * @param {number} ny
615
+ * @param {number} nz
616
+ * @param {number} radius
617
+ * @param {number} dx
618
+ * @param {number} dy
619
+ * @param {number} dz
620
+ * @param {number} segments
621
+ * @param {boolean} with_caps
622
+ * @returns {Float64Array}
623
+ */
624
+ export function extrude_circle(cx: number, cy: number, cz: number, nx: number, ny: number, nz: number, radius: number, dx: number, dy: number, dz: number, segments: number, with_caps: boolean): Float64Array;
625
+ /**
626
+ * Extrude a line segment and return mesh buffers
627
+ * @param {number} x1
628
+ * @param {number} y1
629
+ * @param {number} z1
630
+ * @param {number} x2
631
+ * @param {number} y2
632
+ * @param {number} z2
633
+ * @param {number} dx
634
+ * @param {number} dy
635
+ * @param {number} dz
636
+ * @param {number} segments
637
+ * @returns {Float64Array}
638
+ */
639
+ export function extrude_line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, dx: number, dy: number, dz: number, segments: number): Float64Array;
640
+ /**
641
+ * Extrude a polyline and return mesh buffers.
642
+ * Uses the polyline's actual vertices (no resampling) to preserve sharp corners.
643
+ * @param {Float64Array} coords
644
+ * @param {number} dx
645
+ * @param {number} dy
646
+ * @param {number} dz
647
+ * @param {number} _segments
648
+ * @param {boolean} with_caps
649
+ * @returns {Float64Array}
650
+ */
651
+ export function extrude_polyline(coords: Float64Array, dx: number, dy: number, dz: number, _segments: number, with_caps: boolean): Float64Array;
652
+ /**
653
+ * Fillet corners of a polyline with arcs of a given radius.
654
+ * Input: flat coords [x1,y1,z1, ...], radius, plane normal (nx,ny,nz; 0,0,0 for auto).
655
+ * Output: encoded polycurve segments [segment_count, type, ...data, type, ...data, ...]
656
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
657
+ * type 1 = Arc: [cx,cy,cz, nx,ny,nz, radius, start_angle, end_angle]
658
+ * @param {Float64Array} coords
659
+ * @param {number} radius
660
+ * @param {number} nx
661
+ * @param {number} ny
662
+ * @param {number} nz
663
+ * @returns {Float64Array}
664
+ */
665
+ export function fillet_polycurve(coords: Float64Array, radius: number, nx: number, ny: number, nz: number): Float64Array;
666
+ /**
667
+ * Human-readable reason for the most recent empty result returned by the
668
+ * offset/chamfer exports below. Cleared at the start of each such call.
669
+ * @returns {string}
670
+ */
671
+ export function geometry_last_error(): string;
672
+ /**
673
+ * @param {number} num_threads
674
+ * @returns {Promise<any>}
675
+ */
676
+ export function initThreadPool(num_threads: number): Promise<any>;
677
+ /**
678
+ * Get the length of a line segment.
679
+ * @param {number} x1
680
+ * @param {number} y1
681
+ * @param {number} z1
682
+ * @param {number} x2
683
+ * @param {number} y2
684
+ * @param {number} z2
685
+ * @returns {number}
686
+ */
687
+ export function line_length(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number;
688
+ /**
689
+ * Offset a line segment perpendicular to line direction relative to reference normal.
690
+ * Returns [startX,startY,startZ,endX,endY,endZ]
691
+ * @param {number} x1
692
+ * @param {number} y1
693
+ * @param {number} z1
694
+ * @param {number} x2
695
+ * @param {number} y2
696
+ * @param {number} z2
697
+ * @param {number} distance
698
+ * @param {number} nx
699
+ * @param {number} ny
700
+ * @param {number} nz
701
+ * @returns {Float64Array}
702
+ */
703
+ export function line_offset(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, distance: number, nx: number, ny: number, nz: number): Float64Array;
704
+ /**
705
+ * Evaluate a point on a line segment at parameter t ∈ [0,1].
706
+ * Returns [x, y, z].
707
+ * @param {number} x1
708
+ * @param {number} y1
709
+ * @param {number} z1
710
+ * @param {number} x2
711
+ * @param {number} y2
712
+ * @param {number} z2
713
+ * @param {number} t
714
+ * @returns {Float64Array}
715
+ */
716
+ export function line_point_at(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, t: number): Float64Array;
717
+ /**
718
+ * Get the tangent direction of a line segment. Returns [x, y, z].
719
+ * @param {number} x1
720
+ * @param {number} y1
721
+ * @param {number} z1
722
+ * @param {number} x2
723
+ * @param {number} y2
724
+ * @param {number} z2
725
+ * @returns {Float64Array}
726
+ */
727
+ export function line_tangent(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): Float64Array;
728
+ /**
729
+ * Loft between multiple circles
730
+ *
731
+ * # Parameters
732
+ * * `circle_data` - Flat array of circle definitions [cx, cy, cz, nx, ny, nz, radius, ...]
733
+ * * `segments` - Number of segments to sample along each curve
734
+ * * `with_caps` - Whether to create end caps
735
+ *
736
+ * # Returns
737
+ * Mesh buffers for the lofted surface
738
+ * @param {Float64Array} circle_data
739
+ * @param {number} segments
740
+ * @param {boolean} with_caps
741
+ * @returns {Float64Array}
742
+ */
743
+ export function loft_circles(circle_data: Float64Array, segments: number, with_caps: boolean): Float64Array;
744
+ /**
745
+ * Loft a NURBS surface through multiple NURBS curves.
746
+ * Input: [num_curves, degree_v, curve1_data..., curve2_data..., ...]
747
+ * Each curve_data: [degree, num_pts, x,y,z,..., w0,w1,..., k0,k1,...]
748
+ * Returns the NurbsSurface data (same format as tessellate input, without u_segs/v_segs).
749
+ * @param {Float64Array} data
750
+ * @returns {Float64Array}
751
+ */
752
+ export function loft_nurbs_surface(data: Float64Array): Float64Array;
753
+ /**
754
+ * Loft between multiple polylines
755
+ *
756
+ * # Parameters
757
+ * * `polyline_data` - Flat array where each polyline is prefixed by its point count:
758
+ * [count1, x1, y1, z1, x2, y2, z2, ..., count2, x1, y1, z1, ...]
759
+ * * `_segments` - Ignored for polylines (kept for API compat). Points are used directly.
760
+ * * `with_caps` - Whether to create end caps (fan triangulation from center)
761
+ *
762
+ * # Returns
763
+ * Mesh buffers for the lofted surface
764
+ * @param {Float64Array} polyline_data
765
+ * @param {number} _segments
766
+ * @param {boolean} with_caps
767
+ * @returns {Float64Array}
768
+ */
769
+ export function loft_polylines(polyline_data: Float64Array, _segments: number, with_caps: boolean): Float64Array;
770
+ /**
771
+ * Loft between raw profile polylines with kernel-managed compatibility
772
+ * (resampling to a common count, seam alignment, direction matching).
773
+ *
774
+ * # Parameters
775
+ * * `profile_data` - Flat array where each profile is prefixed by its point count:
776
+ * [count1, x1, y1, z1, ..., count2, x1, y1, z1, ...]
777
+ * * `closed` - Whether profiles are closed loops (input must NOT repeat the
778
+ * first point). Closed profiles loft into a tube, open profiles into a sheet.
779
+ * * `with_caps` - Cap the first/last profiles (closed profiles only) to produce
780
+ * a watertight solid ready for booleans.
781
+ *
782
+ * # Returns
783
+ * Mesh buffers for the lofted surface (empty on failure)
784
+ * @param {Float64Array} profile_data
785
+ * @param {boolean} closed
786
+ * @param {boolean} with_caps
787
+ * @returns {Float64Array}
788
+ */
789
+ export function loft_profiles(profile_data: Float64Array, closed: boolean, with_caps: boolean): Float64Array;
790
+ /**
791
+ * Make multiple NURBS curves compatible (same knot vectors, same CP count).
792
+ * Input: [curve_count, curve1_data..., curve2_data..., ...]
793
+ * Each curve: [degree, num_cp, cp_xyz..., weights..., knots...]
794
+ * Output: same format with unified curves.
795
+ * @param {Float64Array} curves_data
796
+ * @returns {Float64Array}
797
+ */
798
+ export function make_nurbs_curves_compatible(curves_data: Float64Array): Float64Array;
799
+ /**
800
+ * Apply a 4x4 transformation matrix to a mesh.
801
+ * matrix: flat [m00,m01,m02,m03, m10,m11,..., m30,m31,m32,m33] (16 elements, row-major)
802
+ * @param {number} vertex_count
803
+ * @param {Float64Array} buffer
804
+ * @param {Float64Array} matrix
805
+ * @returns {Float64Array}
806
+ */
807
+ export function mesh_apply_matrix(vertex_count: number, buffer: Float64Array, matrix: Float64Array): Float64Array;
808
+ /**
809
+ * Subtract all cutter meshes from the host in one WASM call.
810
+ *
811
+ * `packed` layout matches `mesh_boolean_union_all`; the FIRST mesh is the
812
+ * host and every following mesh is a cutter.
813
+ * `flags`: `""` or `"trustedInput"`.
814
+ * Returns a standard result mesh buffer, or an empty vector on failure.
815
+ * @param {Float64Array} packed
816
+ * @param {string} flags
817
+ * @returns {Float64Array}
818
+ */
819
+ export function mesh_boolean_difference_all(packed: Float64Array, flags: string): Float64Array;
820
+ /**
821
+ * Perform boolean intersection on two meshes
822
+ * @param {number} vertex_count_a
823
+ * @param {Float64Array} buffer_a
824
+ * @param {number} vertex_count_b
825
+ * @param {Float64Array} buffer_b
826
+ * @returns {Float64Array}
827
+ */
828
+ export function mesh_boolean_intersection(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
829
+ /**
830
+ * Debug helper: run the live kernel-mesh boolean entrypoint and surface the
831
+ * exact error instead of collapsing it into an empty output buffer.
832
+ * @param {number} vertex_count_a
833
+ * @param {Float64Array} buffer_a
834
+ * @param {number} vertex_count_b
835
+ * @param {Float64Array} buffer_b
836
+ * @param {string} operation
837
+ * @returns {string}
838
+ */
839
+ export function mesh_boolean_kernel_mesh_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
840
+ /**
841
+ * @returns {number}
842
+ */
843
+ export function mesh_boolean_last_debug_marker(): number;
844
+ /**
845
+ * @param {number} vertex_count_a
846
+ * @param {Float64Array} buffer_a
847
+ * @param {number} vertex_count_b
848
+ * @param {Float64Array} buffer_b
849
+ * @param {string} operation
850
+ * @param {string} cleanup_stage
851
+ * @returns {string}
852
+ */
853
+ export function mesh_boolean_manifold_port_cleanup_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, cleanup_stage: string): string;
854
+ /**
855
+ * @param {number} vertex_count_a
856
+ * @param {Float64Array} buffer_a
857
+ * @param {number} vertex_count_b
858
+ * @param {Float64Array} buffer_b
859
+ * @param {string} operation
860
+ * @param {number} face_index
861
+ * @returns {string}
862
+ */
863
+ export function mesh_boolean_manifold_port_face2tri_face_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, face_index: number): string;
864
+ /**
865
+ * @param {number} vertex_count_a
866
+ * @param {Float64Array} buffer_a
867
+ * @param {number} vertex_count_b
868
+ * @param {Float64Array} buffer_b
869
+ * @param {string} operation
870
+ * @param {number} face_index
871
+ * @param {number} rotate_offset
872
+ * @param {boolean} reverse
873
+ * @returns {string}
874
+ */
875
+ export function mesh_boolean_manifold_port_face2tri_face_transform_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, face_index: number, rotate_offset: number, reverse: boolean): string;
876
+ /**
877
+ * @param {number} vertex_count_a
878
+ * @param {Float64Array} buffer_a
879
+ * @param {number} vertex_count_b
880
+ * @param {Float64Array} buffer_b
881
+ * @param {string} operation
882
+ * @returns {string}
883
+ */
884
+ export function mesh_boolean_manifold_port_final_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
885
+ /**
886
+ * @param {number} vertex_count_a
887
+ * @param {Float64Array} buffer_a
888
+ * @param {number} vertex_count_b
889
+ * @param {Float64Array} buffer_b
890
+ * @param {string} operation
891
+ * @returns {string}
892
+ */
893
+ export function mesh_boolean_manifold_port_flag_edge_attempts_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
894
+ /**
895
+ * @param {number} vertex_count_a
896
+ * @param {Float64Array} buffer_a
897
+ * @param {number} vertex_count_b
898
+ * @param {Float64Array} buffer_b
899
+ * @param {string} operation
900
+ * @returns {string}
901
+ */
902
+ export function mesh_boolean_manifold_port_intersections_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
903
+ /**
904
+ * @param {number} vertex_count_a
905
+ * @param {Float64Array} buffer_a
906
+ * @param {number} vertex_count_b
907
+ * @param {Float64Array} buffer_b
908
+ * @param {string} operation
909
+ * @param {number} face_p
910
+ * @param {number} face_q
911
+ * @returns {string}
912
+ */
913
+ export function mesh_boolean_manifold_port_new_edge_bucket_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, face_p: number, face_q: number): string;
914
+ /**
915
+ * @param {string} cleanup_stage
916
+ * @returns {string}
917
+ */
918
+ export function mesh_boolean_manifold_port_overlap_boxes_cleanup_triangle_dump(cleanup_stage: string): string;
919
+ /**
920
+ * @param {number} face_index
921
+ * @returns {string}
922
+ */
923
+ export function mesh_boolean_manifold_port_overlap_boxes_face2tri_face_debug(face_index: number): string;
924
+ /**
925
+ * @param {number} vertex_count_a
926
+ * @param {Float64Array} buffer_a
927
+ * @param {number} vertex_count_b
928
+ * @param {Float64Array} buffer_b
929
+ * @param {string} operation
930
+ * @param {number} face_index
931
+ * @returns {string}
932
+ */
933
+ export function mesh_boolean_manifold_port_raw_face_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, face_index: number): string;
934
+ /**
935
+ * @param {number} vertex_count_a
936
+ * @param {Float64Array} buffer_a
937
+ * @param {number} vertex_count_b
938
+ * @param {Float64Array} buffer_b
939
+ * @param {string} operation
940
+ * @returns {string}
941
+ */
942
+ export function mesh_boolean_manifold_port_short_edge_attempts_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
943
+ /**
944
+ * @param {number} vertex_count_a
945
+ * @param {Float64Array} buffer_a
946
+ * @param {number} vertex_count_b
947
+ * @param {Float64Array} buffer_b
948
+ * @param {string} operation
949
+ * @param {number} edge
950
+ * @returns {string}
951
+ */
952
+ export function mesh_boolean_manifold_port_single_swap_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string, edge: number): string;
953
+ /**
954
+ * Debug helper: run the isolated direct-port pipeline and surface stage counts
955
+ * so we can see where geometry diverges without involving legacy routing.
956
+ * @param {number} vertex_count_a
957
+ * @param {Float64Array} buffer_a
958
+ * @param {number} vertex_count_b
959
+ * @param {Float64Array} buffer_b
960
+ * @param {string} operation
961
+ * @returns {string}
962
+ */
963
+ export function mesh_boolean_manifold_port_stage_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
964
+ /**
965
+ * @param {number} vertex_count_a
966
+ * @param {Float64Array} buffer_a
967
+ * @param {number} vertex_count_b
968
+ * @param {Float64Array} buffer_b
969
+ * @param {string} operation
970
+ * @returns {string}
971
+ */
972
+ export function mesh_boolean_manifold_port_swappable_edges_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
973
+ /**
974
+ * @param {number} vertex_count_a
975
+ * @param {Float64Array} buffer_a
976
+ * @param {number} vertex_count_b
977
+ * @param {Float64Array} buffer_b
978
+ * @param {string} operation
979
+ * @returns {string}
980
+ */
981
+ export function mesh_boolean_manifold_port_triangulated_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
982
+ /**
983
+ * @param {number} vertex_count_a
984
+ * @param {Float64Array} buffer_a
985
+ * @param {number} vertex_count_b
986
+ * @param {Float64Array} buffer_b
987
+ * @param {string} operation
988
+ * @returns {Float64Array}
989
+ */
990
+ export function mesh_boolean_operation(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
991
+ /**
992
+ * Debug helper: perform boolean operation and return a textual status,
993
+ * including kernel error reason on failure.
994
+ * @param {number} vertex_count_a
995
+ * @param {Float64Array} buffer_a
996
+ * @param {number} vertex_count_b
997
+ * @param {Float64Array} buffer_b
998
+ * @param {string} operation
999
+ * @returns {string}
1000
+ */
1001
+ export function mesh_boolean_operation_debug(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
1002
+ /**
1003
+ * @param {number} vertex_count_a
1004
+ * @param {Float64Array} buffer_a
1005
+ * @param {number} vertex_count_b
1006
+ * @param {Float64Array} buffer_b
1007
+ * @param {string} operation
1008
+ * @returns {string}
1009
+ */
1010
+ export function mesh_boolean_port_triangle_dump(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): string;
1011
+ /**
1012
+ * @param {number} vertex_count_a
1013
+ * @param {Float64Array} buffer_a
1014
+ * @param {number} vertex_count_b
1015
+ * @param {Float64Array} buffer_b
1016
+ * @param {string} operation
1017
+ * @returns {Float64Array}
1018
+ */
1019
+ export function mesh_boolean_split(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
1020
+ /**
1021
+ * Perform boolean subtraction on two meshes (A - B)
1022
+ * @param {number} vertex_count_a
1023
+ * @param {Float64Array} buffer_a
1024
+ * @param {number} vertex_count_b
1025
+ * @param {Float64Array} buffer_b
1026
+ * @returns {Float64Array}
1027
+ */
1028
+ export function mesh_boolean_subtraction(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
1029
+ /**
1030
+ * Perform boolean operation and return stage-level profiling data followed by
1031
+ * the result mesh buffer.
1032
+ *
1033
+ * Output format:
1034
+ * [profile_len(=95), broadphase_ms, segments_ms, split_ms,
1035
+ * split_touched_faces_a, split_source_faces_a, split_touched_faces_b, split_source_faces_b,
1036
+ * classify_ms, classify_seed_ms, classify_strict_ms, classify_open_component_ms,
1037
+ * extract_ms, extract_primary_ms, extract_fallback_ms,
1038
+ * Perform boolean union on two meshes
1039
+ * @param {number} vertex_count_a
1040
+ * @param {Float64Array} buffer_a
1041
+ * @param {number} vertex_count_b
1042
+ * @param {Float64Array} buffer_b
1043
+ * @returns {Float64Array}
1044
+ */
1045
+ export function mesh_boolean_union(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array): Float64Array;
1046
+ /**
1047
+ * Union all meshes in the packed buffer into a single mesh in one WASM call.
1048
+ *
1049
+ * `packed` layout: `[meshCount, (bufferLen, [vertexCount, positions..., indices...])...]`.
1050
+ * `flags`: `""` or `"trustedInput"`.
1051
+ * Returns a standard result mesh buffer, or an empty vector on failure.
1052
+ * @param {Float64Array} packed
1053
+ * @param {string} flags
1054
+ * @returns {Float64Array}
1055
+ */
1056
+ export function mesh_boolean_union_all(packed: Float64Array, flags: string): Float64Array;
1057
+ /**
1058
+ * Flat 3D endpoints of every open boundary edge: `[x0,y0,z0, x1,y1,z1, ...]`,
1059
+ * six values per segment. Empty when the mesh is closed. Drives the red
1060
+ * "open edge" viewport highlight.
1061
+ * @param {number} vertex_count
1062
+ * @param {Float64Array} buffer
1063
+ * @returns {Float64Array}
1064
+ */
1065
+ export function mesh_boundary_edge_segments(vertex_count: number, buffer: Float64Array): Float64Array;
1066
+ /**
1067
+ * Handle variant of `mesh_boundary_edge_segments`.
1068
+ * @param {number} id
1069
+ * @returns {Float64Array}
1070
+ */
1071
+ export function mesh_boundary_edge_segments_h(id: number): Float64Array;
1072
+ /**
1073
+ * Extract boundary (perimeter) edges from a mesh as polylines.
1074
+ * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1075
+ * @param {number} vertex_count
1076
+ * @param {Float64Array} buffer
1077
+ * @returns {Float64Array}
1078
+ */
1079
+ export function mesh_boundary_polylines(vertex_count: number, buffer: Float64Array): Float64Array;
1080
+ /**
1081
+ * Coplanar connected face groups.
1082
+ * Output format:
1083
+ * [groupCount, triCount, tri..., centroidX,centroidY,centroidZ, normalX,normalY,normalZ, ...]
1084
+ * @param {number} vertex_count
1085
+ * @param {Float64Array} buffer
1086
+ * @returns {Float64Array}
1087
+ */
1088
+ export function mesh_build_coplanar_connected_face_groups(vertex_count: number, buffer: Float64Array): Float64Array;
1089
+ /**
1090
+ * Display-ready render buffers: creased (split) vertex normals plus feature
1091
+ * edges, computed in one pass. Replaces THREE's toCreasedNormals +
1092
+ * EdgesGeometry in app layers (orders of magnitude faster on large meshes).
1093
+ *
1094
+ * Output (f32-packed):
1095
+ * [vertexCount, positions (vertexCount*3), normals (vertexCount*3),
1096
+ * edgeSegmentCount, edgePositions (edgeSegmentCount*6)]
1097
+ * Vertices are non-indexed in input triangle order, so raycast face indices
1098
+ * against the source mesh stay valid.
1099
+ * @param {number} vertex_count
1100
+ * @param {Float64Array} buffer
1101
+ * @param {number} crease_angle_deg
1102
+ * @returns {Float32Array}
1103
+ */
1104
+ export function mesh_build_render_buffers(vertex_count: number, buffer: Float64Array, crease_angle_deg: number): Float32Array;
1105
+ /**
1106
+ * Handle variant of `mesh_build_render_buffers`.
1107
+ * @param {number} id
1108
+ * @param {number} crease_angle_deg
1109
+ * @returns {Float32Array}
1110
+ */
1111
+ export function mesh_build_render_buffers_h(id: number, crease_angle_deg: number): Float32Array;
1112
+ /**
1113
+ * Chamfer all edges of a primitive mesh (flat bevel)
1114
+ *
1115
+ * # Arguments
1116
+ * * `mesh_type` - "box", "cylinder", or "prism"
1117
+ * * `params` - Parameters: [width,height,depth] for box, [radius,height,segments] for cylinder/prism
1118
+ * * `offset` - Chamfer offset distance
1119
+ *
1120
+ * # Returns
1121
+ * Result mesh buffer [vertexCount, vertices..., indices...]
1122
+ * @param {string} mesh_type
1123
+ * @param {Float64Array} params
1124
+ * @param {number} offset
1125
+ * @returns {Float64Array}
1126
+ */
1127
+ export function mesh_chamfer_all_edges(mesh_type: string, params: Float64Array, offset: number): Float64Array;
1128
+ /**
1129
+ * Chamfer feature edges of a closed solid. `edges` is a flat buffer of
1130
+ * segment endpoint pairs [ax,ay,az,bx,by,bz, ...]; each picked segment
1131
+ * expands to its full feature-edge chain (straight box edges, tessellated
1132
+ * rims). `distance` is the setback along each adjacent face.
1133
+ * Returns a standard mesh buffer, or empty on failure (see
1134
+ * `geometry_last_error`).
1135
+ * @param {number} vertex_count
1136
+ * @param {Float64Array} buffer
1137
+ * @param {Float64Array} edges
1138
+ * @param {number} distance
1139
+ * @returns {Float64Array}
1140
+ */
1141
+ export function mesh_chamfer_edges(vertex_count: number, buffer: Float64Array, edges: Float64Array, distance: number): Float64Array;
1142
+ /**
1143
+ * Clip a polyline against a closed mesh volume (boolean intersection for curves).
1144
+ *
1145
+ * `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
1146
+ * (no duplicated seam point required, one is tolerated).
1147
+ * Returns two concatenated polyline buffers — inside pieces first, then
1148
+ * outside pieces — each encoded as [num_polylines, n1, x,y,z,..., ...].
1149
+ * Returns an empty buffer on failure (open cutter, degenerate polyline).
1150
+ * @param {number} vertex_count
1151
+ * @param {Float64Array} buffer
1152
+ * @param {Float64Array} points
1153
+ * @param {boolean} closed
1154
+ * @returns {Float64Array}
1155
+ */
1156
+ export function mesh_clip_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
1157
+ /**
1158
+ * Clip a polyline by an OPEN oriented sheet: split it at every sheet
1159
+ * crossing and classify each piece by the SIGNED SIDE of the sheet. This is
1160
+ * side classification, NOT containment (unlike `mesh_clip_polyline`, which
1161
+ * requires a closed volume): pieces far from the sheet still classify by
1162
+ * the nearest facet's normal. `inside` = the positive side, in FRONT of the
1163
+ * sheet normal; `outside` = behind it. The sheet may be any non-empty
1164
+ * triangle mesh, open or closed; its stored winding defines the normals.
1165
+ *
1166
+ * Returns two concatenated polyline buffers — inside pieces first, then
1167
+ * outside pieces — each encoded as `[num_polylines, n1, x,y,z,..., ...]`
1168
+ * (identical packing to `mesh_clip_polyline`). Returns an empty buffer on
1169
+ * failure (degenerate polyline/sheet).
1170
+ * @param {number} vertex_count
1171
+ * @param {Float64Array} buffer
1172
+ * @param {Float64Array} points
1173
+ * @param {boolean} closed
1174
+ * @returns {Float64Array}
1175
+ */
1176
+ export function mesh_clip_polyline_by_sheet(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
1177
+ /**
1178
+ * Compute planar curve normal from ordered points.
1179
+ * @param {Float64Array} coords
1180
+ * @param {boolean} closed
1181
+ * @returns {Float64Array}
1182
+ */
1183
+ export function mesh_compute_planar_curve_normal(coords: Float64Array, closed: boolean): Float64Array;
1184
+ /**
1185
+ * Odd/even mesh containment test.
1186
+ * @param {number} vertex_count
1187
+ * @param {Float64Array} buffer
1188
+ * @param {number} px
1189
+ * @param {number} py
1190
+ * @param {number} pz
1191
+ * @returns {boolean}
1192
+ */
1193
+ export function mesh_contains_point(vertex_count: number, buffer: Float64Array, px: number, py: number, pz: number): boolean;
1194
+ /**
1195
+ * Create a box mesh and return buffers
1196
+ * Returns [vertices..., indices...]
1197
+ * @param {number} width
1198
+ * @param {number} height
1199
+ * @param {number} depth
1200
+ * @returns {Float64Array}
1201
+ */
1202
+ export function mesh_create_box(width: number, height: number, depth: number): Float64Array;
1203
+ /**
1204
+ * Create a Manifold-aligned centered Z-axis cone mesh and return buffers
1205
+ * @param {number} radius
1206
+ * @param {number} height
1207
+ * @param {number} segments
1208
+ * @returns {Float64Array}
1209
+ */
1210
+ export function mesh_create_cone(radius: number, height: number, segments: number): Float64Array;
1211
+ /**
1212
+ * Create a Manifold-aligned centered Z-axis cylinder mesh and return buffers
1213
+ * @param {number} radius
1214
+ * @param {number} height
1215
+ * @param {number} segments
1216
+ * @returns {Float64Array}
1217
+ */
1218
+ export function mesh_create_cylinder(radius: number, height: number, segments: number): Float64Array;
1219
+ /**
1220
+ * Create a prism mesh and return buffers
1221
+ * @param {number} radius
1222
+ * @param {number} height
1223
+ * @param {number} sides
1224
+ * @returns {Float64Array}
1225
+ */
1226
+ export function mesh_create_prism(radius: number, height: number, sides: number): Float64Array;
1227
+ /**
1228
+ * Create a geodesic sphere mesh matching Manifold's sphere topology and return buffers
1229
+ * @param {number} radius
1230
+ * @param {number} segments
1231
+ * @param {number} rings
1232
+ * @returns {Float64Array}
1233
+ */
1234
+ export function mesh_create_sphere(radius: number, segments: number, rings: number): Float64Array;
1235
+ /**
1236
+ * Evaluate a point on a mesh surface at parametric coordinates (u, v).
1237
+ * Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
1238
+ * then casts a ray perpendicular to the best-fit projection plane.
1239
+ * Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
1240
+ * @param {number} vertex_count
1241
+ * @param {Float64Array} buffer
1242
+ * @param {number} u
1243
+ * @param {number} v
1244
+ * @returns {Float64Array}
1245
+ */
1246
+ export function mesh_evaluate(vertex_count: number, buffer: Float64Array, u: number, v: number): Float64Array;
1247
+ /**
1248
+ * Export a mesh to OBJ format
1249
+ * Takes the standard mesh buffer (`[vertexCount, ...positions, ...indices]`,
1250
+ * same format as `mesh_to_buffers` / `Mesh.rawBuffer`) and returns OBJ text.
1251
+ * @param {number} vertex_count
1252
+ * @param {Float64Array} buffer
1253
+ * @returns {string}
1254
+ */
1255
+ export function mesh_export_obj(vertex_count: number, buffer: Float64Array): string;
1256
+ /**
1257
+ * Export a mesh (standard buffer format) to ASCII STL text.
1258
+ * @param {number} vertex_count
1259
+ * @param {Float64Array} buffer
1260
+ * @param {string} name
1261
+ * @returns {string}
1262
+ */
1263
+ export function mesh_export_stl_ascii(vertex_count: number, buffer: Float64Array, name: string): string;
1264
+ /**
1265
+ * Export a mesh (standard buffer format) to binary STL bytes.
1266
+ * @param {number} vertex_count
1267
+ * @param {Float64Array} buffer
1268
+ * @returns {Uint8Array}
1269
+ */
1270
+ export function mesh_export_stl_binary(vertex_count: number, buffer: Float64Array): Uint8Array;
1271
+ /**
1272
+ * Push/pull a planar face set by moving its coplanar connected region.
1273
+ * @param {number} vertex_count
1274
+ * @param {Float64Array} buffer
1275
+ * @param {number} face_index
1276
+ * @param {number} distance
1277
+ * @returns {Float64Array}
1278
+ */
1279
+ export function mesh_extrude_face(vertex_count: number, buffer: Float64Array, face_index: number, distance: number): Float64Array;
1280
+ /**
1281
+ * Extrude planar curve profile by normal * height.
1282
+ * @param {Float64Array} coords
1283
+ * @param {number} nx
1284
+ * @param {number} ny
1285
+ * @param {number} nz
1286
+ * @param {number} height
1287
+ * @param {boolean} closed
1288
+ * @returns {Float64Array}
1289
+ */
1290
+ export function mesh_extrude_planar_curve(coords: Float64Array, nx: number, ny: number, nz: number, height: number, closed: boolean): Float64Array;
1291
+ /**
1292
+ * Feature-edge chains of a mesh for chamfer highlighting: every connected
1293
+ * chain of edges separating the same two smooth face groups — the exact
1294
+ * grouping `mesh_chamfer_edges` expands picks to, so highlighting a chain
1295
+ * shows precisely what one pick will chamfer. Packed as
1296
+ * `[chainCount, (closed, pointCount, x,y,z ...)...]`; closed chains omit the
1297
+ * duplicate seam point. A mesh with no feature edges returns `[0]`; an
1298
+ * invalid mesh returns an empty buffer (see `geometry_last_error`).
1299
+ * @param {number} vertex_count
1300
+ * @param {Float64Array} buffer
1301
+ * @returns {Float64Array}
1302
+ */
1303
+ export function mesh_feature_edge_chains(vertex_count: number, buffer: Float64Array): Float64Array;
1304
+ /**
1305
+ * Handle variant of `mesh_feature_edge_chains`.
1306
+ * @param {number} id
1307
+ * @returns {Float64Array}
1308
+ */
1309
+ export function mesh_feature_edge_chains_h(id: number): Float64Array;
1310
+ /**
1311
+ * Find the best matching coplanar connected face group by normal and optional near-point.
1312
+ * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
1313
+ * @param {number} vertex_count
1314
+ * @param {Float64Array} buffer
1315
+ * @param {number} nx
1316
+ * @param {number} ny
1317
+ * @param {number} nz
1318
+ * @param {number} near_x
1319
+ * @param {number} near_y
1320
+ * @param {number} near_z
1321
+ * @param {boolean} use_near_point
1322
+ * @returns {Float64Array}
1323
+ */
1324
+ export function mesh_find_face_group_by_normal(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, near_x: number, near_y: number, near_z: number, use_near_point: boolean): Float64Array;
1325
+ /**
1326
+ * Handle variant of `mesh_find_face_group_by_normal`.
1327
+ * @param {number} id
1328
+ * @param {number} nx
1329
+ * @param {number} ny
1330
+ * @param {number} nz
1331
+ * @param {number} near_x
1332
+ * @param {number} near_y
1333
+ * @param {number} near_z
1334
+ * @param {boolean} use_near_point
1335
+ * @returns {Float64Array}
1336
+ */
1337
+ export function mesh_find_face_group_by_normal_h(id: number, nx: number, ny: number, nz: number, near_x: number, near_y: number, near_z: number, use_near_point: boolean): Float64Array;
1338
+ /**
1339
+ * Find the coplanar connected face group containing triangle_index.
1340
+ * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
1341
+ * @param {number} vertex_count
1342
+ * @param {Float64Array} buffer
1343
+ * @param {number} triangle_index
1344
+ * @returns {Float64Array}
1345
+ */
1346
+ export function mesh_find_face_group_by_triangle_index(vertex_count: number, buffer: Float64Array, triangle_index: number): Float64Array;
1347
+ /**
1348
+ * Handle variant of `mesh_find_face_group_by_triangle_index`.
1349
+ * @param {number} id
1350
+ * @param {number} triangle_index
1351
+ * @returns {Float64Array}
1352
+ */
1353
+ export function mesh_find_face_group_by_triangle_index_h(id: number, triangle_index: number): Float64Array;
1354
+ /**
1355
+ * Axis-aligned bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
1356
+ * @param {number} vertex_count
1357
+ * @param {Float64Array} buffer
1358
+ * @returns {Float64Array}
1359
+ */
1360
+ export function mesh_get_bounds(vertex_count: number, buffer: Float64Array): Float64Array;
1361
+ /**
1362
+ * Coplanar connected face-group centroid containing a given triangle face index.
1363
+ * Output format: [x, y, z] or [] when unavailable.
1364
+ * @param {number} vertex_count
1365
+ * @param {Float64Array} buffer
1366
+ * @param {number} face_index
1367
+ * @returns {Float64Array}
1368
+ */
1369
+ export function mesh_get_coplanar_face_group_centroid(vertex_count: number, buffer: Float64Array, face_index: number): Float64Array;
1370
+ /**
1371
+ * Handle variant of `mesh_get_coplanar_face_group_centroid`.
1372
+ * @param {number} id
1373
+ * @param {number} face_index
1374
+ * @returns {Float64Array}
1375
+ */
1376
+ export function mesh_get_coplanar_face_group_centroid_h(id: number, face_index: number): Float64Array;
1377
+ /**
1378
+ * Edge-connected coplanar triangle indices as [count, i0, i1, ...].
1379
+ * @param {number} vertex_count
1380
+ * @param {Float64Array} buffer
1381
+ * @param {number} face_index
1382
+ * @returns {Float64Array}
1383
+ */
1384
+ export function mesh_get_coplanar_face_indices(vertex_count: number, buffer: Float64Array, face_index: number): Float64Array;
1385
+ /**
1386
+ * Handle variant of `mesh_get_coplanar_face_indices`.
1387
+ * @param {number} id
1388
+ * @param {number} face_index
1389
+ * @returns {Float64Array}
1390
+ */
1391
+ export function mesh_get_coplanar_face_indices_h(id: number, face_index: number): Float64Array;
1392
+ /**
1393
+ * Coplanar connected face region projected to a plane basis.
1394
+ * Output format:
1395
+ * [faceCount, faceIndex0, faceIndex1, ..., uMin, uMax, vMin, vMax]
1396
+ * @param {number} vertex_count
1397
+ * @param {Float64Array} buffer
1398
+ * @param {number} face_index
1399
+ * @param {number} ox
1400
+ * @param {number} oy
1401
+ * @param {number} oz
1402
+ * @param {number} ux
1403
+ * @param {number} uy
1404
+ * @param {number} uz
1405
+ * @param {number} vx
1406
+ * @param {number} vy
1407
+ * @param {number} vz
1408
+ * @param {number} margin_scale
1409
+ * @param {number} min_margin
1410
+ * @returns {Float64Array}
1411
+ */
1412
+ export function mesh_get_coplanar_face_region(vertex_count: number, buffer: Float64Array, face_index: number, ox: number, oy: number, oz: number, ux: number, uy: number, uz: number, vx: number, vy: number, vz: number, margin_scale: number, min_margin: number): Float64Array;
1413
+ /**
1414
+ * Unique undirected triangle edges as [edgeCount, v0a, v0b, v1a, v1b, ...].
1415
+ * @param {number} vertex_count
1416
+ * @param {Float64Array} buffer
1417
+ * @returns {Float64Array}
1418
+ */
1419
+ export function mesh_get_edge_vertex_pairs(vertex_count: number, buffer: Float64Array): Float64Array;
1420
+ /**
1421
+ * Handle variant of `mesh_get_edge_vertex_pairs`.
1422
+ * @param {number} id
1423
+ * @returns {Float64Array}
1424
+ */
1425
+ export function mesh_get_edge_vertex_pairs_h(id: number): Float64Array;
1426
+ /**
1427
+ * Face area.
1428
+ * @param {number} vertex_count
1429
+ * @param {Float64Array} buffer
1430
+ * @param {number} face_index
1431
+ * @returns {number}
1432
+ */
1433
+ export function mesh_get_face_area(vertex_count: number, buffer: Float64Array, face_index: number): number;
1434
+ /**
1435
+ * Boundary loops of the coplanar connected face group containing `face_index`.
1436
+ *
1437
+ * Boundary edges are the directed triangle edges whose reversed twin is not
1438
+ * present within the group; chaining them preserves the group's winding.
1439
+ * Consecutive collinear points (T-junction subdivisions) are collapsed so
1440
+ * consumers receive clean polygon corners.
1441
+ *
1442
+ * Output format: [loopCount, (pointCount, x, y, z, ...) per loop].
1443
+ * Loops are implicitly closed (last point connects back to the first).
1444
+ * @param {number} vertex_count
1445
+ * @param {Float64Array} buffer
1446
+ * @param {number} face_index
1447
+ * @returns {Float64Array}
1448
+ */
1449
+ export function mesh_get_face_boundary_loops(vertex_count: number, buffer: Float64Array, face_index: number): Float64Array;
1450
+ /**
1451
+ * Handle variant of `mesh_get_face_boundary_loops`.
1452
+ * @param {number} id
1453
+ * @param {number} face_index
1454
+ * @returns {Float64Array}
1455
+ */
1456
+ export function mesh_get_face_boundary_loops_h(id: number, face_index: number): Float64Array;
1457
+ /**
1458
+ * Face centroid as [x, y, z].
1459
+ * @param {number} vertex_count
1460
+ * @param {Float64Array} buffer
1461
+ * @param {number} face_index
1462
+ * @returns {Float64Array}
1463
+ */
1464
+ export function mesh_get_face_centroid(vertex_count: number, buffer: Float64Array, face_index: number): Float64Array;
1465
+ /**
1466
+ * Face normal as [x, y, z].
1467
+ * @param {number} vertex_count
1468
+ * @param {Float64Array} buffer
1469
+ * @param {number} face_index
1470
+ * @returns {Float64Array}
1471
+ */
1472
+ export function mesh_get_face_normal(vertex_count: number, buffer: Float64Array, face_index: number): Float64Array;
1473
+ /**
1474
+ * Edge-connected smooth face group (dihedral angle below `max_angle_deg`).
1475
+ * Output format: [count, isPlanar (0|1), tri0, tri1, ...]
1476
+ * `isPlanar` is 1 when every triangle normal in the group aligns with the
1477
+ * seed triangle's normal (i.e. the group is a flat face), 0 for curved
1478
+ * regions such as cylinder walls or lofted patches.
1479
+ * @param {number} vertex_count
1480
+ * @param {Float64Array} buffer
1481
+ * @param {number} face_index
1482
+ * @param {number} max_angle_deg
1483
+ * @returns {Float64Array}
1484
+ */
1485
+ export function mesh_get_smooth_face_group(vertex_count: number, buffer: Float64Array, face_index: number, max_angle_deg: number): Float64Array;
1486
+ /**
1487
+ * Handle variant of `mesh_get_smooth_face_group`.
1488
+ * @param {number} id
1489
+ * @param {number} face_index
1490
+ * @param {number} max_angle_deg
1491
+ * @returns {Float64Array}
1492
+ */
1493
+ export function mesh_get_smooth_face_group_h(id: number, face_index: number, max_angle_deg: number): Float64Array;
1494
+ /**
1495
+ * Get mesh statistics
1496
+ * Returns [vertex_count, face_count, edge_count]
1497
+ * @param {number} vertex_count
1498
+ * @param {Float64Array} buffer
1499
+ * @returns {Float64Array}
1500
+ */
1501
+ export function mesh_get_stats(vertex_count: number, buffer: Float64Array): Float64Array;
1502
+ /**
1503
+ * Import OBJ data and return mesh buffers
1504
+ * @param {string} obj_data
1505
+ * @returns {Float64Array}
1506
+ */
1507
+ export function mesh_import_obj(obj_data: string): Float64Array;
1508
+ /**
1509
+ * Import STL data (binary or ASCII, auto-detected) and return the standard
1510
+ * mesh buffer (`[vertexCount, ...positions, ...indices]`). STL stores an
1511
+ * unindexed triangle soup, so coincident vertices are welded.
1512
+ *
1513
+ * `weld_tolerance`: absolute distance under which vertices merge; `<= 0`
1514
+ * selects an automatic tolerance from the bounding box. Returns an empty
1515
+ * buffer on parse failure.
1516
+ * @param {Uint8Array} data
1517
+ * @param {number} weld_tolerance
1518
+ * @returns {Float64Array}
1519
+ */
1520
+ export function mesh_import_stl(data: Uint8Array, weld_tolerance: number): Float64Array;
1521
+ /**
1522
+ * Check if triangulated mesh is a closed volume (no welded boundary edges).
1523
+ * @param {number} vertex_count
1524
+ * @param {Float64Array} buffer
1525
+ * @returns {boolean}
1526
+ */
1527
+ export function mesh_is_closed_volume(vertex_count: number, buffer: Float64Array): boolean;
1528
+ /**
1529
+ * Layered "make watertight": first geometry-preserving repair; if that already
1530
+ * closes the mesh, return it. Otherwise fall back to voxel remeshing.
1531
+ *
1532
+ * Output: `[ before(13), after(13), method, effectiveResolution, vertexCount,
1533
+ * ...positions, ...indices ]` where `method` is 0 (repair) or 1 (remesh) and
1534
+ * `after` describes the returned mesh.
1535
+ * @param {number} vertex_count
1536
+ * @param {Float64Array} buffer
1537
+ * @param {number} resolution
1538
+ * @param {number} iso
1539
+ * @returns {Float64Array}
1540
+ */
1541
+ export function mesh_make_watertight(vertex_count: number, buffer: Float64Array, resolution: number, iso: number): Float64Array;
1542
+ /**
1543
+ * Debug helper: run only the isolated direct-port `MeshGL -> Impl -> MeshGL`
1544
+ * normalization owner and return a JSON dump for local port validation.
1545
+ * @param {number} vertex_count
1546
+ * @param {Float64Array} buffer
1547
+ * @param {boolean} trusted_input
1548
+ * @returns {string}
1549
+ */
1550
+ export function mesh_manifold_port_import_roundtrip_debug(vertex_count: number, buffer: Float64Array, trusted_input: boolean): string;
1551
+ /**
1552
+ * @param {number} vertex_count
1553
+ * @param {Float64Array} buffer
1554
+ * @param {boolean} trusted_input
1555
+ * @returns {string}
1556
+ */
1557
+ export function mesh_manifold_port_import_stage_hashes_debug(vertex_count: number, buffer: Float64Array, trusted_input: boolean): string;
1558
+ /**
1559
+ * @param {Float64Array} data
1560
+ * @param {number} epsilon
1561
+ * @param {boolean} allow_convex
1562
+ * @returns {string}
1563
+ */
1564
+ export function mesh_manifold_port_triangulate_projected_polygon_debug(data: Float64Array, epsilon: number, allow_convex: boolean): string;
1565
+ /**
1566
+ * Merge multiple mesh buffers while preserving per-mesh vertex order and index remapping.
1567
+ * Input format: [mesh_count, len1, mesh1..., len2, mesh2..., ...]
1568
+ * @param {Float64Array} mesh_data
1569
+ * @returns {Float64Array}
1570
+ */
1571
+ export function mesh_merge(mesh_data: Float64Array): Float64Array;
1572
+ /**
1573
+ * Intersect two meshes, returning intersection polyline points.
1574
+ * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1575
+ * @param {number} va_count
1576
+ * @param {Float64Array} buffer_a
1577
+ * @param {number} vb_count
1578
+ * @param {Float64Array} buffer_b
1579
+ * @returns {Float64Array}
1580
+ */
1581
+ export function mesh_mesh_intersect(va_count: number, buffer_a: Float64Array, vb_count: number, buffer_b: Float64Array): Float64Array;
1582
+ /**
1583
+ * Create a planar patch mesh from boundary points using CDT.
1584
+ * Correctly handles concave polygons (unlike fan triangulation).
1585
+ * Input: flat coordinate array [x1,y1,z1, x2,y2,z2, ...]
1586
+ * Output: mesh buffer [vertexCount, x1,y1,z1,..., i0,i1,i2, ...]
1587
+ * @param {Float64Array} coords
1588
+ * @returns {Float64Array}
1589
+ */
1590
+ export function mesh_patch_from_points(coords: Float64Array): Float64Array;
1591
+ /**
1592
+ * Evaluate a point on a planar mesh-face surface at normalized parameters.
1593
+ * Parameters map across the face group's local 2D bounds.
1594
+ * Returns [x, y, z] or [NaN, NaN, NaN] when the query falls outside the face region.
1595
+ * @param {number} vertex_count
1596
+ * @param {Float64Array} buffer
1597
+ * @param {number} face_index
1598
+ * @param {number} u
1599
+ * @param {number} v
1600
+ * @returns {Float64Array}
1601
+ */
1602
+ export function mesh_planar_face_evaluate(vertex_count: number, buffer: Float64Array, face_index: number, u: number, v: number): Float64Array;
1603
+ /**
1604
+ * Intersect a mesh with a plane, returning polyline points.
1605
+ * Input: vertex_count, mesh_buffer..., nx, ny, nz, d
1606
+ * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1607
+ * @param {number} vertex_count
1608
+ * @param {Float64Array} buffer
1609
+ * @param {number} nx
1610
+ * @param {number} ny
1611
+ * @param {number} nz
1612
+ * @param {number} d
1613
+ * @returns {Float64Array}
1614
+ */
1615
+ export function mesh_plane_intersect(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
1616
+ /**
1617
+ * Compute all transversal crossing points of a polyline with a triangle
1618
+ * mesh. Works on OPEN meshes (sheets) — the mesh is NOT required to be a
1619
+ * closed volume, unlike `mesh_clip_polyline`.
1620
+ *
1621
+ * `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
1622
+ * (segment `i` runs `points[i] → points[(i+1) % n]`; open polylines have
1623
+ * n−1 segments, closed ones n).
1624
+ *
1625
+ * Packing: `[count, (x, y, z, segmentIndex, segmentT, triangleIndex)·count]`,
1626
+ * sorted by (segmentIndex, segmentT). Shared-edge/vertex crossings dedupe to
1627
+ * one hit (smallest triangle index kept); coplanar sliding overlaps yield no
1628
+ * hits. Returns an empty buffer on failure (degenerate polyline/mesh).
1629
+ * @param {number} vertex_count
1630
+ * @param {Float64Array} buffer
1631
+ * @param {Float64Array} points
1632
+ * @param {boolean} closed
1633
+ * @returns {Float64Array}
1634
+ */
1635
+ export function mesh_polyline_intersection_points(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
1636
+ /**
1637
+ * Shift closed boolean cutter curve and adjust height.
1638
+ * Returns [height, epsilon, pointCount, x,y,z,...]
1639
+ * @param {Float64Array} coords
1640
+ * @param {boolean} closed
1641
+ * @param {number} nx
1642
+ * @param {number} ny
1643
+ * @param {number} nz
1644
+ * @param {number} height
1645
+ * @returns {Float64Array}
1646
+ */
1647
+ export function mesh_prepare_boolean_cutter_curve(coords: Float64Array, closed: boolean, nx: number, ny: number, nz: number, height: number): Float64Array;
1648
+ /**
1649
+ * Host-aware boolean cutter preparation: like
1650
+ * `mesh_prepare_boolean_cutter_curve`, but the bias is raised past the
1651
+ * measured host-surface deviation under the cutter footprint (sculpted /
1652
+ * non-planar faces). The host arrives as a standard triangulated buffer.
1653
+ * Returns [height, epsilon, pointCount, x,y,z,...]
1654
+ * @param {number} host_vertex_count
1655
+ * @param {Float64Array} host_buffer
1656
+ * @param {Float64Array} coords
1657
+ * @param {boolean} closed
1658
+ * @param {number} nx
1659
+ * @param {number} ny
1660
+ * @param {number} nz
1661
+ * @param {number} height
1662
+ * @returns {Float64Array}
1663
+ */
1664
+ export function mesh_prepare_hosted_boolean_cutter(host_vertex_count: number, host_buffer: Float64Array, coords: Float64Array, closed: boolean, nx: number, ny: number, nz: number, height: number): Float64Array;
1665
+ /**
1666
+ * Raycast against mesh and return closest hit.
1667
+ * Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
1668
+ * @param {number} vertex_count
1669
+ * @param {Float64Array} buffer
1670
+ * @param {number} ox
1671
+ * @param {number} oy
1672
+ * @param {number} oz
1673
+ * @param {number} dx
1674
+ * @param {number} dy
1675
+ * @param {number} dz
1676
+ * @param {number} max_distance
1677
+ * @returns {Float64Array}
1678
+ */
1679
+ export function mesh_raycast(vertex_count: number, buffer: Float64Array, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, max_distance: number): Float64Array;
1680
+ /**
1681
+ * Raycast against mesh and return all hits sorted by distance.
1682
+ * Output: [hitCount, (point, normal, faceIndex, distance)*]
1683
+ * @param {number} vertex_count
1684
+ * @param {Float64Array} buffer
1685
+ * @param {number} ox
1686
+ * @param {number} oy
1687
+ * @param {number} oz
1688
+ * @param {number} dx
1689
+ * @param {number} dy
1690
+ * @param {number} dz
1691
+ * @param {number} max_distance
1692
+ * @returns {Float64Array}
1693
+ */
1694
+ export function mesh_raycast_all(vertex_count: number, buffer: Float64Array, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, max_distance: number): Float64Array;
1695
+ /**
1696
+ * Handle variant of `mesh_raycast_all` — reuses the stored mesh's cached BVH.
1697
+ * @param {number} id
1698
+ * @param {number} ox
1699
+ * @param {number} oy
1700
+ * @param {number} oz
1701
+ * @param {number} dx
1702
+ * @param {number} dy
1703
+ * @param {number} dz
1704
+ * @param {number} max_distance
1705
+ * @returns {Float64Array}
1706
+ */
1707
+ export function mesh_raycast_all_h(id: number, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, max_distance: number): Float64Array;
1708
+ /**
1709
+ * Handle variant of `mesh_raycast` — reuses the stored mesh's cached BVH.
1710
+ * @param {number} id
1711
+ * @param {number} ox
1712
+ * @param {number} oy
1713
+ * @param {number} oz
1714
+ * @param {number} dx
1715
+ * @param {number} dy
1716
+ * @param {number} dz
1717
+ * @param {number} max_distance
1718
+ * @returns {Float64Array}
1719
+ */
1720
+ export function mesh_raycast_h(id: number, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, max_distance: number): Float64Array;
1721
+ /**
1722
+ * Raycast against many meshes packed as:
1723
+ * [meshCount, meshLen0, meshRaw0..., meshLen1, meshRaw1..., ...]
1724
+ * Output: [hitCount, meshIndex, pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance, ...]
1725
+ * @param {Float64Array} mesh_data
1726
+ * @param {number} ox
1727
+ * @param {number} oy
1728
+ * @param {number} oz
1729
+ * @param {number} dx
1730
+ * @param {number} dy
1731
+ * @param {number} dz
1732
+ * @param {number} max_distance
1733
+ * @returns {Float64Array}
1734
+ */
1735
+ export function mesh_raycast_many(mesh_data: Float64Array, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, max_distance: number): Float64Array;
1736
+ /**
1737
+ * Geometry-preserving repair: weld, drop degenerate/duplicate triangles,
1738
+ * remove orphan vertices, fix winding, and fill holes.
1739
+ *
1740
+ * `flags` bitmask: 1=weld, 2=removeDegenerate, 4=removeDuplicate,
1741
+ * 8=fillHoles, 16=fixWinding, 32=removeUnreferenced. `weld_tolerance <= 0`
1742
+ * = auto; `max_hole_edges <= 0` = fill every hole.
1743
+ *
1744
+ * Output: `[ before(13), after(13), weldedVertices, removedTriangles,
1745
+ * filledHoles, vertexCount, ...positions, ...indices ]` — the trailing mesh
1746
+ * buffer is a standard `[vertexCount, positions, indices]` block.
1747
+ * @param {number} vertex_count
1748
+ * @param {Float64Array} buffer
1749
+ * @param {number} flags
1750
+ * @param {number} weld_tolerance
1751
+ * @param {number} max_hole_edges
1752
+ * @returns {Float64Array}
1753
+ */
1754
+ export function mesh_repair(vertex_count: number, buffer: Float64Array, flags: number, weld_tolerance: number, max_hole_edges: number): Float64Array;
1755
+ /**
1756
+ * Full mesh health report (see [`push_repair_diag`] for the 13-value layout).
1757
+ * @param {number} vertex_count
1758
+ * @param {Float64Array} buffer
1759
+ * @returns {Float64Array}
1760
+ */
1761
+ export function mesh_repair_diagnostics(vertex_count: number, buffer: Float64Array): Float64Array;
1762
+ /**
1763
+ * Handle variant of `mesh_repair_diagnostics`.
1764
+ * @param {number} id
1765
+ * @returns {Float64Array}
1766
+ */
1767
+ export function mesh_repair_diagnostics_h(id: number): Float64Array;
1768
+ /**
1769
+ * Rotate a mesh around an arbitrary axis and return new buffers
1770
+ * Axis is defined by (ax, ay, az), angle in radians
1771
+ * @param {number} vertex_count
1772
+ * @param {Float64Array} buffer
1773
+ * @param {number} ax
1774
+ * @param {number} ay
1775
+ * @param {number} az
1776
+ * @param {number} angle
1777
+ * @returns {Float64Array}
1778
+ */
1779
+ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: number, ay: number, az: number, angle: number): Float64Array;
1780
+ /**
1781
+ * Scale a mesh non-uniformly and return new buffers
1782
+ * @param {number} vertex_count
1783
+ * @param {Float64Array} buffer
1784
+ * @param {number} sx
1785
+ * @param {number} sy
1786
+ * @param {number} sz
1787
+ * @returns {Float64Array}
1788
+ */
1789
+ export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
1790
+ /**
1791
+ * Union of two OPEN oriented sheets (mesh A ∪ mesh B): mutual trim + join.
1792
+ * A sheet's material is its FRONT half-space, so the union boundary keeps
1793
+ * A's pieces BEHIND B and B's pieces BEHIND A (pieces in front of the other
1794
+ * sheet are interior to the union material and are dropped), stitched at
1795
+ * the shared intersection seam; regions the other operand never cuts are
1796
+ * kept wholesale (coincident-overlap regions keep A's copy only). Rejects
1797
+ * closed operands — those belong to the solid boolean. Returns one mesh
1798
+ * buffer in the standard `[vertexCount, positions…, indices…]` layout.
1799
+ * @param {number} vertex_count_a
1800
+ * @param {Float64Array} buffer_a
1801
+ * @param {number} vertex_count_b
1802
+ * @param {Float64Array} buffer_b
1803
+ * @param {string} flags
1804
+ * @returns {Float64Array}
1805
+ */
1806
+ export function mesh_sheet_union(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, flags: string): Float64Array;
1807
+ /**
1808
+ * Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
1809
+ * `outside` = the solid on the negative side of the surface, `inside` = the
1810
+ * positive side; each is capped by the portion of the surface inside the
1811
+ * solid, welded into a watertight result. Same packed layout as the other
1812
+ * split exports.
1813
+ * @param {number} vertex_count_a
1814
+ * @param {Float64Array} buffer_a
1815
+ * @param {number} vertex_count_b
1816
+ * @param {Float64Array} buffer_b
1817
+ * @param {string} operation
1818
+ * @returns {Float64Array}
1819
+ */
1820
+ export function mesh_solid_split_by_surface(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
1821
+ /**
1822
+ * @param {number} vertex_count
1823
+ * @param {Float64Array} buffer
1824
+ * @param {number} nx
1825
+ * @param {number} ny
1826
+ * @param {number} nz
1827
+ * @param {number} d
1828
+ * @param {string} operation
1829
+ * @returns {Float64Array}
1830
+ */
1831
+ export function mesh_solid_split_plane(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number, operation: string): Float64Array;
1832
+ /**
1833
+ * One-shot production path: closed manifold triangle mesh ÷ NURBS surface →
1834
+ * both halves as exact capped BREPs, in a single WASM crossing (mesh→BREP
1835
+ * conversion, sheet construction and the parametric split all run kernel-side).
1836
+ * Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
1837
+ * @param {number} vertex_count
1838
+ * @param {Float64Array} buffer
1839
+ * @param {Float64Array} surface_data
1840
+ * @param {number} tolerance
1841
+ * @param {number} normal_angle_tol_deg
1842
+ * @param {number} max_faces
1843
+ * @returns {string}
1844
+ */
1845
+ 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;
1846
+ /**
1847
+ * Intersect a polyline with a triangle mesh (open sheets allowed) and split
1848
+ * it into pieces at every crossing. Hit points become the shared endpoints
1849
+ * of adjacent pieces; a closed loop is opened at the first hit (N hits → N
1850
+ * pieces), an open polyline yields N + 1 pieces. With no crossings the
1851
+ * original polyline comes back as one piece.
1852
+ *
1853
+ * Packing: a single flat polyline-group buffer
1854
+ * `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]` (same group encoding as
1855
+ * `mesh_clip_polyline`, but ONE list — pieces are not classified). Returns
1856
+ * an empty buffer on failure.
1857
+ * @param {number} vertex_count
1858
+ * @param {Float64Array} buffer
1859
+ * @param {Float64Array} points
1860
+ * @param {boolean} closed
1861
+ * @returns {Float64Array}
1862
+ */
1863
+ export function mesh_split_polyline(vertex_count: number, buffer: Float64Array, points: Float64Array, closed: boolean): Float64Array;
1864
+ /**
1865
+ * Store a mesh buffer `[vertexCount, x,y,z..., i0,i1,i2...]` WASM-side.
1866
+ * Returns a non-zero id, or 0 on invalid input.
1867
+ * @param {number} vertex_count
1868
+ * @param {Float64Array} buffer
1869
+ * @returns {number}
1870
+ */
1871
+ export function mesh_store(vertex_count: number, buffer: Float64Array): number;
1872
+ /**
1873
+ * Approximate bytes held by stored mesh raw buffers (diagnostics/tests).
1874
+ * Excludes lazy raycast caches.
1875
+ * @returns {number}
1876
+ */
1877
+ export function mesh_store_bytes(): number;
1878
+ /**
1879
+ * Number of stored meshes (diagnostics/tests).
1880
+ * @returns {number}
1881
+ */
1882
+ export function mesh_store_count(): number;
1883
+ /**
1884
+ * Release a stored mesh and free its memory (idempotent).
1885
+ * @param {number} id
1886
+ */
1887
+ export function mesh_store_free(id: number): void;
1888
+ /**
1889
+ * Trim an OPEN host surface by all closed cutter meshes in one WASM call.
1890
+ *
1891
+ * `packed` layout matches `mesh_boolean_difference_all`: the FIRST mesh is
1892
+ * the open host and every following mesh is a closed cutter volume.
1893
+ * `flags`: `""` or `"trustedInput"`.
1894
+ *
1895
+ * Unlike folding pairwise surface-split subtracts over the cutter list,
1896
+ * every host triangle is cut by ALL relevant cutters at once (one CDT per
1897
+ * triangle) and classified inside-any-cutter — one pass over the host
1898
+ * instead of N passes over an ever-growing, ever-degrading host.
1899
+ * Returns the outside (kept) mesh buffer, or an empty vector on failure.
1900
+ * @param {Float64Array} packed
1901
+ * @param {string} flags
1902
+ * @returns {Float64Array}
1903
+ */
1904
+ export function mesh_surface_difference_all(packed: Float64Array, flags: string): Float64Array;
1905
+ /**
1906
+ * @param {number} vertex_count_a
1907
+ * @param {Float64Array} buffer_a
1908
+ * @param {number} vertex_count_b
1909
+ * @param {Float64Array} buffer_b
1910
+ * @param {string} operation
1911
+ * @returns {Float64Array}
1912
+ */
1913
+ export function mesh_surface_split(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, operation: string): Float64Array;
1914
+ /**
1915
+ * @param {number} vertex_count
1916
+ * @param {Float64Array} buffer
1917
+ * @param {number} nx
1918
+ * @param {number} ny
1919
+ * @param {number} nz
1920
+ * @param {number} d
1921
+ * @param {string} operation
1922
+ * @returns {Float64Array}
1923
+ */
1924
+ export function mesh_surface_split_plane(vertex_count: number, buffer: Float64Array, nx: number, ny: number, nz: number, d: number, operation: string): Float64Array;
1925
+ /**
1926
+ * Return welded-edge topology metrics for a triangulated mesh buffer:
1927
+ * `[boundary_edges, non_manifold_edges]`.
1928
+ * @param {number} vertex_count
1929
+ * @param {Float64Array} buffer
1930
+ * @returns {Float64Array}
1931
+ */
1932
+ export function mesh_topology_metrics(vertex_count: number, buffer: Float64Array): Float64Array;
1933
+ /**
1934
+ * Return raw index-topology metrics for a triangulated mesh buffer:
1935
+ * `[boundary_edges, non_manifold_edges]`.
1936
+ *
1937
+ * Unlike `mesh_topology_metrics`, this preserves duplicate same-position seam
1938
+ * vertices. That makes it a closer fit for trusted MeshGL-style boolean meshes,
1939
+ * where manifoldness comes from explicit topology rather than position welding.
1940
+ * @param {number} vertex_count
1941
+ * @param {Float64Array} buffer
1942
+ * @returns {Float64Array}
1943
+ */
1944
+ export function mesh_topology_metrics_raw(vertex_count: number, buffer: Float64Array): Float64Array;
1945
+ /**
1946
+ * Translate a mesh by an offset vector and return new buffers
1947
+ * @param {number} vertex_count
1948
+ * @param {Float64Array} buffer
1949
+ * @param {number} dx
1950
+ * @param {number} dy
1951
+ * @param {number} dz
1952
+ * @returns {Float64Array}
1953
+ */
1954
+ export function mesh_translate(vertex_count: number, buffer: Float64Array, dx: number, dy: number, dz: number): Float64Array;
1955
+ /**
1956
+ * Rebuild a mesh as a guaranteed-watertight solid via generalized-winding-
1957
+ * number voxel remeshing. `resolution` = cells along the longest axis
1958
+ * (`0` = 64 default, auto-capped by a work budget). `iso` = winding threshold
1959
+ * (`<=0` or `>=1` → 0.5).
1960
+ *
1961
+ * Output: a standard `[vertexCount, ...positions, ...indices]` mesh buffer.
1962
+ * @param {number} vertex_count
1963
+ * @param {Float64Array} buffer
1964
+ * @param {number} resolution
1965
+ * @param {number} iso
1966
+ * @returns {Float64Array}
1967
+ */
1968
+ export function mesh_voxel_remesh(vertex_count: number, buffer: Float64Array, resolution: number, iso: number): Float64Array;
1969
+ /**
1970
+ * Intersect two NURBS curves.
1971
+ * Returns: [num_points, x,y,z, ...]
1972
+ * @param {Float64Array} data_a
1973
+ * @param {Float64Array} data_b
1974
+ * @returns {Float64Array}
1975
+ */
1976
+ export function nurbs_curve_curve_intersect(data_a: Float64Array, data_b: Float64Array): Float64Array;
1977
+ /**
1978
+ * Find all intersections between two NURBS curves, with exact parameters.
1979
+ *
1980
+ * Inputs are standard NURBS curve encodings
1981
+ * `[degree, num_cp, cp_xyz..., weights..., knots...]` (the same format
1982
+ * consumed by `sample_nurbs_curve` / produced by `build_nurbs_curve`).
1983
+ *
1984
+ * Packing: `[count, (x, y, z, paramA, paramB)·count]`. Parameters are
1985
+ * normalized to [0, 1]; results are sorted by `paramA`. Coincident
1986
+ * (overlapping) curve runs yield NO points (identical curves return
1987
+ * `[0]`). Returns an empty buffer on malformed input.
1988
+ * @param {Float64Array} curve_a_data
1989
+ * @param {Float64Array} curve_b_data
1990
+ * @returns {Float64Array}
1991
+ */
1992
+ export function nurbs_curve_curve_intersect_params(curve_a_data: Float64Array, curve_b_data: Float64Array): Float64Array;
1993
+ /**
1994
+ * Offset a planar NURBS curve by `distance` within the plane with normal
1995
+ * (nx, ny, nz), refit to `tolerance`. Input/output use the standard curve
1996
+ * buffer format [degree, n, cps(xyz)..., weights..., knots...].
1997
+ * Returns an empty buffer on failure (see `geometry_last_error`).
1998
+ * @param {Float64Array} data
1999
+ * @param {number} distance
2000
+ * @param {number} nx
2001
+ * @param {number} ny
2002
+ * @param {number} nz
2003
+ * @param {number} tolerance
2004
+ * @returns {Float64Array}
2005
+ */
2006
+ export function nurbs_curve_offset(data: Float64Array, distance: number, nx: number, ny: number, nz: number, tolerance: number): Float64Array;
2007
+ /**
2008
+ * Intersect a NURBS curve with a plane.
2009
+ * Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
2010
+ * Returns: [num_points, x,y,z, x,y,z, ...]
2011
+ * @param {Float64Array} data
2012
+ * @param {number} nx
2013
+ * @param {number} ny
2014
+ * @param {number} nz
2015
+ * @param {number} d
2016
+ * @returns {Float64Array}
2017
+ */
2018
+ export function nurbs_curve_plane_intersect(data: Float64Array, nx: number, ny: number, nz: number, d: number): Float64Array;
2019
+ /**
2020
+ * Rebuild a NURBS curve with the given degree and control point count via
2021
+ * global least-squares fitting (Rhino-style Rebuild). Geometrically closed
2022
+ * inputs produce a periodic (seamlessly closed) result; output is always
2023
+ * non-rational. Input uses the standard curve buffer format
2024
+ * [degree, n, cps(xyz)..., weights..., knots...]; output prepends the fit
2025
+ * report: [maxDeviation, avgDeviation, degree, n, cps..., weights...,
2026
+ * knots...]. Returns an empty buffer on failure (see `geometry_last_error`).
2027
+ * @param {Float64Array} data
2028
+ * @param {number} degree
2029
+ * @param {number} count
2030
+ * @returns {Float64Array}
2031
+ */
2032
+ export function nurbs_curve_rebuild(data: Float64Array, degree: number, count: number): Float64Array;
2033
+ /**
2034
+ * Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
2035
+ *
2036
+ * Splitting is exact (knot insertion), so every returned piece lies exactly
2037
+ * on the input curve. Parameters are sorted/deduplicated/clamped internally;
2038
+ * closed curves are opened at the FIRST parameter (N interior parameters →
2039
+ * N pieces), open curves yield N + 1 pieces. With no valid parameters the
2040
+ * (clamped) curve comes back as the single piece.
2041
+ *
2042
+ * `closed_hint` is an explicit topology override: `> 0` forces closed
2043
+ * (seam-rejoin) semantics, `0` forces open semantics (an open curve whose
2044
+ * endpoints merely coincide keeps N + 1 pieces), `< 0` infers closedness
2045
+ * geometrically from the endpoint distance (the historical behavior).
2046
+ *
2047
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
2048
+ * is the standard NURBS curve encoding (same multi-curve packing as
2049
+ * `brep_face_iso_curves_trimmed`). Returns an empty buffer on malformed
2050
+ * input.
2051
+ * @param {Float64Array} curve_data
2052
+ * @param {Float64Array} params
2053
+ * @param {number} closed_hint
2054
+ * @returns {Float64Array}
2055
+ */
2056
+ export function nurbs_curve_split_at_params(curve_data: Float64Array, params: Float64Array, closed_hint: number): Float64Array;
2057
+ /**
2058
+ * Find all isolated intersections of a NURBS curve with a NURBS surface,
2059
+ * with exact parameters.
2060
+ *
2061
+ * `curve_data` is the standard NURBS curve encoding; `surface_data` is the
2062
+ * standard NURBS surface encoding `[degree_u, degree_v, num_u, num_v,
2063
+ * cp(flat)..., weights..., knots_u..., knots_v...]` (same as
2064
+ * `nurbs_surface_evaluate`).
2065
+ *
2066
+ * Packing: `[count, (x, y, z, t, u, v)·count]`. All parameters are
2067
+ * normalized to [0, 1]; results are sorted by `t`. Curve segments lying ON
2068
+ * the surface (coincident runs) yield no points. Returns an empty buffer on
2069
+ * malformed input.
2070
+ * @param {Float64Array} curve_data
2071
+ * @param {Float64Array} surface_data
2072
+ * @returns {Float64Array}
2073
+ */
2074
+ export function nurbs_curve_surface_intersect_exact(curve_data: Float64Array, surface_data: Float64Array): Float64Array;
2075
+ /**
2076
+ * Closest point on the surface to (x, y, z).
2077
+ * Returns [u, v, px, py, pz] with u, v normalized to [0,1].
2078
+ * @param {Float64Array} data
2079
+ * @param {number} x
2080
+ * @param {number} y
2081
+ * @param {number} z
2082
+ * @returns {Float64Array}
2083
+ */
2084
+ export function nurbs_surface_closest_point(data: Float64Array, x: number, y: number, z: number): Float64Array;
2085
+ /**
2086
+ * Surface curvature at normalized (u, v): [k1, k2, gaussian, mean, nx, ny, nz].
2087
+ * @param {Float64Array} data
2088
+ * @param {number} u
2089
+ * @param {number} v
2090
+ * @returns {Float64Array}
2091
+ */
2092
+ export function nurbs_surface_curvature(data: Float64Array, u: number, v: number): Float64Array;
2093
+ /**
2094
+ * Analytic surface derivatives at normalized (u, v) in [0,1]².
2095
+ * Returns 18 floats: [S, Su, Sv, Suu, Suv, Svv] (xyz each), derivatives taken
2096
+ * with respect to the NORMALIZED parameters (chain rule applied).
2097
+ * @param {Float64Array} data
2098
+ * @param {number} u
2099
+ * @param {number} v
2100
+ * @returns {Float64Array}
2101
+ */
2102
+ export function nurbs_surface_derivatives(data: Float64Array, u: number, v: number): Float64Array;
2103
+ /**
2104
+ * Exact degree elevation by `t` in one direction.
2105
+ * @param {Float64Array} data
2106
+ * @param {boolean} u_dir
2107
+ * @param {number} t
2108
+ * @returns {Float64Array}
2109
+ */
2110
+ export function nurbs_surface_elevate_degree(data: Float64Array, u_dir: boolean, t: number): Float64Array;
2111
+ /**
2112
+ * Evaluate a NURBS surface at normalized parameters (u, v) in [0,1].
2113
+ * Returns [x, y, z]
2114
+ * @param {Float64Array} data
2115
+ * @param {number} u
2116
+ * @param {number} v
2117
+ * @returns {Float64Array}
2118
+ */
2119
+ export function nurbs_surface_evaluate(data: Float64Array, u: number, v: number): Float64Array;
2120
+ /**
2121
+ * Exact sub-patch extraction over normalized ranges.
2122
+ * @param {Float64Array} data
2123
+ * @param {number} u0
2124
+ * @param {number} u1
2125
+ * @param {number} v0
2126
+ * @param {number} v1
2127
+ * @returns {Float64Array}
2128
+ */
2129
+ export function nurbs_surface_extract_region(data: Float64Array, u0: number, u1: number, v0: number, v1: number): Float64Array;
2130
+ /**
2131
+ * Exact extruded (translational) surface from a profile curve.
2132
+ * @param {Float64Array} curve_data
2133
+ * @param {number} dx
2134
+ * @param {number} dy
2135
+ * @param {number} dz
2136
+ * @returns {Float64Array}
2137
+ */
2138
+ export function nurbs_surface_extrude(curve_data: Float64Array, dx: number, dy: number, dz: number): Float64Array;
2139
+ /**
2140
+ * Exact knot insertion at normalized parameter t (repeated `times`).
2141
+ * Returns the refined surface in standard surface format.
2142
+ * @param {Float64Array} data
2143
+ * @param {boolean} u_dir
2144
+ * @param {number} t
2145
+ * @param {number} times
2146
+ * @returns {Float64Array}
2147
+ */
2148
+ export function nurbs_surface_insert_knot(data: Float64Array, u_dir: boolean, t: number, times: number): Float64Array;
2149
+ /**
2150
+ * Exact rational iso-parametric curve. `u_dir = true` extracts the curve
2151
+ * running along u at constant v = t; false extracts along v at constant u = t.
2152
+ * t is normalized [0,1]. Returns curve data [degree, n, pts..., w..., knots...].
2153
+ * @param {Float64Array} data
2154
+ * @param {number} t
2155
+ * @param {boolean} u_dir
2156
+ * @returns {Float64Array}
2157
+ */
2158
+ export function nurbs_surface_iso_curve(data: Float64Array, t: number, u_dir: boolean): Float64Array;
2159
+ /**
2160
+ * Evaluate a NURBS surface unit normal at normalized parameters (u, v) in [0,1].
2161
+ * Returns [x, y, z]
2162
+ * @param {Float64Array} data
2163
+ * @param {number} u
2164
+ * @param {number} v
2165
+ * @returns {Float64Array}
2166
+ */
2167
+ export function nurbs_surface_normal(data: Float64Array, u: number, v: number): Float64Array;
2168
+ /**
2169
+ * Offset a NURBS surface by `distance` along its normal field, refit to
2170
+ * `tolerance`. Input/output use the standard surface buffer format.
2171
+ * Returns an empty buffer on failure (see `geometry_last_error`).
2172
+ * @param {Float64Array} data
2173
+ * @param {number} distance
2174
+ * @param {number} tolerance
2175
+ * @returns {Float64Array}
2176
+ */
2177
+ export function nurbs_surface_offset(data: Float64Array, distance: number, tolerance: number): Float64Array;
2178
+ /**
2179
+ * Intersect a NURBS surface with a plane.
2180
+ * Input: same surface format as tessellate_nurbs_surface, then plane (nx,ny,nz,d) appended.
2181
+ * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
2182
+ * @param {Float64Array} surface_data
2183
+ * @param {number} nx
2184
+ * @param {number} ny
2185
+ * @param {number} nz
2186
+ * @param {number} d
2187
+ * @param {number} tess
2188
+ * @returns {Float64Array}
2189
+ */
2190
+ export function nurbs_surface_plane_intersect(surface_data: Float64Array, nx: number, ny: number, nz: number, d: number, tess: number): Float64Array;
2191
+ /**
2192
+ * Exact rational primitive surfaces.
2193
+ * kind: "cylinder" [bx,by,bz, ax,ay,az, radius, height]
2194
+ * "sphere" [cx,cy,cz, radius]
2195
+ * "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
2196
+ * "torus" [cx,cy,cz, major, minor]
2197
+ * @param {string} kind
2198
+ * @param {Float64Array} params
2199
+ * @returns {Float64Array}
2200
+ */
2201
+ export function nurbs_surface_primitive(kind: string, params: Float64Array): Float64Array;
2202
+ /**
2203
+ * Rebuild a NURBS surface with the given degrees and control counts via the
2204
+ * two-stage least-squares scheme. Closed directions stay closed (periodic
2205
+ * basis); poles stay exactly degenerate; output is non-rational. Input uses
2206
+ * the standard surface buffer format; output prepends the fit report:
2207
+ * [maxDeviation, avgDeviation, ...surface buffer]. Returns an empty buffer
2208
+ * on failure (see `geometry_last_error`).
2209
+ * @param {Float64Array} data
2210
+ * @param {number} degree_u
2211
+ * @param {number} degree_v
2212
+ * @param {number} count_u
2213
+ * @param {number} count_v
2214
+ * @returns {Float64Array}
2215
+ */
2216
+ export function nurbs_surface_rebuild(data: Float64Array, degree_u: number, degree_v: number, count_u: number, count_v: number): Float64Array;
2217
+ /**
2218
+ * Exact surface of revolution from a profile curve (A8.1).
2219
+ * @param {Float64Array} curve_data
2220
+ * @param {number} ox
2221
+ * @param {number} oy
2222
+ * @param {number} oz
2223
+ * @param {number} ax
2224
+ * @param {number} ay
2225
+ * @param {number} az
2226
+ * @param {number} angle
2227
+ * @returns {Float64Array}
2228
+ */
2229
+ export function nurbs_surface_revolve(curve_data: Float64Array, ox: number, oy: number, oz: number, ax: number, ay: number, az: number, angle: number): Float64Array;
2230
+ /**
2231
+ * Exact ruled surface between two curves (auto degree/knot compatibility).
2232
+ * @param {Float64Array} curve_a
2233
+ * @param {Float64Array} curve_b
2234
+ * @returns {Float64Array}
2235
+ */
2236
+ export function nurbs_surface_ruled(curve_a: Float64Array, curve_b: Float64Array): Float64Array;
2237
+ /**
2238
+ * Exact split at normalized parameter t. Returns [lenA, surfaceA..., lenB, surfaceB...].
2239
+ * @param {Float64Array} data
2240
+ * @param {boolean} u_dir
2241
+ * @param {number} t
2242
+ * @returns {Float64Array}
2243
+ */
2244
+ export function nurbs_surface_split(data: Float64Array, u_dir: boolean, t: number): Float64Array;
2245
+ /**
2246
+ * Intersect two NURBS surfaces.
2247
+ * Returns polyline buffer.
2248
+ * @param {Float64Array} data_a
2249
+ * @param {Float64Array} data_b
2250
+ * @param {number} tess
2251
+ * @returns {Float64Array}
2252
+ */
2253
+ export function nurbs_surface_surface_intersect(data_a: Float64Array, data_b: Float64Array, tess: number): Float64Array;
2254
+ /**
2255
+ * EXACT intersection curves of two FULL (untrimmed) NURBS surfaces: the
2256
+ * parametric boolean's SSI pipeline (seeded tri-tri, chaining, tangent-plane
2257
+ * relaxation) fitted to tolerance-verified interpolating NURBS curves —
2258
+ * unlike `nurbs_surface_surface_intersect`, which returns tessellated
2259
+ * polylines.
2260
+ *
2261
+ * Inputs are standard NURBS surface encodings; `tolerance` is absolute
2262
+ * (floored relative to the combined model scale kernel-side). Closed loops
2263
+ * come back as ONE closed curve; coincident (overlapping) surfaces yield no
2264
+ * curves (their overlap is a 2D region).
2265
+ *
2266
+ * Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
2267
+ * is the standard NURBS curve encoding. Returns an empty buffer on
2268
+ * malformed input.
2269
+ * @param {Float64Array} surf_a_data
2270
+ * @param {Float64Array} surf_b_data
2271
+ * @param {number} tolerance
2272
+ * @returns {Float64Array}
2273
+ */
2274
+ export function nurbs_surface_surface_intersect_curves(surf_a_data: Float64Array, surf_b_data: Float64Array, tolerance: number): Float64Array;
2275
+ /**
2276
+ * Curvature-adaptive tessellation against a chordal tolerance.
2277
+ * Returns the standard mesh buffer [vertexCount, positions..., indices...].
2278
+ * @param {Float64Array} data
2279
+ * @param {number} tolerance
2280
+ * @param {number} max_segments_per_span
2281
+ * @returns {Float64Array}
2282
+ */
2283
+ export function nurbs_surface_tessellate_adaptive(data: Float64Array, tolerance: number, max_segments_per_span: number): Float64Array;
2284
+ /**
2285
+ * Display-ready render tessellation: twist-aware adaptive grid with ANALYTIC
2286
+ * surface normals, plus feature edges only where the surface really has them
2287
+ * (boundaries, kinked C0 knot lines, kinked closed seams).
2288
+ * Output (f32, same packing as `mesh_build_render_buffers`):
2289
+ * [vertexCount, positions..., normals..., edgeSegmentCount, edgeSegments...]
2290
+ * @param {Float64Array} data
2291
+ * @param {number} tolerance
2292
+ * @param {number} max_segments_per_span
2293
+ * @param {number} crease_angle_deg
2294
+ * @returns {Float32Array}
2295
+ */
2296
+ export function nurbs_surface_tessellate_render(data: Float64Array, tolerance: number, max_segments_per_span: number, crease_angle_deg: number): Float32Array;
2297
+ /**
2298
+ * Offset a polycurve made of line and arc segments.
2299
+ * Input format: [segment_count, type, ...data, ...]
2300
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
2301
+ * type 1 = Arc: [cx,cy,cz, nx,ny,nz, radius, start_angle, end_angle]
2302
+ * Output uses the same encoded segment format.
2303
+ * @param {Float64Array} segment_data
2304
+ * @param {number} distance
2305
+ * @param {number} nx
2306
+ * @param {number} ny
2307
+ * @param {number} nz
2308
+ * @param {number} join_style_code
2309
+ * @returns {Float64Array}
2310
+ */
2311
+ export function offset_polycurve(segment_data: Float64Array, distance: number, nx: number, ny: number, nz: number, join_style_code: number): Float64Array;
2312
+ /**
2313
+ * Offset a polycurve and return every exact result curve.
2314
+ * Output format: [curve_count, curve_len, curve_data..., curve_len, curve_data..., ...]
2315
+ * @param {Float64Array} segment_data
2316
+ * @param {number} distance
2317
+ * @param {number} nx
2318
+ * @param {number} ny
2319
+ * @param {number} nz
2320
+ * @param {number} join_style_code
2321
+ * @returns {Float64Array}
2322
+ */
2323
+ export function offset_polycurve_all(segment_data: Float64Array, distance: number, nx: number, ny: number, nz: number, join_style_code: number): Float64Array;
2324
+ /**
2325
+ * Offset a polyline by a distance in a given plane.
2326
+ * If nx=ny=nz=0, the plane normal is auto-detected.
2327
+ * Returns flat [x1,y1,z1, x2,y2,z2, ...] of the offset polyline.
2328
+ * @param {Float64Array} coords
2329
+ * @param {number} distance
2330
+ * @param {number} nx
2331
+ * @param {number} ny
2332
+ * @param {number} nz
2333
+ * @returns {Float64Array}
2334
+ */
2335
+ export function offset_polyline_curve(coords: Float64Array, distance: number, nx: number, ny: number, nz: number): Float64Array;
2336
+ /**
2337
+ * Convert a polycurve (Line/Arc segments) to an exact NURBS curve.
2338
+ * Input format: [segment_count, type1, ...data1..., type2, ...data2..., ...]
2339
+ * type 0 = Line (6 floats: start_xyz, end_xyz)
2340
+ * type 1 = Arc (9 floats: center_xyz, normal_xyz, radius, start_angle, end_angle)
2341
+ * Output format: [degree, num_cp, cp_x1,y1,z1,..., w1,w2,..., k1,k2,...]
2342
+ * @param {Float64Array} segment_data
2343
+ * @returns {Float64Array}
2344
+ */
2345
+ export function polycurve_to_nurbs(segment_data: Float64Array): Float64Array;
2346
+ /**
2347
+ * Get the total length of a polyline.
2348
+ * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
2349
+ * @param {Float64Array} coords
2350
+ * @returns {number}
2351
+ */
2352
+ export function polyline_length(coords: Float64Array): number;
2353
+ /**
2354
+ * Evaluate a point on a polyline at parameter t ∈ [0,1].
2355
+ * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
2356
+ * Returns [x, y, z].
2357
+ * @param {Float64Array} coords
2358
+ * @param {number} t
2359
+ * @returns {Float64Array}
2360
+ */
2361
+ export function polyline_point_at(coords: Float64Array, t: number): Float64Array;
2362
+ /**
2363
+ * Find the closest point on a ray to a given point.
2364
+ * Returns [x, y, z] of the closest point on the ray.
2365
+ * @param {number} ox
2366
+ * @param {number} oy
2367
+ * @param {number} oz
2368
+ * @param {number} dx
2369
+ * @param {number} dy
2370
+ * @param {number} dz
2371
+ * @param {number} px
2372
+ * @param {number} py
2373
+ * @param {number} pz
2374
+ * @returns {Float64Array}
2375
+ */
2376
+ export function ray_closest_point(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, px: number, py: number, pz: number): Float64Array;
2377
+ /**
2378
+ * Find the parameter t for the closest point on a ray to a given point.
2379
+ * The closest point is at: origin + t * direction
2380
+ * Note: t can be negative if the closest point is "behind" the ray origin.
2381
+ * @param {number} ox
2382
+ * @param {number} oy
2383
+ * @param {number} oz
2384
+ * @param {number} dx
2385
+ * @param {number} dy
2386
+ * @param {number} dz
2387
+ * @param {number} px
2388
+ * @param {number} py
2389
+ * @param {number} pz
2390
+ * @returns {number}
2391
+ */
2392
+ export function ray_closest_point_parameter(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, px: number, py: number, pz: number): number;
2393
+ /**
2394
+ * Compute the distance from a ray to a point.
2395
+ * Ray is defined by origin (ox, oy, oz) and direction (dx, dy, dz).
2396
+ * Direction should be normalized for accurate distance.
2397
+ * Returns the perpendicular distance from the ray to the point.
2398
+ * @param {number} ox
2399
+ * @param {number} oy
2400
+ * @param {number} oz
2401
+ * @param {number} dx
2402
+ * @param {number} dy
2403
+ * @param {number} dz
2404
+ * @param {number} px
2405
+ * @param {number} py
2406
+ * @param {number} pz
2407
+ * @returns {number}
2408
+ */
2409
+ export function ray_distance_to_point(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, px: number, py: number, pz: number): number;
2410
+ /**
2411
+ * Get a point along the ray at parameter t.
2412
+ * Returns [x, y, z] = origin + t * direction
2413
+ * @param {number} ox
2414
+ * @param {number} oy
2415
+ * @param {number} oz
2416
+ * @param {number} dx
2417
+ * @param {number} dy
2418
+ * @param {number} dz
2419
+ * @param {number} t
2420
+ * @returns {Float64Array}
2421
+ */
2422
+ export function ray_point_at(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, t: number): Float64Array;
2423
+ /**
2424
+ * Sample a NURBS curve.
2425
+ * Input: degree, then flat control points [x,y,z,...], then flat weights, then flat knots
2426
+ * Format: [degree, num_pts, x0,y0,z0, ..., w0,w1,..., k0,k1,...]
2427
+ * @param {Float64Array} data
2428
+ * @param {number} samples
2429
+ * @returns {Float64Array}
2430
+ */
2431
+ export function sample_nurbs_curve(data: Float64Array, samples: number): Float64Array;
2432
+ /**
2433
+ * Begin a stroke. `brush` and `falloff` are stable enum codes
2434
+ * (see okgeometry-api SculptBrush / SculptFalloff). Flags: bit 0 = invert,
2435
+ * bit 1 = front faces only. `symmetry`: bit 0 = X, bit 1 = Y, bit 2 = Z.
2436
+ * @param {number} id
2437
+ * @param {number} brush
2438
+ * @param {number} radius
2439
+ * @param {number} strength
2440
+ * @param {number} falloff
2441
+ * @param {number} flags
2442
+ * @param {number} plane_offset
2443
+ * @param {number} symmetry
2444
+ * @returns {number}
2445
+ */
2446
+ export function sculpt_session_begin_stroke(id: number, brush: number, radius: number, strength: number, falloff: number, flags: number, plane_offset: number, symmetry: number): number;
2447
+ /**
2448
+ * Create a sculpt session from a standard mesh buffer
2449
+ * `[vertexCount, x,y,z..., i0,i1,i2...]`. Returns the session id, or 0 on
2450
+ * invalid input.
2451
+ * @param {number} vertex_count
2452
+ * @param {Float64Array} buffer
2453
+ * @returns {number}
2454
+ */
2455
+ export function sculpt_session_create(vertex_count: number, buffer: Float64Array): number;
2456
+ /**
2457
+ * Apply one dab. Returns the render patch `[index, x,y,z, nx,ny,nz]` per
2458
+ * changed vertex (f32), empty when nothing changed.
2459
+ * @param {number} id
2460
+ * @param {number} cx
2461
+ * @param {number} cy
2462
+ * @param {number} cz
2463
+ * @param {number} vx
2464
+ * @param {number} vy
2465
+ * @param {number} vz
2466
+ * @param {number} dragx
2467
+ * @param {number} dragy
2468
+ * @param {number} dragz
2469
+ * @param {number} pressure
2470
+ * @returns {Float32Array}
2471
+ */
2472
+ export function sculpt_session_dab(id: number, cx: number, cy: number, cz: number, vx: number, vy: number, vz: number, dragx: number, dragy: number, dragz: number, pressure: number): Float32Array;
2473
+ /**
2474
+ * Locally REDUCE point density in the given triangle group (constrained
2475
+ * edge collapse of interior vertices; the group boundary is preserved)
2476
+ * until the group has at most `target_points` unique vertices or no safe
2477
+ * collapse remains. Returns 1 when at least one collapse happened, 0
2478
+ * otherwise. Clears session undo history; callers must refetch
2479
+ * `sculpt_session_render_data` afterwards.
2480
+ * @param {number} id
2481
+ * @param {Uint32Array} triangles
2482
+ * @param {number} target_points
2483
+ * @returns {number}
2484
+ */
2485
+ export function sculpt_session_decimate_faces(id: number, triangles: Uint32Array, target_points: number): number;
2486
+ /**
2487
+ * Finish the active stroke (pushes one undo entry).
2488
+ * @param {number} id
2489
+ */
2490
+ export function sculpt_session_end_stroke(id: number): void;
2491
+ /**
2492
+ * Smooth face group around a seed triangle (dihedral flood fill, same
2493
+ * semantics as the mesh-level query push-pull uses). Returns the group's
2494
+ * triangle indices; empty when the session/seed is invalid.
2495
+ * @param {number} id
2496
+ * @param {number} seed_triangle
2497
+ * @param {number} max_angle_deg
2498
+ * @returns {Uint32Array}
2499
+ */
2500
+ export function sculpt_session_face_group(id: number, seed_triangle: number, max_angle_deg: number): Uint32Array;
2501
+ /**
2502
+ * Session stats: `[vertexCount, triangleCount, averageEdgeLength, undoDepth,
2503
+ * redoDepth]`; empty if the session does not exist.
2504
+ * @param {number} id
2505
+ * @returns {Float64Array}
2506
+ */
2507
+ export function sculpt_session_info(id: number): Float64Array;
2508
+ /**
2509
+ * Fill the sculpt mask with one value (0 clears). Undoable; returns the
2510
+ * render patch (stride 8) of changed vertices.
2511
+ * @param {number} id
2512
+ * @param {number} value
2513
+ * @returns {Float32Array}
2514
+ */
2515
+ export function sculpt_session_mask_fill(id: number, value: number): Float32Array;
2516
+ /**
2517
+ * Invert the sculpt mask. Undoable; returns the render patch (stride 8).
2518
+ * @param {number} id
2519
+ * @returns {Float32Array}
2520
+ */
2521
+ export function sculpt_session_mask_invert(id: number): Float32Array;
2522
+ /**
2523
+ * Current mesh as a standard f64 buffer (for committing back to a document).
2524
+ * @param {number} id
2525
+ * @returns {Float64Array}
2526
+ */
2527
+ export function sculpt_session_mesh_buffer(id: number): Float64Array;
2528
+ /**
2529
+ * Raycast the CURRENT (deforming) surface. Returns
2530
+ * `[px,py,pz, nx,ny,nz, distance, triangleIndex]` or empty on miss.
2531
+ * @param {number} id
2532
+ * @param {number} ox
2533
+ * @param {number} oy
2534
+ * @param {number} oz
2535
+ * @param {number} dx
2536
+ * @param {number} dy
2537
+ * @param {number} dz
2538
+ * @returns {Float64Array}
2539
+ */
2540
+ export function sculpt_session_raycast(id: number, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): Float64Array;
2541
+ /**
2542
+ * Redo the last undone stroke. Same contract as `sculpt_session_undo`.
2543
+ * @param {number} id
2544
+ * @returns {Float32Array}
2545
+ */
2546
+ export function sculpt_session_redo(id: number): Float32Array;
2547
+ /**
2548
+ * Release a sculpt session and free its memory.
2549
+ * @param {number} id
2550
+ */
2551
+ export function sculpt_session_release(id: number): void;
2552
+ /**
2553
+ * Full render snapshot as f32:
2554
+ * `[vertexCount, triangleCount, positions..., normals..., mask..., indices...]`.
2555
+ * @param {number} id
2556
+ * @returns {Float32Array}
2557
+ */
2558
+ export function sculpt_session_render_data(id: number): Float32Array;
2559
+ /**
2560
+ * Uniform 1:4 shape-preserving subdivision (adds sculptable detail).
2561
+ * Clears session undo history. Returns 1 on success, 0 when refused
2562
+ * (session missing or the result would exceed the safety cap). Callers must
2563
+ * refetch `sculpt_session_render_data` afterwards.
2564
+ * @param {number} id
2565
+ * @returns {number}
2566
+ */
2567
+ export function sculpt_session_subdivide(id: number): number;
2568
+ /**
2569
+ * Locally refine the given triangles 1:4 with crack-free conforming
2570
+ * neighbor splits (red-green refinement). Returns 1 on success, 0 when
2571
+ * refused (bad input or safety cap). Clears session undo history; callers
2572
+ * must refetch `sculpt_session_render_data` afterwards.
2573
+ * @param {number} id
2574
+ * @param {Uint32Array} triangles
2575
+ * @returns {number}
2576
+ */
2577
+ export function sculpt_session_subdivide_faces(id: number, triangles: Uint32Array): number;
2578
+ /**
2579
+ * Undo the last stroke. Returns the render patch restoring the previous
2580
+ * positions; empty when there is nothing to undo.
2581
+ * @param {number} id
2582
+ * @returns {Float32Array}
2583
+ */
2584
+ export function sculpt_session_undo(id: number): Float32Array;
2585
+ /**
2586
+ * Sweep a profile curve along a path curve using exact curve evaluation.
2587
+ * profile_data/path_data: encoded curve (see decode_curve)
2588
+ * Returns mesh buffers.
2589
+ * @param {Float64Array} profile_data
2590
+ * @param {Float64Array} path_data
2591
+ * @param {number} profile_segments
2592
+ * @param {number} path_segments
2593
+ * @param {boolean} with_caps
2594
+ * @returns {Float64Array}
2595
+ */
2596
+ export function sweep_curves(profile_data: Float64Array, path_data: Float64Array, profile_segments: number, path_segments: number, with_caps: boolean): Float64Array;
2597
+ /**
2598
+ * Sweep a profile polyline along a path polyline.
2599
+ * profile_coords: flat [x,y,z,...] for profile curve
2600
+ * path_coords: flat [x,y,z,...] for path curve
2601
+ * with_caps: whether to close the ends
2602
+ * Returns mesh buffers.
2603
+ * @param {Float64Array} profile_coords
2604
+ * @param {Float64Array} path_coords
2605
+ * @param {boolean} with_caps
2606
+ * @returns {Float64Array}
2607
+ */
2608
+ export function sweep_polylines(profile_coords: Float64Array, path_coords: Float64Array, with_caps: boolean): Float64Array;
2609
+ /**
2610
+ * Tessellate a NURBS surface to a mesh buffer.
2611
+ * Input format: [degree_u, degree_v, num_u, num_v, ...control_points(flat)..., ...weights(flat)..., ...knots_u..., ...knots_v..., u_segs, v_segs]
2612
+ * @param {Float64Array} data
2613
+ * @returns {Float64Array}
2614
+ */
2615
+ export function tessellate_nurbs_surface(data: Float64Array): Float64Array;
2616
+ /**
2617
+ * Simple test function to verify WASM is working
2618
+ * @returns {string}
2619
+ */
2620
+ export function test_wasm(): string;
2621
+ /**
2622
+ * Thicken an open polycurve into a single closed loop.
2623
+ * Input format: [segment_count, type, ...data, ...]
2624
+ * type 0 = Line: [sx,sy,sz, ex,ey,ez]
2625
+ * type 1 = Arc: [cx,cy,cz, nx,ny,nz, radius, start_angle, end_angle]
2626
+ * Output uses the same encoded segment format.
2627
+ * @param {Float64Array} segment_data
2628
+ * @param {number} distance
2629
+ * @param {boolean} both_sides
2630
+ * @param {number} nx
2631
+ * @param {number} ny
2632
+ * @param {number} nz
2633
+ * @param {number} join_style_code
2634
+ * @returns {Float64Array}
2635
+ */
2636
+ export function thicken_polycurve(segment_data: Float64Array, distance: number, both_sides: boolean, nx: number, ny: number, nz: number, join_style_code: number): Float64Array;
2637
+ /**
2638
+ * Get version info
2639
+ * @returns {string}
2640
+ */
2641
+ export function version(): string;
2642
+ /**
2643
+ * @param {number} receiver
2644
+ */
2645
+ export function wbg_rayon_start_worker(receiver: number): void;
2646
+ export class wbg_rayon_PoolBuilder {
2647
+ static __wrap(ptr: any): any;
2648
+ __destroy_into_raw(): number | undefined;
2649
+ __wbg_ptr: number | undefined;
2650
+ free(): void;
2651
+ build(): void;
2652
+ /**
2653
+ * @returns {number}
2654
+ */
2655
+ numThreads(): number;
2656
+ /**
2657
+ * @returns {number}
2658
+ */
2659
+ receiver(): number;
2660
+ }
2661
+ export function initSync(module: any, memory: any): any;
2662
+ declare function __wbg_init(module_or_path: any, memory: any): Promise<any>;
2663
+ export { __wbg_init as default };
2664
+ //# sourceMappingURL=wasm-bindings-threaded.d.ts.map