okgeometry-api 1.11.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Brep.d.ts +222 -0
- package/dist/Brep.d.ts.map +1 -1
- package/dist/Brep.js +377 -0
- package/dist/Brep.js.map +1 -1
- package/dist/Mesh.d.ts +100 -2
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +258 -4
- package/dist/Mesh.js.map +1 -1
- package/dist/NurbsCurve.d.ts +78 -0
- package/dist/NurbsCurve.d.ts.map +1 -1
- package/dist/NurbsCurve.js +118 -0
- package/dist/NurbsCurve.js.map +1 -1
- package/dist/NurbsSurface.d.ts +23 -0
- package/dist/NurbsSurface.d.ts.map +1 -1
- package/dist/NurbsSurface.js +63 -15
- package/dist/NurbsSurface.js.map +1 -1
- package/dist/Polyline.d.ts +47 -0
- package/dist/Polyline.d.ts.map +1 -1
- package/dist/Polyline.js +45 -0
- package/dist/Polyline.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/dist/wasm-bindings.d.ts +359 -0
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +595 -0
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +7 -3
- package/src/Brep.ts +458 -0
- package/src/Mesh.ts +300 -2
- package/src/NurbsCurve.ts +129 -0
- package/src/NurbsSurface.ts +65 -15
- package/src/Polyline.ts +145 -95
- package/src/index.ts +2 -0
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +308 -0
- package/src/wasm-bindings.js +615 -0
package/dist/wasm-bindings.js
CHANGED
|
@@ -61,6 +61,75 @@ export function brep_boolean_op(a_json, b_json, op, tolerance) {
|
|
|
61
61
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Boolean-intersection clip of an exact NURBS curve against a CLOSED solid
|
|
66
|
+
* BREP: the curve is split exactly (knot insertion) at every boundary
|
|
67
|
+
* crossing and each piece is classified by containment. Every returned
|
|
68
|
+
* piece lies exactly on the input curve; closed curves merge the run
|
|
69
|
+
* spanning the parameter seam (same convention as `mesh_clip_polyline`).
|
|
70
|
+
*
|
|
71
|
+
* Packing: `[insideCount, (bufLen, curveData…)·insideCount,
|
|
72
|
+
* outsideCount, (bufLen, curveData…)·outsideCount]` — two concatenated
|
|
73
|
+
* multi-curve packings, inside pieces first. Returns an empty buffer on
|
|
74
|
+
* failure (malformed input, or a BREP that is not a closed solid).
|
|
75
|
+
* @param {Float64Array} curve_data
|
|
76
|
+
* @param {string} brep_json
|
|
77
|
+
* @returns {Float64Array}
|
|
78
|
+
*/
|
|
79
|
+
export function brep_clip_curve_op(curve_data, brep_json) {
|
|
80
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
81
|
+
const len0 = WASM_VECTOR_LEN;
|
|
82
|
+
const ptr1 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
83
|
+
const len1 = WASM_VECTOR_LEN;
|
|
84
|
+
const ret = wasm.brep_clip_curve_op(ptr0, len0, ptr1, len1);
|
|
85
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
86
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
87
|
+
return v3;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Closest BREP face to a 3D point. Returns [faceIndex, u, v, distance,
|
|
91
|
+
* isNurbs] ((u, v) in the surface's KNOT domain) or empty on failure.
|
|
92
|
+
* @param {string} json
|
|
93
|
+
* @param {number} x
|
|
94
|
+
* @param {number} y
|
|
95
|
+
* @param {number} z
|
|
96
|
+
* @returns {Float64Array}
|
|
97
|
+
*/
|
|
98
|
+
export function brep_closest_face(json, x, y, z) {
|
|
99
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
100
|
+
const len0 = WASM_VECTOR_LEN;
|
|
101
|
+
const ret = wasm.brep_closest_face(ptr0, len0, x, y, z);
|
|
102
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
103
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
104
|
+
return v2;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Find all points where a NURBS curve pierces a BREP's faces: per face, the
|
|
108
|
+
* curve is intersected with the EXACT surface and kept only when the hit
|
|
109
|
+
* lies INSIDE the face's trimmed region; crossings on shared edges are
|
|
110
|
+
* deduplicated (smallest face index kept).
|
|
111
|
+
*
|
|
112
|
+
* `curve_data` is the standard NURBS curve encoding. Hits are sorted by
|
|
113
|
+
* curve parameter (normalized [0, 1]); (u, v) are in the face's OWN
|
|
114
|
+
* parameter space (knot domain for NURBS faces, plane-frame coordinates for
|
|
115
|
+
* planar faces).
|
|
116
|
+
*
|
|
117
|
+
* Packing: `[count, (x, y, z, curveParam, faceIndex, u, v)·count]`.
|
|
118
|
+
* Returns an empty buffer on malformed input.
|
|
119
|
+
* @param {string} brep_json
|
|
120
|
+
* @param {Float64Array} curve_data
|
|
121
|
+
* @returns {Float64Array}
|
|
122
|
+
*/
|
|
123
|
+
export function brep_curve_intersection_op(brep_json, curve_data) {
|
|
124
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
125
|
+
const len0 = WASM_VECTOR_LEN;
|
|
126
|
+
const ptr1 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
127
|
+
const len1 = WASM_VECTOR_LEN;
|
|
128
|
+
const ret = wasm.brep_curve_intersection_op(ptr0, len0, ptr1, len1);
|
|
129
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
130
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
131
|
+
return v3;
|
|
132
|
+
}
|
|
64
133
|
/**
|
|
65
134
|
* All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
|
|
66
135
|
* @param {string} json
|
|
@@ -75,6 +144,51 @@ export function brep_edges(json, tolerance) {
|
|
|
75
144
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
76
145
|
return v2;
|
|
77
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Extract one face as a standalone single-face TRIMMED sheet BREP (trim
|
|
149
|
+
* loops, pcurves, edges and vertices preserved). Returns JSON, empty on
|
|
150
|
+
* failure.
|
|
151
|
+
* @param {string} json
|
|
152
|
+
* @param {number} face_index
|
|
153
|
+
* @returns {string}
|
|
154
|
+
*/
|
|
155
|
+
export function brep_extract_face(json, face_index) {
|
|
156
|
+
let deferred2_0;
|
|
157
|
+
let deferred2_1;
|
|
158
|
+
try {
|
|
159
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
|
+
const len0 = WASM_VECTOR_LEN;
|
|
161
|
+
const ret = wasm.brep_extract_face(ptr0, len0, face_index);
|
|
162
|
+
deferred2_0 = ret[0];
|
|
163
|
+
deferred2_1 = ret[1];
|
|
164
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* ALL faces as standalone single-face trimmed sheet BREPs, in one crossing
|
|
172
|
+
* (the source JSON is parsed once). Returns a JSON ARRAY aligned with face
|
|
173
|
+
* indices; faces that fail to extract are `null`.
|
|
174
|
+
* @param {string} json
|
|
175
|
+
* @returns {string}
|
|
176
|
+
*/
|
|
177
|
+
export function brep_extract_faces(json) {
|
|
178
|
+
let deferred2_0;
|
|
179
|
+
let deferred2_1;
|
|
180
|
+
try {
|
|
181
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
182
|
+
const len0 = WASM_VECTOR_LEN;
|
|
183
|
+
const ret = wasm.brep_extract_faces(ptr0, len0);
|
|
184
|
+
deferred2_0 = ret[0];
|
|
185
|
+
deferred2_1 = ret[1];
|
|
186
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
78
192
|
/**
|
|
79
193
|
* Extrude a profile curve into a BREP (closed profile → capped solid,
|
|
80
194
|
* open profile → sheet). Returns JSON.
|
|
@@ -100,6 +214,24 @@ export function brep_extrude_curve(curve_data, dx, dy, dz, height) {
|
|
|
100
214
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
101
215
|
}
|
|
102
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Exact (u, v) of a point on a specific BREP face (closest-point Newton for
|
|
219
|
+
* NURBS, frame projection for planes). Returns [u, v, distance, isNurbs].
|
|
220
|
+
* @param {string} json
|
|
221
|
+
* @param {number} face_index
|
|
222
|
+
* @param {number} x
|
|
223
|
+
* @param {number} y
|
|
224
|
+
* @param {number} z
|
|
225
|
+
* @returns {Float64Array}
|
|
226
|
+
*/
|
|
227
|
+
export function brep_face_closest_uv(json, face_index, x, y, z) {
|
|
228
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
const ret = wasm.brep_face_closest_uv(ptr0, len0, face_index, x, y, z);
|
|
231
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
232
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
233
|
+
return v2;
|
|
234
|
+
}
|
|
103
235
|
/**
|
|
104
236
|
* Iso-parametric curve of a NURBS face's backing surface (untrimmed).
|
|
105
237
|
* Returns curve data, or empty for planar faces.
|
|
@@ -117,6 +249,44 @@ export function brep_face_iso_curve(json, face_index, t, u_dir) {
|
|
|
117
249
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
118
250
|
return v2;
|
|
119
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Exact isocurve(s) of a BREP face at KNOT-domain parameter `t`, CLIPPED to
|
|
254
|
+
* the face's trimmed region. `u_dir = true` runs along u at fixed v = t.
|
|
255
|
+
* Line pieces (planar faces) are encoded as degree-1 NURBS.
|
|
256
|
+
* Packing: [curveCount, (bufLen, curveData…)·curveCount] where curveData is
|
|
257
|
+
* the standard NURBS curve encoding.
|
|
258
|
+
* @param {string} json
|
|
259
|
+
* @param {number} face_index
|
|
260
|
+
* @param {number} t
|
|
261
|
+
* @param {boolean} u_dir
|
|
262
|
+
* @returns {Float64Array}
|
|
263
|
+
*/
|
|
264
|
+
export function brep_face_iso_curves_trimmed(json, face_index, t, u_dir) {
|
|
265
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
266
|
+
const len0 = WASM_VECTOR_LEN;
|
|
267
|
+
const ret = wasm.brep_face_iso_curves_trimmed(ptr0, len0, face_index, t, u_dir);
|
|
268
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
269
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
270
|
+
return v2;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Like `brep_face_iso_curves_trimmed`, but `t` is NORMALIZED [0, 1] across
|
|
274
|
+
* the face's trim extent in the fixed direction — callers don't need the
|
|
275
|
+
* surface knot domain. Same packing.
|
|
276
|
+
* @param {string} json
|
|
277
|
+
* @param {number} face_index
|
|
278
|
+
* @param {number} t
|
|
279
|
+
* @param {boolean} u_dir
|
|
280
|
+
* @returns {Float64Array}
|
|
281
|
+
*/
|
|
282
|
+
export function brep_face_iso_curves_trimmed_normalized(json, face_index, t, u_dir) {
|
|
283
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
285
|
+
const ret = wasm.brep_face_iso_curves_trimmed_normalized(ptr0, len0, face_index, t, u_dir);
|
|
286
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
287
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
288
|
+
return v2;
|
|
289
|
+
}
|
|
120
290
|
/**
|
|
121
291
|
* Geometric backing of a face.
|
|
122
292
|
* Returns [0, ox,oy,oz, ux,uy,uz, vx,vy,vz] for planes,
|
|
@@ -133,6 +303,37 @@ export function brep_face_surface(json, face_index) {
|
|
|
133
303
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
134
304
|
return v2;
|
|
135
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Underlying surface of a face CROPPED to its trim extent, ALWAYS as a NURBS
|
|
308
|
+
* surface (planar faces become exact degree-1 patches). Returns surface
|
|
309
|
+
* data, empty on failure.
|
|
310
|
+
* @param {string} json
|
|
311
|
+
* @param {number} face_index
|
|
312
|
+
* @returns {Float64Array}
|
|
313
|
+
*/
|
|
314
|
+
export function brep_face_surface_cropped(json, face_index) {
|
|
315
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
317
|
+
const ret = wasm.brep_face_surface_cropped(ptr0, len0, face_index);
|
|
318
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
319
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
320
|
+
return v2;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Batch variant of `brep_face_surface_cropped` for all faces in one
|
|
324
|
+
* crossing. Packing: [faceCount, (bufLen, surfaceData…)·faceCount], aligned
|
|
325
|
+
* with face indices — a face that fails to crop gets bufLen 0.
|
|
326
|
+
* @param {string} json
|
|
327
|
+
* @returns {Float64Array}
|
|
328
|
+
*/
|
|
329
|
+
export function brep_face_surfaces_cropped(json) {
|
|
330
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
331
|
+
const len0 = WASM_VECTOR_LEN;
|
|
332
|
+
const ret = wasm.brep_face_surfaces_cropped(ptr0, len0);
|
|
333
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
334
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
335
|
+
return v2;
|
|
336
|
+
}
|
|
136
337
|
/**
|
|
137
338
|
* Tessellate a single BREP face. Returns the standard mesh buffer.
|
|
138
339
|
* @param {string} json
|
|
@@ -148,6 +349,46 @@ export function brep_face_tessellate(json, face_index, tolerance) {
|
|
|
148
349
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
149
350
|
return v2;
|
|
150
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* UV bounding box of a face's trim loops in surface parameter space:
|
|
354
|
+
* [u_min, u_max, v_min, v_max]. Empty on failure.
|
|
355
|
+
* @param {string} json
|
|
356
|
+
* @param {number} face_index
|
|
357
|
+
* @returns {Float64Array}
|
|
358
|
+
*/
|
|
359
|
+
export function brep_face_trim_bounds(json, face_index) {
|
|
360
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
361
|
+
const len0 = WASM_VECTOR_LEN;
|
|
362
|
+
const ret = wasm.brep_face_trim_bounds(ptr0, len0, face_index);
|
|
363
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
364
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
365
|
+
return v2;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Convert a closed manifold triangle mesh into a planar-face BREP.
|
|
369
|
+
* `normal_angle_tol_deg` ≤ 0 selects the default (≈0.057°); `max_faces` 0 =
|
|
370
|
+
* default guard (4096). Returns BREP JSON or {"error": ...}.
|
|
371
|
+
* @param {number} vertex_count
|
|
372
|
+
* @param {Float64Array} buffer
|
|
373
|
+
* @param {number} normal_angle_tol_deg
|
|
374
|
+
* @param {number} max_faces
|
|
375
|
+
* @returns {string}
|
|
376
|
+
*/
|
|
377
|
+
export function brep_from_mesh_buffer(vertex_count, buffer, normal_angle_tol_deg, max_faces) {
|
|
378
|
+
let deferred2_0;
|
|
379
|
+
let deferred2_1;
|
|
380
|
+
try {
|
|
381
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
383
|
+
const ret = wasm.brep_from_mesh_buffer(vertex_count, ptr0, len0, normal_angle_tol_deg, max_faces);
|
|
384
|
+
deferred2_0 = ret[0];
|
|
385
|
+
deferred2_1 = ret[1];
|
|
386
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
387
|
+
}
|
|
388
|
+
finally {
|
|
389
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
151
392
|
/**
|
|
152
393
|
* BREP structure summary: [face_count, edge_count, vertex_count, is_closed].
|
|
153
394
|
* @param {string} json
|
|
@@ -161,6 +402,35 @@ export function brep_info(json) {
|
|
|
161
402
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
162
403
|
return v2;
|
|
163
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* TRIM-EXACT intersection curves between two BREPs (solids OR sheets): the
|
|
407
|
+
* parametric boolean's SSI → clip → convergence stages run and the fitted 3D
|
|
408
|
+
* intersection edges come back WITHOUT classification/assembly.
|
|
409
|
+
*
|
|
410
|
+
* A closed intersection loop may come back as several contiguous pieces
|
|
411
|
+
* (split at surface seams and face-boundary crossings); the pieces chain
|
|
412
|
+
* end-to-end exactly. Coincident (overlapping) face pairs contribute no
|
|
413
|
+
* curves.
|
|
414
|
+
*
|
|
415
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
|
|
416
|
+
* curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
|
|
417
|
+
* a pipeline error) — distinguishable from `[0]`, which means the operands
|
|
418
|
+
* genuinely do not intersect.
|
|
419
|
+
* @param {string} a_json
|
|
420
|
+
* @param {string} b_json
|
|
421
|
+
* @param {number} tolerance
|
|
422
|
+
* @returns {Float64Array}
|
|
423
|
+
*/
|
|
424
|
+
export function brep_intersection_curves_op(a_json, b_json, tolerance) {
|
|
425
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
426
|
+
const len0 = WASM_VECTOR_LEN;
|
|
427
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
428
|
+
const len1 = WASM_VECTOR_LEN;
|
|
429
|
+
const ret = wasm.brep_intersection_curves_op(ptr0, len0, ptr1, len1, tolerance);
|
|
430
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
431
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
432
|
+
return v3;
|
|
433
|
+
}
|
|
164
434
|
/**
|
|
165
435
|
* Loft through profile curves into a BREP.
|
|
166
436
|
* Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
|
|
@@ -182,6 +452,32 @@ export function brep_loft_curves(data) {
|
|
|
182
452
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
183
453
|
}
|
|
184
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* Intersection curves between a BREP and a triangle mesh.
|
|
457
|
+
*
|
|
458
|
+
* TESSELLATION-BASED (documented approximation): the BREP is tessellated at
|
|
459
|
+
* `tolerance` (pass `<= 0` for the deterministic auto display tolerance)
|
|
460
|
+
* and intersected with the mesh via BVH-pruned tri-tri crossing + chaining.
|
|
461
|
+
*
|
|
462
|
+
* Mesh input is the standard `[vertexCount, positions..., indices...]`
|
|
463
|
+
* buffer. Returns the standard polyline group packing
|
|
464
|
+
* `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]`; empty on failure.
|
|
465
|
+
* @param {string} brep_json
|
|
466
|
+
* @param {number} vertex_count
|
|
467
|
+
* @param {Float64Array} mesh_buffer
|
|
468
|
+
* @param {number} tolerance
|
|
469
|
+
* @returns {Float64Array}
|
|
470
|
+
*/
|
|
471
|
+
export function brep_mesh_intersection_curves_op(brep_json, vertex_count, mesh_buffer, tolerance) {
|
|
472
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
474
|
+
const ptr1 = passArrayF64ToWasm0(mesh_buffer, wasm.__wbindgen_malloc);
|
|
475
|
+
const len1 = WASM_VECTOR_LEN;
|
|
476
|
+
const ret = wasm.brep_mesh_intersection_curves_op(ptr0, len0, vertex_count, ptr1, len1, tolerance);
|
|
477
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
478
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
479
|
+
return v3;
|
|
480
|
+
}
|
|
185
481
|
/**
|
|
186
482
|
* BREP primitives.
|
|
187
483
|
* kind: "box" [minx,miny,minz, maxx,maxy,maxz]
|
|
@@ -258,6 +554,33 @@ export function brep_sheet_from_surface(surface_data) {
|
|
|
258
554
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
259
555
|
}
|
|
260
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Split a closed solid BREP by a sheet BREP into BOTH capped halves.
|
|
559
|
+
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
560
|
+
* Sides follow the sheet normal (negative = behind it), matching
|
|
561
|
+
* `mesh_solid_split_by_surface`.
|
|
562
|
+
* @param {string} solid_json
|
|
563
|
+
* @param {string} sheet_json
|
|
564
|
+
* @param {number} tolerance
|
|
565
|
+
* @returns {string}
|
|
566
|
+
*/
|
|
567
|
+
export function brep_split_solid_by_sheet_op(solid_json, sheet_json, tolerance) {
|
|
568
|
+
let deferred3_0;
|
|
569
|
+
let deferred3_1;
|
|
570
|
+
try {
|
|
571
|
+
const ptr0 = passStringToWasm0(solid_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
572
|
+
const len0 = WASM_VECTOR_LEN;
|
|
573
|
+
const ptr1 = passStringToWasm0(sheet_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
574
|
+
const len1 = WASM_VECTOR_LEN;
|
|
575
|
+
const ret = wasm.brep_split_solid_by_sheet_op(ptr0, len0, ptr1, len1, tolerance);
|
|
576
|
+
deferred3_0 = ret[0];
|
|
577
|
+
deferred3_1 = ret[1];
|
|
578
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
579
|
+
}
|
|
580
|
+
finally {
|
|
581
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
261
584
|
/**
|
|
262
585
|
* Tessellate a BREP into the standard mesh buffer
|
|
263
586
|
* [vertexCount, positions..., indices...]. Crack-free across shared edges.
|
|
@@ -273,6 +596,25 @@ export function brep_tessellate(json, tolerance) {
|
|
|
273
596
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
274
597
|
return v2;
|
|
275
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Tessellate a BREP with per-face triangle ranges for face-level picking.
|
|
601
|
+
* `tolerance <= 0` selects the deterministic auto display tolerance (from the
|
|
602
|
+
* BREP's own extent), so triangle indices from a previously produced
|
|
603
|
+
* auto-tolerance display mesh stay valid across calls.
|
|
604
|
+
* Packing: [vertexCount, indexCount, rangeCount,
|
|
605
|
+
* positions(3·vc), indices(ic), (face, firstTri, triCount)·rc].
|
|
606
|
+
* @param {string} json
|
|
607
|
+
* @param {number} tolerance
|
|
608
|
+
* @returns {Float64Array}
|
|
609
|
+
*/
|
|
610
|
+
export function brep_tessellate_with_face_ranges(json, tolerance) {
|
|
611
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
612
|
+
const len0 = WASM_VECTOR_LEN;
|
|
613
|
+
const ret = wasm.brep_tessellate_with_face_ranges(ptr0, len0, tolerance);
|
|
614
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
615
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
616
|
+
return v2;
|
|
617
|
+
}
|
|
276
618
|
/**
|
|
277
619
|
* Apply a row-major 4x4 matrix to a BREP. Returns transformed JSON.
|
|
278
620
|
* @param {string} json
|
|
@@ -1517,6 +1859,35 @@ export function mesh_clip_polyline(vertex_count, buffer, points, closed) {
|
|
|
1517
1859
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1518
1860
|
return v3;
|
|
1519
1861
|
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Clip a polyline by an OPEN oriented sheet: split it at every sheet
|
|
1864
|
+
* crossing and classify each piece by the SIGNED SIDE of the sheet. This is
|
|
1865
|
+
* side classification, NOT containment (unlike `mesh_clip_polyline`, which
|
|
1866
|
+
* requires a closed volume): pieces far from the sheet still classify by
|
|
1867
|
+
* the nearest facet's normal. `inside` = the positive side, in FRONT of the
|
|
1868
|
+
* sheet normal; `outside` = behind it. The sheet may be any non-empty
|
|
1869
|
+
* triangle mesh, open or closed; its stored winding defines the normals.
|
|
1870
|
+
*
|
|
1871
|
+
* Returns two concatenated polyline buffers — inside pieces first, then
|
|
1872
|
+
* outside pieces — each encoded as `[num_polylines, n1, x,y,z,..., ...]`
|
|
1873
|
+
* (identical packing to `mesh_clip_polyline`). Returns an empty buffer on
|
|
1874
|
+
* failure (degenerate polyline/sheet).
|
|
1875
|
+
* @param {number} vertex_count
|
|
1876
|
+
* @param {Float64Array} buffer
|
|
1877
|
+
* @param {Float64Array} points
|
|
1878
|
+
* @param {boolean} closed
|
|
1879
|
+
* @returns {Float64Array}
|
|
1880
|
+
*/
|
|
1881
|
+
export function mesh_clip_polyline_by_sheet(vertex_count, buffer, points, closed) {
|
|
1882
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1883
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1884
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1885
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1886
|
+
const ret = wasm.mesh_clip_polyline_by_sheet(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
1887
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1888
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1889
|
+
return v3;
|
|
1890
|
+
}
|
|
1520
1891
|
/**
|
|
1521
1892
|
* Compute planar curve normal from ordered points.
|
|
1522
1893
|
* @param {Float64Array} coords
|
|
@@ -1864,6 +2235,29 @@ export function mesh_get_face_area(vertex_count, buffer, face_index) {
|
|
|
1864
2235
|
const ret = wasm.mesh_get_face_area(vertex_count, ptr0, len0, face_index);
|
|
1865
2236
|
return ret;
|
|
1866
2237
|
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Boundary loops of the coplanar connected face group containing `face_index`.
|
|
2240
|
+
*
|
|
2241
|
+
* Boundary edges are the directed triangle edges whose reversed twin is not
|
|
2242
|
+
* present within the group; chaining them preserves the group's winding.
|
|
2243
|
+
* Consecutive collinear points (T-junction subdivisions) are collapsed so
|
|
2244
|
+
* consumers receive clean polygon corners.
|
|
2245
|
+
*
|
|
2246
|
+
* Output format: [loopCount, (pointCount, x, y, z, ...) per loop].
|
|
2247
|
+
* Loops are implicitly closed (last point connects back to the first).
|
|
2248
|
+
* @param {number} vertex_count
|
|
2249
|
+
* @param {Float64Array} buffer
|
|
2250
|
+
* @param {number} face_index
|
|
2251
|
+
* @returns {Float64Array}
|
|
2252
|
+
*/
|
|
2253
|
+
export function mesh_get_face_boundary_loops(vertex_count, buffer, face_index) {
|
|
2254
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2255
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2256
|
+
const ret = wasm.mesh_get_face_boundary_loops(vertex_count, ptr0, len0, face_index);
|
|
2257
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2258
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2259
|
+
return v2;
|
|
2260
|
+
}
|
|
1867
2261
|
/**
|
|
1868
2262
|
* Face centroid as [x, y, z].
|
|
1869
2263
|
* @param {number} vertex_count
|
|
@@ -2127,6 +2521,35 @@ export function mesh_plane_intersect(vertex_count, buffer, nx, ny, nz, d) {
|
|
|
2127
2521
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2128
2522
|
return v2;
|
|
2129
2523
|
}
|
|
2524
|
+
/**
|
|
2525
|
+
* Compute all transversal crossing points of a polyline with a triangle
|
|
2526
|
+
* mesh. Works on OPEN meshes (sheets) — the mesh is NOT required to be a
|
|
2527
|
+
* closed volume, unlike `mesh_clip_polyline`.
|
|
2528
|
+
*
|
|
2529
|
+
* `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
|
|
2530
|
+
* (segment `i` runs `points[i] → points[(i+1) % n]`; open polylines have
|
|
2531
|
+
* n−1 segments, closed ones n).
|
|
2532
|
+
*
|
|
2533
|
+
* Packing: `[count, (x, y, z, segmentIndex, segmentT, triangleIndex)·count]`,
|
|
2534
|
+
* sorted by (segmentIndex, segmentT). Shared-edge/vertex crossings dedupe to
|
|
2535
|
+
* one hit (smallest triangle index kept); coplanar sliding overlaps yield no
|
|
2536
|
+
* hits. Returns an empty buffer on failure (degenerate polyline/mesh).
|
|
2537
|
+
* @param {number} vertex_count
|
|
2538
|
+
* @param {Float64Array} buffer
|
|
2539
|
+
* @param {Float64Array} points
|
|
2540
|
+
* @param {boolean} closed
|
|
2541
|
+
* @returns {Float64Array}
|
|
2542
|
+
*/
|
|
2543
|
+
export function mesh_polyline_intersection_points(vertex_count, buffer, points, closed) {
|
|
2544
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2545
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2546
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
2547
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2548
|
+
const ret = wasm.mesh_polyline_intersection_points(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
2549
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2550
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2551
|
+
return v3;
|
|
2552
|
+
}
|
|
2130
2553
|
/**
|
|
2131
2554
|
* Shift closed boolean cutter curve and adjust height.
|
|
2132
2555
|
* Returns [height, epsilon, pointCount, x,y,z,...]
|
|
@@ -2293,6 +2716,63 @@ export function mesh_solid_split_plane(vertex_count, buffer, nx, ny, nz, d, oper
|
|
|
2293
2716
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2294
2717
|
return v3;
|
|
2295
2718
|
}
|
|
2719
|
+
/**
|
|
2720
|
+
* One-shot production path: closed manifold triangle mesh ÷ NURBS surface →
|
|
2721
|
+
* both halves as exact capped BREPs, in a single WASM crossing (mesh→BREP
|
|
2722
|
+
* conversion, sheet construction and the parametric split all run kernel-side).
|
|
2723
|
+
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
2724
|
+
* @param {number} vertex_count
|
|
2725
|
+
* @param {Float64Array} buffer
|
|
2726
|
+
* @param {Float64Array} surface_data
|
|
2727
|
+
* @param {number} tolerance
|
|
2728
|
+
* @param {number} normal_angle_tol_deg
|
|
2729
|
+
* @param {number} max_faces
|
|
2730
|
+
* @returns {string}
|
|
2731
|
+
*/
|
|
2732
|
+
export function mesh_split_by_surface_to_brep(vertex_count, buffer, surface_data, tolerance, normal_angle_tol_deg, max_faces) {
|
|
2733
|
+
let deferred3_0;
|
|
2734
|
+
let deferred3_1;
|
|
2735
|
+
try {
|
|
2736
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2737
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2738
|
+
const ptr1 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
|
|
2739
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2740
|
+
const ret = wasm.mesh_split_by_surface_to_brep(vertex_count, ptr0, len0, ptr1, len1, tolerance, normal_angle_tol_deg, max_faces);
|
|
2741
|
+
deferred3_0 = ret[0];
|
|
2742
|
+
deferred3_1 = ret[1];
|
|
2743
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2744
|
+
}
|
|
2745
|
+
finally {
|
|
2746
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Intersect a polyline with a triangle mesh (open sheets allowed) and split
|
|
2751
|
+
* it into pieces at every crossing. Hit points become the shared endpoints
|
|
2752
|
+
* of adjacent pieces; a closed loop is opened at the first hit (N hits → N
|
|
2753
|
+
* pieces), an open polyline yields N + 1 pieces. With no crossings the
|
|
2754
|
+
* original polyline comes back as one piece.
|
|
2755
|
+
*
|
|
2756
|
+
* Packing: a single flat polyline-group buffer
|
|
2757
|
+
* `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]` (same group encoding as
|
|
2758
|
+
* `mesh_clip_polyline`, but ONE list — pieces are not classified). Returns
|
|
2759
|
+
* an empty buffer on failure.
|
|
2760
|
+
* @param {number} vertex_count
|
|
2761
|
+
* @param {Float64Array} buffer
|
|
2762
|
+
* @param {Float64Array} points
|
|
2763
|
+
* @param {boolean} closed
|
|
2764
|
+
* @returns {Float64Array}
|
|
2765
|
+
*/
|
|
2766
|
+
export function mesh_split_polyline(vertex_count, buffer, points, closed) {
|
|
2767
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2768
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2769
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
2770
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2771
|
+
const ret = wasm.mesh_split_polyline(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
2772
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2773
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2774
|
+
return v3;
|
|
2775
|
+
}
|
|
2296
2776
|
/**
|
|
2297
2777
|
* Trim an OPEN host surface by all closed cutter meshes in one WASM call.
|
|
2298
2778
|
*
|
|
@@ -2427,6 +2907,31 @@ export function nurbs_curve_curve_intersect(data_a, data_b) {
|
|
|
2427
2907
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2428
2908
|
return v3;
|
|
2429
2909
|
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Find all intersections between two NURBS curves, with exact parameters.
|
|
2912
|
+
*
|
|
2913
|
+
* Inputs are standard NURBS curve encodings
|
|
2914
|
+
* `[degree, num_cp, cp_xyz..., weights..., knots...]` (the same format
|
|
2915
|
+
* consumed by `sample_nurbs_curve` / produced by `build_nurbs_curve`).
|
|
2916
|
+
*
|
|
2917
|
+
* Packing: `[count, (x, y, z, paramA, paramB)·count]`. Parameters are
|
|
2918
|
+
* normalized to [0, 1]; results are sorted by `paramA`. Coincident
|
|
2919
|
+
* (overlapping) curve runs yield NO points (identical curves return
|
|
2920
|
+
* `[0]`). Returns an empty buffer on malformed input.
|
|
2921
|
+
* @param {Float64Array} curve_a_data
|
|
2922
|
+
* @param {Float64Array} curve_b_data
|
|
2923
|
+
* @returns {Float64Array}
|
|
2924
|
+
*/
|
|
2925
|
+
export function nurbs_curve_curve_intersect_params(curve_a_data, curve_b_data) {
|
|
2926
|
+
const ptr0 = passArrayF64ToWasm0(curve_a_data, wasm.__wbindgen_malloc);
|
|
2927
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2928
|
+
const ptr1 = passArrayF64ToWasm0(curve_b_data, wasm.__wbindgen_malloc);
|
|
2929
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2930
|
+
const ret = wasm.nurbs_curve_curve_intersect_params(ptr0, len0, ptr1, len1);
|
|
2931
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2932
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2933
|
+
return v3;
|
|
2934
|
+
}
|
|
2430
2935
|
/**
|
|
2431
2936
|
* Intersect a NURBS curve with a plane.
|
|
2432
2937
|
* Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
|
|
@@ -2446,6 +2951,66 @@ export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
|
|
|
2446
2951
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2447
2952
|
return v2;
|
|
2448
2953
|
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
|
|
2956
|
+
*
|
|
2957
|
+
* Splitting is exact (knot insertion), so every returned piece lies exactly
|
|
2958
|
+
* on the input curve. Parameters are sorted/deduplicated/clamped internally;
|
|
2959
|
+
* closed curves are opened at the FIRST parameter (N interior parameters →
|
|
2960
|
+
* N pieces), open curves yield N + 1 pieces. With no valid parameters the
|
|
2961
|
+
* (clamped) curve comes back as the single piece.
|
|
2962
|
+
*
|
|
2963
|
+
* `closed_hint` is an explicit topology override: `> 0` forces closed
|
|
2964
|
+
* (seam-rejoin) semantics, `0` forces open semantics (an open curve whose
|
|
2965
|
+
* endpoints merely coincide keeps N + 1 pieces), `< 0` infers closedness
|
|
2966
|
+
* geometrically from the endpoint distance (the historical behavior).
|
|
2967
|
+
*
|
|
2968
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
|
|
2969
|
+
* is the standard NURBS curve encoding (same multi-curve packing as
|
|
2970
|
+
* `brep_face_iso_curves_trimmed`). Returns an empty buffer on malformed
|
|
2971
|
+
* input.
|
|
2972
|
+
* @param {Float64Array} curve_data
|
|
2973
|
+
* @param {Float64Array} params
|
|
2974
|
+
* @param {number} closed_hint
|
|
2975
|
+
* @returns {Float64Array}
|
|
2976
|
+
*/
|
|
2977
|
+
export function nurbs_curve_split_at_params(curve_data, params, closed_hint) {
|
|
2978
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
2979
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2980
|
+
const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
2981
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2982
|
+
const ret = wasm.nurbs_curve_split_at_params(ptr0, len0, ptr1, len1, closed_hint);
|
|
2983
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2984
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2985
|
+
return v3;
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Find all isolated intersections of a NURBS curve with a NURBS surface,
|
|
2989
|
+
* with exact parameters.
|
|
2990
|
+
*
|
|
2991
|
+
* `curve_data` is the standard NURBS curve encoding; `surface_data` is the
|
|
2992
|
+
* standard NURBS surface encoding `[degree_u, degree_v, num_u, num_v,
|
|
2993
|
+
* cp(flat)..., weights..., knots_u..., knots_v...]` (same as
|
|
2994
|
+
* `nurbs_surface_evaluate`).
|
|
2995
|
+
*
|
|
2996
|
+
* Packing: `[count, (x, y, z, t, u, v)·count]`. All parameters are
|
|
2997
|
+
* normalized to [0, 1]; results are sorted by `t`. Curve segments lying ON
|
|
2998
|
+
* the surface (coincident runs) yield no points. Returns an empty buffer on
|
|
2999
|
+
* malformed input.
|
|
3000
|
+
* @param {Float64Array} curve_data
|
|
3001
|
+
* @param {Float64Array} surface_data
|
|
3002
|
+
* @returns {Float64Array}
|
|
3003
|
+
*/
|
|
3004
|
+
export function nurbs_curve_surface_intersect_exact(curve_data, surface_data) {
|
|
3005
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
3006
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3007
|
+
const ptr1 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
|
|
3008
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3009
|
+
const ret = wasm.nurbs_curve_surface_intersect_exact(ptr0, len0, ptr1, len1);
|
|
3010
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3011
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3012
|
+
return v3;
|
|
3013
|
+
}
|
|
2449
3014
|
/**
|
|
2450
3015
|
* Closest point on the surface to (x, y, z).
|
|
2451
3016
|
* Returns [u, v, px, py, pz] with u, v normalized to [0,1].
|
|
@@ -2718,6 +3283,36 @@ export function nurbs_surface_surface_intersect(data_a, data_b, tess) {
|
|
|
2718
3283
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2719
3284
|
return v3;
|
|
2720
3285
|
}
|
|
3286
|
+
/**
|
|
3287
|
+
* EXACT intersection curves of two FULL (untrimmed) NURBS surfaces: the
|
|
3288
|
+
* parametric boolean's SSI pipeline (seeded tri-tri, chaining, tangent-plane
|
|
3289
|
+
* relaxation) fitted to tolerance-verified interpolating NURBS curves —
|
|
3290
|
+
* unlike `nurbs_surface_surface_intersect`, which returns tessellated
|
|
3291
|
+
* polylines.
|
|
3292
|
+
*
|
|
3293
|
+
* Inputs are standard NURBS surface encodings; `tolerance` is absolute
|
|
3294
|
+
* (floored relative to the combined model scale kernel-side). Closed loops
|
|
3295
|
+
* come back as ONE closed curve; coincident (overlapping) surfaces yield no
|
|
3296
|
+
* curves (their overlap is a 2D region).
|
|
3297
|
+
*
|
|
3298
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
|
|
3299
|
+
* is the standard NURBS curve encoding. Returns an empty buffer on
|
|
3300
|
+
* malformed input.
|
|
3301
|
+
* @param {Float64Array} surf_a_data
|
|
3302
|
+
* @param {Float64Array} surf_b_data
|
|
3303
|
+
* @param {number} tolerance
|
|
3304
|
+
* @returns {Float64Array}
|
|
3305
|
+
*/
|
|
3306
|
+
export function nurbs_surface_surface_intersect_curves(surf_a_data, surf_b_data, tolerance) {
|
|
3307
|
+
const ptr0 = passArrayF64ToWasm0(surf_a_data, wasm.__wbindgen_malloc);
|
|
3308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3309
|
+
const ptr1 = passArrayF64ToWasm0(surf_b_data, wasm.__wbindgen_malloc);
|
|
3310
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3311
|
+
const ret = wasm.nurbs_surface_surface_intersect_curves(ptr0, len0, ptr1, len1, tolerance);
|
|
3312
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3313
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3314
|
+
return v3;
|
|
3315
|
+
}
|
|
2721
3316
|
/**
|
|
2722
3317
|
* Curvature-adaptive tessellation against a chordal tolerance.
|
|
2723
3318
|
* Returns the standard mesh buffer [vertexCount, positions..., indices...].
|