okgeometry-api 1.6.0 → 1.10.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.
@@ -34,6 +34,314 @@ export function arc_point_at(cx, cy, cz, nx, ny, nz, radius, start_angle, end_an
34
34
  return v1;
35
35
  }
36
36
 
37
+ /**
38
+ * Parametric BREP boolean: exact surface–surface intersection curves with
39
+ * trimmed-surface output. Both operands must be closed solids.
40
+ * op: "union" | "intersect" | "subtract".
41
+ * Returns the result BREP as JSON, or {"error": "..."} on failure.
42
+ * @param {string} a_json
43
+ * @param {string} b_json
44
+ * @param {string} op
45
+ * @param {number} tolerance
46
+ * @returns {string}
47
+ */
48
+ export function brep_boolean_op(a_json, b_json, op, tolerance) {
49
+ let deferred4_0;
50
+ let deferred4_1;
51
+ try {
52
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
53
+ const len0 = WASM_VECTOR_LEN;
54
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
55
+ const len1 = WASM_VECTOR_LEN;
56
+ const ptr2 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
57
+ const len2 = WASM_VECTOR_LEN;
58
+ const ret = wasm.brep_boolean_op(ptr0, len0, ptr1, len1, ptr2, len2, tolerance);
59
+ deferred4_0 = ret[0];
60
+ deferred4_1 = ret[1];
61
+ return getStringFromWasm0(ret[0], ret[1]);
62
+ } finally {
63
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
69
+ * @param {string} json
70
+ * @param {number} tolerance
71
+ * @returns {Float64Array}
72
+ */
73
+ export function brep_edges(json, tolerance) {
74
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
75
+ const len0 = WASM_VECTOR_LEN;
76
+ const ret = wasm.brep_edges(ptr0, len0, tolerance);
77
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
78
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
79
+ return v2;
80
+ }
81
+
82
+ /**
83
+ * Extrude a profile curve into a BREP (closed profile → capped solid,
84
+ * open profile → sheet). Returns JSON.
85
+ * @param {Float64Array} curve_data
86
+ * @param {number} dx
87
+ * @param {number} dy
88
+ * @param {number} dz
89
+ * @param {number} height
90
+ * @returns {string}
91
+ */
92
+ export function brep_extrude_curve(curve_data, dx, dy, dz, height) {
93
+ let deferred2_0;
94
+ let deferred2_1;
95
+ try {
96
+ const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
97
+ const len0 = WASM_VECTOR_LEN;
98
+ const ret = wasm.brep_extrude_curve(ptr0, len0, dx, dy, dz, height);
99
+ deferred2_0 = ret[0];
100
+ deferred2_1 = ret[1];
101
+ return getStringFromWasm0(ret[0], ret[1]);
102
+ } finally {
103
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Iso-parametric curve of a NURBS face's backing surface (untrimmed).
109
+ * Returns curve data, or empty for planar faces.
110
+ * @param {string} json
111
+ * @param {number} face_index
112
+ * @param {number} t
113
+ * @param {boolean} u_dir
114
+ * @returns {Float64Array}
115
+ */
116
+ export function brep_face_iso_curve(json, face_index, t, u_dir) {
117
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
+ const len0 = WASM_VECTOR_LEN;
119
+ const ret = wasm.brep_face_iso_curve(ptr0, len0, face_index, t, u_dir);
120
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
121
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
122
+ return v2;
123
+ }
124
+
125
+ /**
126
+ * Geometric backing of a face.
127
+ * Returns [0, ox,oy,oz, ux,uy,uz, vx,vy,vz] for planes,
128
+ * or [1, surface_data...] for NURBS faces.
129
+ * @param {string} json
130
+ * @param {number} face_index
131
+ * @returns {Float64Array}
132
+ */
133
+ export function brep_face_surface(json, face_index) {
134
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ const ret = wasm.brep_face_surface(ptr0, len0, face_index);
137
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
138
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
139
+ return v2;
140
+ }
141
+
142
+ /**
143
+ * Tessellate a single BREP face. Returns the standard mesh buffer.
144
+ * @param {string} json
145
+ * @param {number} face_index
146
+ * @param {number} tolerance
147
+ * @returns {Float64Array}
148
+ */
149
+ export function brep_face_tessellate(json, face_index, tolerance) {
150
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
151
+ const len0 = WASM_VECTOR_LEN;
152
+ const ret = wasm.brep_face_tessellate(ptr0, len0, face_index, tolerance);
153
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
154
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
155
+ return v2;
156
+ }
157
+
158
+ /**
159
+ * BREP structure summary: [face_count, edge_count, vertex_count, is_closed].
160
+ * @param {string} json
161
+ * @returns {Float64Array}
162
+ */
163
+ export function brep_info(json) {
164
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
165
+ const len0 = WASM_VECTOR_LEN;
166
+ const ret = wasm.brep_info(ptr0, len0);
167
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
168
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
169
+ return v2;
170
+ }
171
+
172
+ /**
173
+ * Loft through profile curves into a BREP.
174
+ * Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
175
+ * @param {Float64Array} data
176
+ * @returns {string}
177
+ */
178
+ export function brep_loft_curves(data) {
179
+ let deferred2_0;
180
+ let deferred2_1;
181
+ try {
182
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
183
+ const len0 = WASM_VECTOR_LEN;
184
+ const ret = wasm.brep_loft_curves(ptr0, len0);
185
+ deferred2_0 = ret[0];
186
+ deferred2_1 = ret[1];
187
+ return getStringFromWasm0(ret[0], ret[1]);
188
+ } finally {
189
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
190
+ }
191
+ }
192
+
193
+ /**
194
+ * BREP primitives.
195
+ * kind: "box" [minx,miny,minz, maxx,maxy,maxz]
196
+ * "cylinder" [bx,by,bz, ax,ay,az, radius, height]
197
+ * "sphere" [cx,cy,cz, radius]
198
+ * "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
199
+ * "torus" [cx,cy,cz, major, minor]
200
+ * Returns the BREP as JSON ("" on failure).
201
+ * @param {string} kind
202
+ * @param {Float64Array} params
203
+ * @returns {string}
204
+ */
205
+ export function brep_primitive(kind, params) {
206
+ let deferred3_0;
207
+ let deferred3_1;
208
+ try {
209
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
210
+ const len0 = WASM_VECTOR_LEN;
211
+ const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
212
+ const len1 = WASM_VECTOR_LEN;
213
+ const ret = wasm.brep_primitive(ptr0, len0, ptr1, len1);
214
+ deferred3_0 = ret[0];
215
+ deferred3_1 = ret[1];
216
+ return getStringFromWasm0(ret[0], ret[1]);
217
+ } finally {
218
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Revolve a profile curve into a BREP. Returns JSON.
224
+ * @param {Float64Array} curve_data
225
+ * @param {number} ox
226
+ * @param {number} oy
227
+ * @param {number} oz
228
+ * @param {number} ax
229
+ * @param {number} ay
230
+ * @param {number} az
231
+ * @param {number} angle
232
+ * @returns {string}
233
+ */
234
+ export function brep_revolve_curve(curve_data, ox, oy, oz, ax, ay, az, angle) {
235
+ let deferred2_0;
236
+ let deferred2_1;
237
+ try {
238
+ const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ const ret = wasm.brep_revolve_curve(ptr0, len0, ox, oy, oz, ax, ay, az, angle);
241
+ deferred2_0 = ret[0];
242
+ deferred2_1 = ret[1];
243
+ return getStringFromWasm0(ret[0], ret[1]);
244
+ } finally {
245
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Untrimmed sheet BREP from a NURBS surface. Returns JSON.
251
+ * @param {Float64Array} surface_data
252
+ * @returns {string}
253
+ */
254
+ export function brep_sheet_from_surface(surface_data) {
255
+ let deferred2_0;
256
+ let deferred2_1;
257
+ try {
258
+ const ptr0 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ const ret = wasm.brep_sheet_from_surface(ptr0, len0);
261
+ deferred2_0 = ret[0];
262
+ deferred2_1 = ret[1];
263
+ return getStringFromWasm0(ret[0], ret[1]);
264
+ } finally {
265
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Tessellate a BREP into the standard mesh buffer
271
+ * [vertexCount, positions..., indices...]. Crack-free across shared edges.
272
+ * @param {string} json
273
+ * @param {number} tolerance
274
+ * @returns {Float64Array}
275
+ */
276
+ export function brep_tessellate(json, tolerance) {
277
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ret = wasm.brep_tessellate(ptr0, len0, tolerance);
280
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
281
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
282
+ return v2;
283
+ }
284
+
285
+ /**
286
+ * Apply a row-major 4x4 matrix to a BREP. Returns transformed JSON.
287
+ * @param {string} json
288
+ * @param {Float64Array} matrix
289
+ * @returns {string}
290
+ */
291
+ export function brep_transform(json, matrix) {
292
+ let deferred3_0;
293
+ let deferred3_1;
294
+ try {
295
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
298
+ const len1 = WASM_VECTOR_LEN;
299
+ const ret = wasm.brep_transform(ptr0, len0, ptr1, len1);
300
+ deferred3_0 = ret[0];
301
+ deferred3_1 = ret[1];
302
+ return getStringFromWasm0(ret[0], ret[1]);
303
+ } finally {
304
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Validate a BREP. Returns a JSON report:
310
+ * {"isClosed":bool,"boundaryEdgeCount":n,"maxCoherenceError":e,"issues":[...]}
311
+ * @param {string} json
312
+ * @param {number} tolerance
313
+ * @returns {string}
314
+ */
315
+ export function brep_validate(json, tolerance) {
316
+ let deferred2_0;
317
+ let deferred2_1;
318
+ try {
319
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const len0 = WASM_VECTOR_LEN;
321
+ const ret = wasm.brep_validate(ptr0, len0, tolerance);
322
+ deferred2_0 = ret[0];
323
+ deferred2_1 = ret[1];
324
+ return getStringFromWasm0(ret[0], ret[1]);
325
+ } finally {
326
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Volume and surface area from tessellation: [volume, area].
332
+ * @param {string} json
333
+ * @param {number} tolerance
334
+ * @returns {Float64Array}
335
+ */
336
+ export function brep_volume_area(json, tolerance) {
337
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
338
+ const len0 = WASM_VECTOR_LEN;
339
+ const ret = wasm.brep_volume_area(ptr0, len0, tolerance);
340
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
341
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
342
+ return v2;
343
+ }
344
+
37
345
  /**
38
346
  * Build a NURBS curve from raw control points with kernel-managed knots and weights.
39
347
  *
@@ -1231,6 +1539,31 @@ export function mesh_chamfer_all_edges(mesh_type, params, offset) {
1231
1539
  return v3;
1232
1540
  }
1233
1541
 
1542
+ /**
1543
+ * Clip a polyline against a closed mesh volume (boolean intersection for curves).
1544
+ *
1545
+ * `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
1546
+ * (no duplicated seam point required, one is tolerated).
1547
+ * Returns two concatenated polyline buffers — inside pieces first, then
1548
+ * outside pieces — each encoded as [num_polylines, n1, x,y,z,..., ...].
1549
+ * Returns an empty buffer on failure (open cutter, degenerate polyline).
1550
+ * @param {number} vertex_count
1551
+ * @param {Float64Array} buffer
1552
+ * @param {Float64Array} points
1553
+ * @param {boolean} closed
1554
+ * @returns {Float64Array}
1555
+ */
1556
+ export function mesh_clip_polyline(vertex_count, buffer, points, closed) {
1557
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1558
+ const len0 = WASM_VECTOR_LEN;
1559
+ const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
1560
+ const len1 = WASM_VECTOR_LEN;
1561
+ const ret = wasm.mesh_clip_polyline(vertex_count, ptr0, len0, ptr1, len1, closed);
1562
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1563
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1564
+ return v3;
1565
+ }
1566
+
1234
1567
  /**
1235
1568
  * Compute planar curve normal from ordered points.
1236
1569
  * @param {Float64Array} coords
@@ -1939,6 +2272,32 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
1939
2272
  return v2;
1940
2273
  }
1941
2274
 
2275
+ /**
2276
+ * Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
2277
+ * `outside` = the solid on the negative side of the surface, `inside` = the
2278
+ * positive side; each is capped by the portion of the surface inside the
2279
+ * solid, welded into a watertight result. Same packed layout as the other
2280
+ * split exports.
2281
+ * @param {number} vertex_count_a
2282
+ * @param {Float64Array} buffer_a
2283
+ * @param {number} vertex_count_b
2284
+ * @param {Float64Array} buffer_b
2285
+ * @param {string} operation
2286
+ * @returns {Float64Array}
2287
+ */
2288
+ export function mesh_solid_split_by_surface(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
2289
+ const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
2290
+ const len0 = WASM_VECTOR_LEN;
2291
+ const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
2292
+ const len1 = WASM_VECTOR_LEN;
2293
+ const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2294
+ const len2 = WASM_VECTOR_LEN;
2295
+ const ret = wasm.mesh_solid_split_by_surface(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
2296
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2297
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2298
+ return v4;
2299
+ }
2300
+
1942
2301
  /**
1943
2302
  * @param {number} vertex_count
1944
2303
  * @param {Float64Array} buffer
@@ -2121,6 +2480,74 @@ export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
2121
2480
  return v2;
2122
2481
  }
2123
2482
 
2483
+ /**
2484
+ * Closest point on the surface to (x, y, z).
2485
+ * Returns [u, v, px, py, pz] with u, v normalized to [0,1].
2486
+ * @param {Float64Array} data
2487
+ * @param {number} x
2488
+ * @param {number} y
2489
+ * @param {number} z
2490
+ * @returns {Float64Array}
2491
+ */
2492
+ export function nurbs_surface_closest_point(data, x, y, z) {
2493
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2494
+ const len0 = WASM_VECTOR_LEN;
2495
+ const ret = wasm.nurbs_surface_closest_point(ptr0, len0, x, y, z);
2496
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2497
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2498
+ return v2;
2499
+ }
2500
+
2501
+ /**
2502
+ * Surface curvature at normalized (u, v): [k1, k2, gaussian, mean, nx, ny, nz].
2503
+ * @param {Float64Array} data
2504
+ * @param {number} u
2505
+ * @param {number} v
2506
+ * @returns {Float64Array}
2507
+ */
2508
+ export function nurbs_surface_curvature(data, u, v) {
2509
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2510
+ const len0 = WASM_VECTOR_LEN;
2511
+ const ret = wasm.nurbs_surface_curvature(ptr0, len0, u, v);
2512
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2513
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2514
+ return v2;
2515
+ }
2516
+
2517
+ /**
2518
+ * Analytic surface derivatives at normalized (u, v) in [0,1]².
2519
+ * Returns 18 floats: [S, Su, Sv, Suu, Suv, Svv] (xyz each), derivatives taken
2520
+ * with respect to the NORMALIZED parameters (chain rule applied).
2521
+ * @param {Float64Array} data
2522
+ * @param {number} u
2523
+ * @param {number} v
2524
+ * @returns {Float64Array}
2525
+ */
2526
+ export function nurbs_surface_derivatives(data, u, v) {
2527
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2528
+ const len0 = WASM_VECTOR_LEN;
2529
+ const ret = wasm.nurbs_surface_derivatives(ptr0, len0, u, v);
2530
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2531
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2532
+ return v2;
2533
+ }
2534
+
2535
+ /**
2536
+ * Exact degree elevation by `t` in one direction.
2537
+ * @param {Float64Array} data
2538
+ * @param {boolean} u_dir
2539
+ * @param {number} t
2540
+ * @returns {Float64Array}
2541
+ */
2542
+ export function nurbs_surface_elevate_degree(data, u_dir, t) {
2543
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2544
+ const len0 = WASM_VECTOR_LEN;
2545
+ const ret = wasm.nurbs_surface_elevate_degree(ptr0, len0, u_dir, t);
2546
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2547
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2548
+ return v2;
2549
+ }
2550
+
2124
2551
  /**
2125
2552
  * Evaluate a NURBS surface at normalized parameters (u, v) in [0,1].
2126
2553
  * Returns [x, y, z]
@@ -2138,6 +2565,77 @@ export function nurbs_surface_evaluate(data, u, v) {
2138
2565
  return v2;
2139
2566
  }
2140
2567
 
2568
+ /**
2569
+ * Exact sub-patch extraction over normalized ranges.
2570
+ * @param {Float64Array} data
2571
+ * @param {number} u0
2572
+ * @param {number} u1
2573
+ * @param {number} v0
2574
+ * @param {number} v1
2575
+ * @returns {Float64Array}
2576
+ */
2577
+ export function nurbs_surface_extract_region(data, u0, u1, v0, v1) {
2578
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2579
+ const len0 = WASM_VECTOR_LEN;
2580
+ const ret = wasm.nurbs_surface_extract_region(ptr0, len0, u0, u1, v0, v1);
2581
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2582
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2583
+ return v2;
2584
+ }
2585
+
2586
+ /**
2587
+ * Exact extruded (translational) surface from a profile curve.
2588
+ * @param {Float64Array} curve_data
2589
+ * @param {number} dx
2590
+ * @param {number} dy
2591
+ * @param {number} dz
2592
+ * @returns {Float64Array}
2593
+ */
2594
+ export function nurbs_surface_extrude(curve_data, dx, dy, dz) {
2595
+ const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
2596
+ const len0 = WASM_VECTOR_LEN;
2597
+ const ret = wasm.nurbs_surface_extrude(ptr0, len0, dx, dy, dz);
2598
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2599
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2600
+ return v2;
2601
+ }
2602
+
2603
+ /**
2604
+ * Exact knot insertion at normalized parameter t (repeated `times`).
2605
+ * Returns the refined surface in standard surface format.
2606
+ * @param {Float64Array} data
2607
+ * @param {boolean} u_dir
2608
+ * @param {number} t
2609
+ * @param {number} times
2610
+ * @returns {Float64Array}
2611
+ */
2612
+ export function nurbs_surface_insert_knot(data, u_dir, t, times) {
2613
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2614
+ const len0 = WASM_VECTOR_LEN;
2615
+ const ret = wasm.nurbs_surface_insert_knot(ptr0, len0, u_dir, t, times);
2616
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2617
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2618
+ return v2;
2619
+ }
2620
+
2621
+ /**
2622
+ * Exact rational iso-parametric curve. `u_dir = true` extracts the curve
2623
+ * running along u at constant v = t; false extracts along v at constant u = t.
2624
+ * t is normalized [0,1]. Returns curve data [degree, n, pts..., w..., knots...].
2625
+ * @param {Float64Array} data
2626
+ * @param {number} t
2627
+ * @param {boolean} u_dir
2628
+ * @returns {Float64Array}
2629
+ */
2630
+ export function nurbs_surface_iso_curve(data, t, u_dir) {
2631
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2632
+ const len0 = WASM_VECTOR_LEN;
2633
+ const ret = wasm.nurbs_surface_iso_curve(ptr0, len0, t, u_dir);
2634
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2635
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2636
+ return v2;
2637
+ }
2638
+
2141
2639
  /**
2142
2640
  * Evaluate a NURBS surface unit normal at normalized parameters (u, v) in [0,1].
2143
2641
  * Returns [x, y, z]
@@ -2176,6 +2674,81 @@ export function nurbs_surface_plane_intersect(surface_data, nx, ny, nz, d, tess)
2176
2674
  return v2;
2177
2675
  }
2178
2676
 
2677
+ /**
2678
+ * Exact rational primitive surfaces.
2679
+ * kind: "cylinder" [bx,by,bz, ax,ay,az, radius, height]
2680
+ * "sphere" [cx,cy,cz, radius]
2681
+ * "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
2682
+ * "torus" [cx,cy,cz, major, minor]
2683
+ * @param {string} kind
2684
+ * @param {Float64Array} params
2685
+ * @returns {Float64Array}
2686
+ */
2687
+ export function nurbs_surface_primitive(kind, params) {
2688
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2689
+ const len0 = WASM_VECTOR_LEN;
2690
+ const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
2691
+ const len1 = WASM_VECTOR_LEN;
2692
+ const ret = wasm.nurbs_surface_primitive(ptr0, len0, ptr1, len1);
2693
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2694
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2695
+ return v3;
2696
+ }
2697
+
2698
+ /**
2699
+ * Exact surface of revolution from a profile curve (A8.1).
2700
+ * @param {Float64Array} curve_data
2701
+ * @param {number} ox
2702
+ * @param {number} oy
2703
+ * @param {number} oz
2704
+ * @param {number} ax
2705
+ * @param {number} ay
2706
+ * @param {number} az
2707
+ * @param {number} angle
2708
+ * @returns {Float64Array}
2709
+ */
2710
+ export function nurbs_surface_revolve(curve_data, ox, oy, oz, ax, ay, az, angle) {
2711
+ const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
2712
+ const len0 = WASM_VECTOR_LEN;
2713
+ const ret = wasm.nurbs_surface_revolve(ptr0, len0, ox, oy, oz, ax, ay, az, angle);
2714
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2715
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2716
+ return v2;
2717
+ }
2718
+
2719
+ /**
2720
+ * Exact ruled surface between two curves (auto degree/knot compatibility).
2721
+ * @param {Float64Array} curve_a
2722
+ * @param {Float64Array} curve_b
2723
+ * @returns {Float64Array}
2724
+ */
2725
+ export function nurbs_surface_ruled(curve_a, curve_b) {
2726
+ const ptr0 = passArrayF64ToWasm0(curve_a, wasm.__wbindgen_malloc);
2727
+ const len0 = WASM_VECTOR_LEN;
2728
+ const ptr1 = passArrayF64ToWasm0(curve_b, wasm.__wbindgen_malloc);
2729
+ const len1 = WASM_VECTOR_LEN;
2730
+ const ret = wasm.nurbs_surface_ruled(ptr0, len0, ptr1, len1);
2731
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2732
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2733
+ return v3;
2734
+ }
2735
+
2736
+ /**
2737
+ * Exact split at normalized parameter t. Returns [lenA, surfaceA..., lenB, surfaceB...].
2738
+ * @param {Float64Array} data
2739
+ * @param {boolean} u_dir
2740
+ * @param {number} t
2741
+ * @returns {Float64Array}
2742
+ */
2743
+ export function nurbs_surface_split(data, u_dir, t) {
2744
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2745
+ const len0 = WASM_VECTOR_LEN;
2746
+ const ret = wasm.nurbs_surface_split(ptr0, len0, u_dir, t);
2747
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2748
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2749
+ return v2;
2750
+ }
2751
+
2179
2752
  /**
2180
2753
  * Intersect two NURBS surfaces.
2181
2754
  * Returns polyline buffer.
@@ -2195,6 +2768,44 @@ export function nurbs_surface_surface_intersect(data_a, data_b, tess) {
2195
2768
  return v3;
2196
2769
  }
2197
2770
 
2771
+ /**
2772
+ * Curvature-adaptive tessellation against a chordal tolerance.
2773
+ * Returns the standard mesh buffer [vertexCount, positions..., indices...].
2774
+ * @param {Float64Array} data
2775
+ * @param {number} tolerance
2776
+ * @param {number} max_segments_per_span
2777
+ * @returns {Float64Array}
2778
+ */
2779
+ export function nurbs_surface_tessellate_adaptive(data, tolerance, max_segments_per_span) {
2780
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2781
+ const len0 = WASM_VECTOR_LEN;
2782
+ const ret = wasm.nurbs_surface_tessellate_adaptive(ptr0, len0, tolerance, max_segments_per_span);
2783
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2784
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2785
+ return v2;
2786
+ }
2787
+
2788
+ /**
2789
+ * Display-ready render tessellation: twist-aware adaptive grid with ANALYTIC
2790
+ * surface normals, plus feature edges only where the surface really has them
2791
+ * (boundaries, kinked C0 knot lines, kinked closed seams).
2792
+ * Output (f32, same packing as `mesh_build_render_buffers`):
2793
+ * [vertexCount, positions..., normals..., edgeSegmentCount, edgeSegments...]
2794
+ * @param {Float64Array} data
2795
+ * @param {number} tolerance
2796
+ * @param {number} max_segments_per_span
2797
+ * @param {number} crease_angle_deg
2798
+ * @returns {Float32Array}
2799
+ */
2800
+ export function nurbs_surface_tessellate_render(data, tolerance, max_segments_per_span, crease_angle_deg) {
2801
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
2802
+ const len0 = WASM_VECTOR_LEN;
2803
+ const ret = wasm.nurbs_surface_tessellate_render(ptr0, len0, tolerance, max_segments_per_span, crease_angle_deg);
2804
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
2805
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2806
+ return v2;
2807
+ }
2808
+
2198
2809
  /**
2199
2810
  * Offset a polycurve made of line and arc segments.
2200
2811
  * Input format: [segment_count, type, ...data, ...]