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/src/wasm-bindings.js
CHANGED
|
@@ -64,6 +64,78 @@ export function brep_boolean_op(a_json, b_json, op, tolerance) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Boolean-intersection clip of an exact NURBS curve against a CLOSED solid
|
|
69
|
+
* BREP: the curve is split exactly (knot insertion) at every boundary
|
|
70
|
+
* crossing and each piece is classified by containment. Every returned
|
|
71
|
+
* piece lies exactly on the input curve; closed curves merge the run
|
|
72
|
+
* spanning the parameter seam (same convention as `mesh_clip_polyline`).
|
|
73
|
+
*
|
|
74
|
+
* Packing: `[insideCount, (bufLen, curveData…)·insideCount,
|
|
75
|
+
* outsideCount, (bufLen, curveData…)·outsideCount]` — two concatenated
|
|
76
|
+
* multi-curve packings, inside pieces first. Returns an empty buffer on
|
|
77
|
+
* failure (malformed input, or a BREP that is not a closed solid).
|
|
78
|
+
* @param {Float64Array} curve_data
|
|
79
|
+
* @param {string} brep_json
|
|
80
|
+
* @returns {Float64Array}
|
|
81
|
+
*/
|
|
82
|
+
export function brep_clip_curve_op(curve_data, brep_json) {
|
|
83
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
84
|
+
const len0 = WASM_VECTOR_LEN;
|
|
85
|
+
const ptr1 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
86
|
+
const len1 = WASM_VECTOR_LEN;
|
|
87
|
+
const ret = wasm.brep_clip_curve_op(ptr0, len0, ptr1, len1);
|
|
88
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
89
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
90
|
+
return v3;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Closest BREP face to a 3D point. Returns [faceIndex, u, v, distance,
|
|
95
|
+
* isNurbs] ((u, v) in the surface's KNOT domain) or empty on failure.
|
|
96
|
+
* @param {string} json
|
|
97
|
+
* @param {number} x
|
|
98
|
+
* @param {number} y
|
|
99
|
+
* @param {number} z
|
|
100
|
+
* @returns {Float64Array}
|
|
101
|
+
*/
|
|
102
|
+
export function brep_closest_face(json, x, y, z) {
|
|
103
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
+
const len0 = WASM_VECTOR_LEN;
|
|
105
|
+
const ret = wasm.brep_closest_face(ptr0, len0, x, y, z);
|
|
106
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
107
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
108
|
+
return v2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Find all points where a NURBS curve pierces a BREP's faces: per face, the
|
|
113
|
+
* curve is intersected with the EXACT surface and kept only when the hit
|
|
114
|
+
* lies INSIDE the face's trimmed region; crossings on shared edges are
|
|
115
|
+
* deduplicated (smallest face index kept).
|
|
116
|
+
*
|
|
117
|
+
* `curve_data` is the standard NURBS curve encoding. Hits are sorted by
|
|
118
|
+
* curve parameter (normalized [0, 1]); (u, v) are in the face's OWN
|
|
119
|
+
* parameter space (knot domain for NURBS faces, plane-frame coordinates for
|
|
120
|
+
* planar faces).
|
|
121
|
+
*
|
|
122
|
+
* Packing: `[count, (x, y, z, curveParam, faceIndex, u, v)·count]`.
|
|
123
|
+
* Returns an empty buffer on malformed input.
|
|
124
|
+
* @param {string} brep_json
|
|
125
|
+
* @param {Float64Array} curve_data
|
|
126
|
+
* @returns {Float64Array}
|
|
127
|
+
*/
|
|
128
|
+
export function brep_curve_intersection_op(brep_json, curve_data) {
|
|
129
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len0 = WASM_VECTOR_LEN;
|
|
131
|
+
const ptr1 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
132
|
+
const len1 = WASM_VECTOR_LEN;
|
|
133
|
+
const ret = wasm.brep_curve_intersection_op(ptr0, len0, ptr1, len1);
|
|
134
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
135
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
136
|
+
return v3;
|
|
137
|
+
}
|
|
138
|
+
|
|
67
139
|
/**
|
|
68
140
|
* All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
|
|
69
141
|
* @param {string} json
|
|
@@ -79,6 +151,51 @@ export function brep_edges(json, tolerance) {
|
|
|
79
151
|
return v2;
|
|
80
152
|
}
|
|
81
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Extract one face as a standalone single-face TRIMMED sheet BREP (trim
|
|
156
|
+
* loops, pcurves, edges and vertices preserved). Returns JSON, empty on
|
|
157
|
+
* failure.
|
|
158
|
+
* @param {string} json
|
|
159
|
+
* @param {number} face_index
|
|
160
|
+
* @returns {string}
|
|
161
|
+
*/
|
|
162
|
+
export function brep_extract_face(json, face_index) {
|
|
163
|
+
let deferred2_0;
|
|
164
|
+
let deferred2_1;
|
|
165
|
+
try {
|
|
166
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.brep_extract_face(ptr0, len0, face_index);
|
|
169
|
+
deferred2_0 = ret[0];
|
|
170
|
+
deferred2_1 = ret[1];
|
|
171
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
172
|
+
} finally {
|
|
173
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* ALL faces as standalone single-face trimmed sheet BREPs, in one crossing
|
|
179
|
+
* (the source JSON is parsed once). Returns a JSON ARRAY aligned with face
|
|
180
|
+
* indices; faces that fail to extract are `null`.
|
|
181
|
+
* @param {string} json
|
|
182
|
+
* @returns {string}
|
|
183
|
+
*/
|
|
184
|
+
export function brep_extract_faces(json) {
|
|
185
|
+
let deferred2_0;
|
|
186
|
+
let deferred2_1;
|
|
187
|
+
try {
|
|
188
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
189
|
+
const len0 = WASM_VECTOR_LEN;
|
|
190
|
+
const ret = wasm.brep_extract_faces(ptr0, len0);
|
|
191
|
+
deferred2_0 = ret[0];
|
|
192
|
+
deferred2_1 = ret[1];
|
|
193
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
194
|
+
} finally {
|
|
195
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
82
199
|
/**
|
|
83
200
|
* Extrude a profile curve into a BREP (closed profile → capped solid,
|
|
84
201
|
* open profile → sheet). Returns JSON.
|
|
@@ -104,6 +221,25 @@ export function brep_extrude_curve(curve_data, dx, dy, dz, height) {
|
|
|
104
221
|
}
|
|
105
222
|
}
|
|
106
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Exact (u, v) of a point on a specific BREP face (closest-point Newton for
|
|
226
|
+
* NURBS, frame projection for planes). Returns [u, v, distance, isNurbs].
|
|
227
|
+
* @param {string} json
|
|
228
|
+
* @param {number} face_index
|
|
229
|
+
* @param {number} x
|
|
230
|
+
* @param {number} y
|
|
231
|
+
* @param {number} z
|
|
232
|
+
* @returns {Float64Array}
|
|
233
|
+
*/
|
|
234
|
+
export function brep_face_closest_uv(json, face_index, x, y, z) {
|
|
235
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
236
|
+
const len0 = WASM_VECTOR_LEN;
|
|
237
|
+
const ret = wasm.brep_face_closest_uv(ptr0, len0, face_index, x, y, z);
|
|
238
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
239
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
240
|
+
return v2;
|
|
241
|
+
}
|
|
242
|
+
|
|
107
243
|
/**
|
|
108
244
|
* Iso-parametric curve of a NURBS face's backing surface (untrimmed).
|
|
109
245
|
* Returns curve data, or empty for planar faces.
|
|
@@ -122,6 +258,46 @@ export function brep_face_iso_curve(json, face_index, t, u_dir) {
|
|
|
122
258
|
return v2;
|
|
123
259
|
}
|
|
124
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Exact isocurve(s) of a BREP face at KNOT-domain parameter `t`, CLIPPED to
|
|
263
|
+
* the face's trimmed region. `u_dir = true` runs along u at fixed v = t.
|
|
264
|
+
* Line pieces (planar faces) are encoded as degree-1 NURBS.
|
|
265
|
+
* Packing: [curveCount, (bufLen, curveData…)·curveCount] where curveData is
|
|
266
|
+
* the standard NURBS curve encoding.
|
|
267
|
+
* @param {string} json
|
|
268
|
+
* @param {number} face_index
|
|
269
|
+
* @param {number} t
|
|
270
|
+
* @param {boolean} u_dir
|
|
271
|
+
* @returns {Float64Array}
|
|
272
|
+
*/
|
|
273
|
+
export function brep_face_iso_curves_trimmed(json, face_index, t, u_dir) {
|
|
274
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
276
|
+
const ret = wasm.brep_face_iso_curves_trimmed(ptr0, len0, face_index, t, u_dir);
|
|
277
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
278
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
279
|
+
return v2;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Like `brep_face_iso_curves_trimmed`, but `t` is NORMALIZED [0, 1] across
|
|
284
|
+
* the face's trim extent in the fixed direction — callers don't need the
|
|
285
|
+
* surface knot domain. Same packing.
|
|
286
|
+
* @param {string} json
|
|
287
|
+
* @param {number} face_index
|
|
288
|
+
* @param {number} t
|
|
289
|
+
* @param {boolean} u_dir
|
|
290
|
+
* @returns {Float64Array}
|
|
291
|
+
*/
|
|
292
|
+
export function brep_face_iso_curves_trimmed_normalized(json, face_index, t, u_dir) {
|
|
293
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
294
|
+
const len0 = WASM_VECTOR_LEN;
|
|
295
|
+
const ret = wasm.brep_face_iso_curves_trimmed_normalized(ptr0, len0, face_index, t, u_dir);
|
|
296
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
297
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
298
|
+
return v2;
|
|
299
|
+
}
|
|
300
|
+
|
|
125
301
|
/**
|
|
126
302
|
* Geometric backing of a face.
|
|
127
303
|
* Returns [0, ox,oy,oz, ux,uy,uz, vx,vy,vz] for planes,
|
|
@@ -139,6 +315,39 @@ export function brep_face_surface(json, face_index) {
|
|
|
139
315
|
return v2;
|
|
140
316
|
}
|
|
141
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Underlying surface of a face CROPPED to its trim extent, ALWAYS as a NURBS
|
|
320
|
+
* surface (planar faces become exact degree-1 patches). Returns surface
|
|
321
|
+
* data, empty on failure.
|
|
322
|
+
* @param {string} json
|
|
323
|
+
* @param {number} face_index
|
|
324
|
+
* @returns {Float64Array}
|
|
325
|
+
*/
|
|
326
|
+
export function brep_face_surface_cropped(json, face_index) {
|
|
327
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
328
|
+
const len0 = WASM_VECTOR_LEN;
|
|
329
|
+
const ret = wasm.brep_face_surface_cropped(ptr0, len0, face_index);
|
|
330
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
331
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
332
|
+
return v2;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Batch variant of `brep_face_surface_cropped` for all faces in one
|
|
337
|
+
* crossing. Packing: [faceCount, (bufLen, surfaceData…)·faceCount], aligned
|
|
338
|
+
* with face indices — a face that fails to crop gets bufLen 0.
|
|
339
|
+
* @param {string} json
|
|
340
|
+
* @returns {Float64Array}
|
|
341
|
+
*/
|
|
342
|
+
export function brep_face_surfaces_cropped(json) {
|
|
343
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.brep_face_surfaces_cropped(ptr0, len0);
|
|
346
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
347
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
348
|
+
return v2;
|
|
349
|
+
}
|
|
350
|
+
|
|
142
351
|
/**
|
|
143
352
|
* Tessellate a single BREP face. Returns the standard mesh buffer.
|
|
144
353
|
* @param {string} json
|
|
@@ -155,6 +364,47 @@ export function brep_face_tessellate(json, face_index, tolerance) {
|
|
|
155
364
|
return v2;
|
|
156
365
|
}
|
|
157
366
|
|
|
367
|
+
/**
|
|
368
|
+
* UV bounding box of a face's trim loops in surface parameter space:
|
|
369
|
+
* [u_min, u_max, v_min, v_max]. Empty on failure.
|
|
370
|
+
* @param {string} json
|
|
371
|
+
* @param {number} face_index
|
|
372
|
+
* @returns {Float64Array}
|
|
373
|
+
*/
|
|
374
|
+
export function brep_face_trim_bounds(json, face_index) {
|
|
375
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
377
|
+
const ret = wasm.brep_face_trim_bounds(ptr0, len0, face_index);
|
|
378
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
379
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
380
|
+
return v2;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Convert a closed manifold triangle mesh into a planar-face BREP.
|
|
385
|
+
* `normal_angle_tol_deg` ≤ 0 selects the default (≈0.057°); `max_faces` 0 =
|
|
386
|
+
* default guard (4096). Returns BREP JSON or {"error": ...}.
|
|
387
|
+
* @param {number} vertex_count
|
|
388
|
+
* @param {Float64Array} buffer
|
|
389
|
+
* @param {number} normal_angle_tol_deg
|
|
390
|
+
* @param {number} max_faces
|
|
391
|
+
* @returns {string}
|
|
392
|
+
*/
|
|
393
|
+
export function brep_from_mesh_buffer(vertex_count, buffer, normal_angle_tol_deg, max_faces) {
|
|
394
|
+
let deferred2_0;
|
|
395
|
+
let deferred2_1;
|
|
396
|
+
try {
|
|
397
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
399
|
+
const ret = wasm.brep_from_mesh_buffer(vertex_count, ptr0, len0, normal_angle_tol_deg, max_faces);
|
|
400
|
+
deferred2_0 = ret[0];
|
|
401
|
+
deferred2_1 = ret[1];
|
|
402
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
403
|
+
} finally {
|
|
404
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
158
408
|
/**
|
|
159
409
|
* BREP structure summary: [face_count, edge_count, vertex_count, is_closed].
|
|
160
410
|
* @param {string} json
|
|
@@ -169,6 +419,36 @@ export function brep_info(json) {
|
|
|
169
419
|
return v2;
|
|
170
420
|
}
|
|
171
421
|
|
|
422
|
+
/**
|
|
423
|
+
* TRIM-EXACT intersection curves between two BREPs (solids OR sheets): the
|
|
424
|
+
* parametric boolean's SSI → clip → convergence stages run and the fitted 3D
|
|
425
|
+
* intersection edges come back WITHOUT classification/assembly.
|
|
426
|
+
*
|
|
427
|
+
* A closed intersection loop may come back as several contiguous pieces
|
|
428
|
+
* (split at surface seams and face-boundary crossings); the pieces chain
|
|
429
|
+
* end-to-end exactly. Coincident (overlapping) face pairs contribute no
|
|
430
|
+
* curves.
|
|
431
|
+
*
|
|
432
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (standard NURBS
|
|
433
|
+
* curve encoding). Returns an EMPTY buffer on failure (invalid BREP JSON or
|
|
434
|
+
* a pipeline error) — distinguishable from `[0]`, which means the operands
|
|
435
|
+
* genuinely do not intersect.
|
|
436
|
+
* @param {string} a_json
|
|
437
|
+
* @param {string} b_json
|
|
438
|
+
* @param {number} tolerance
|
|
439
|
+
* @returns {Float64Array}
|
|
440
|
+
*/
|
|
441
|
+
export function brep_intersection_curves_op(a_json, b_json, tolerance) {
|
|
442
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
444
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
445
|
+
const len1 = WASM_VECTOR_LEN;
|
|
446
|
+
const ret = wasm.brep_intersection_curves_op(ptr0, len0, ptr1, len1, tolerance);
|
|
447
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
448
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
449
|
+
return v3;
|
|
450
|
+
}
|
|
451
|
+
|
|
172
452
|
/**
|
|
173
453
|
* Loft through profile curves into a BREP.
|
|
174
454
|
* Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
|
|
@@ -190,6 +470,33 @@ export function brep_loft_curves(data) {
|
|
|
190
470
|
}
|
|
191
471
|
}
|
|
192
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Intersection curves between a BREP and a triangle mesh.
|
|
475
|
+
*
|
|
476
|
+
* TESSELLATION-BASED (documented approximation): the BREP is tessellated at
|
|
477
|
+
* `tolerance` (pass `<= 0` for the deterministic auto display tolerance)
|
|
478
|
+
* and intersected with the mesh via BVH-pruned tri-tri crossing + chaining.
|
|
479
|
+
*
|
|
480
|
+
* Mesh input is the standard `[vertexCount, positions..., indices...]`
|
|
481
|
+
* buffer. Returns the standard polyline group packing
|
|
482
|
+
* `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]`; empty on failure.
|
|
483
|
+
* @param {string} brep_json
|
|
484
|
+
* @param {number} vertex_count
|
|
485
|
+
* @param {Float64Array} mesh_buffer
|
|
486
|
+
* @param {number} tolerance
|
|
487
|
+
* @returns {Float64Array}
|
|
488
|
+
*/
|
|
489
|
+
export function brep_mesh_intersection_curves_op(brep_json, vertex_count, mesh_buffer, tolerance) {
|
|
490
|
+
const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
491
|
+
const len0 = WASM_VECTOR_LEN;
|
|
492
|
+
const ptr1 = passArrayF64ToWasm0(mesh_buffer, wasm.__wbindgen_malloc);
|
|
493
|
+
const len1 = WASM_VECTOR_LEN;
|
|
494
|
+
const ret = wasm.brep_mesh_intersection_curves_op(ptr0, len0, vertex_count, ptr1, len1, tolerance);
|
|
495
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
496
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
497
|
+
return v3;
|
|
498
|
+
}
|
|
499
|
+
|
|
193
500
|
/**
|
|
194
501
|
* BREP primitives.
|
|
195
502
|
* kind: "box" [minx,miny,minz, maxx,maxy,maxz]
|
|
@@ -266,6 +573,33 @@ export function brep_sheet_from_surface(surface_data) {
|
|
|
266
573
|
}
|
|
267
574
|
}
|
|
268
575
|
|
|
576
|
+
/**
|
|
577
|
+
* Split a closed solid BREP by a sheet BREP into BOTH capped halves.
|
|
578
|
+
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
579
|
+
* Sides follow the sheet normal (negative = behind it), matching
|
|
580
|
+
* `mesh_solid_split_by_surface`.
|
|
581
|
+
* @param {string} solid_json
|
|
582
|
+
* @param {string} sheet_json
|
|
583
|
+
* @param {number} tolerance
|
|
584
|
+
* @returns {string}
|
|
585
|
+
*/
|
|
586
|
+
export function brep_split_solid_by_sheet_op(solid_json, sheet_json, tolerance) {
|
|
587
|
+
let deferred3_0;
|
|
588
|
+
let deferred3_1;
|
|
589
|
+
try {
|
|
590
|
+
const ptr0 = passStringToWasm0(solid_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
591
|
+
const len0 = WASM_VECTOR_LEN;
|
|
592
|
+
const ptr1 = passStringToWasm0(sheet_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
593
|
+
const len1 = WASM_VECTOR_LEN;
|
|
594
|
+
const ret = wasm.brep_split_solid_by_sheet_op(ptr0, len0, ptr1, len1, tolerance);
|
|
595
|
+
deferred3_0 = ret[0];
|
|
596
|
+
deferred3_1 = ret[1];
|
|
597
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
598
|
+
} finally {
|
|
599
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
269
603
|
/**
|
|
270
604
|
* Tessellate a BREP into the standard mesh buffer
|
|
271
605
|
* [vertexCount, positions..., indices...]. Crack-free across shared edges.
|
|
@@ -282,6 +616,26 @@ export function brep_tessellate(json, tolerance) {
|
|
|
282
616
|
return v2;
|
|
283
617
|
}
|
|
284
618
|
|
|
619
|
+
/**
|
|
620
|
+
* Tessellate a BREP with per-face triangle ranges for face-level picking.
|
|
621
|
+
* `tolerance <= 0` selects the deterministic auto display tolerance (from the
|
|
622
|
+
* BREP's own extent), so triangle indices from a previously produced
|
|
623
|
+
* auto-tolerance display mesh stay valid across calls.
|
|
624
|
+
* Packing: [vertexCount, indexCount, rangeCount,
|
|
625
|
+
* positions(3·vc), indices(ic), (face, firstTri, triCount)·rc].
|
|
626
|
+
* @param {string} json
|
|
627
|
+
* @param {number} tolerance
|
|
628
|
+
* @returns {Float64Array}
|
|
629
|
+
*/
|
|
630
|
+
export function brep_tessellate_with_face_ranges(json, tolerance) {
|
|
631
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
632
|
+
const len0 = WASM_VECTOR_LEN;
|
|
633
|
+
const ret = wasm.brep_tessellate_with_face_ranges(ptr0, len0, tolerance);
|
|
634
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
635
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
636
|
+
return v2;
|
|
637
|
+
}
|
|
638
|
+
|
|
285
639
|
/**
|
|
286
640
|
* Apply a row-major 4x4 matrix to a BREP. Returns transformed JSON.
|
|
287
641
|
* @param {string} json
|
|
@@ -1564,6 +1918,36 @@ export function mesh_clip_polyline(vertex_count, buffer, points, closed) {
|
|
|
1564
1918
|
return v3;
|
|
1565
1919
|
}
|
|
1566
1920
|
|
|
1921
|
+
/**
|
|
1922
|
+
* Clip a polyline by an OPEN oriented sheet: split it at every sheet
|
|
1923
|
+
* crossing and classify each piece by the SIGNED SIDE of the sheet. This is
|
|
1924
|
+
* side classification, NOT containment (unlike `mesh_clip_polyline`, which
|
|
1925
|
+
* requires a closed volume): pieces far from the sheet still classify by
|
|
1926
|
+
* the nearest facet's normal. `inside` = the positive side, in FRONT of the
|
|
1927
|
+
* sheet normal; `outside` = behind it. The sheet may be any non-empty
|
|
1928
|
+
* triangle mesh, open or closed; its stored winding defines the normals.
|
|
1929
|
+
*
|
|
1930
|
+
* Returns two concatenated polyline buffers — inside pieces first, then
|
|
1931
|
+
* outside pieces — each encoded as `[num_polylines, n1, x,y,z,..., ...]`
|
|
1932
|
+
* (identical packing to `mesh_clip_polyline`). Returns an empty buffer on
|
|
1933
|
+
* failure (degenerate polyline/sheet).
|
|
1934
|
+
* @param {number} vertex_count
|
|
1935
|
+
* @param {Float64Array} buffer
|
|
1936
|
+
* @param {Float64Array} points
|
|
1937
|
+
* @param {boolean} closed
|
|
1938
|
+
* @returns {Float64Array}
|
|
1939
|
+
*/
|
|
1940
|
+
export function mesh_clip_polyline_by_sheet(vertex_count, buffer, points, closed) {
|
|
1941
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1942
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1943
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1944
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1945
|
+
const ret = wasm.mesh_clip_polyline_by_sheet(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
1946
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1947
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1948
|
+
return v3;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1567
1951
|
/**
|
|
1568
1952
|
* Compute planar curve normal from ordered points.
|
|
1569
1953
|
* @param {Float64Array} coords
|
|
@@ -1930,6 +2314,30 @@ export function mesh_get_face_area(vertex_count, buffer, face_index) {
|
|
|
1930
2314
|
return ret;
|
|
1931
2315
|
}
|
|
1932
2316
|
|
|
2317
|
+
/**
|
|
2318
|
+
* Boundary loops of the coplanar connected face group containing `face_index`.
|
|
2319
|
+
*
|
|
2320
|
+
* Boundary edges are the directed triangle edges whose reversed twin is not
|
|
2321
|
+
* present within the group; chaining them preserves the group's winding.
|
|
2322
|
+
* Consecutive collinear points (T-junction subdivisions) are collapsed so
|
|
2323
|
+
* consumers receive clean polygon corners.
|
|
2324
|
+
*
|
|
2325
|
+
* Output format: [loopCount, (pointCount, x, y, z, ...) per loop].
|
|
2326
|
+
* Loops are implicitly closed (last point connects back to the first).
|
|
2327
|
+
* @param {number} vertex_count
|
|
2328
|
+
* @param {Float64Array} buffer
|
|
2329
|
+
* @param {number} face_index
|
|
2330
|
+
* @returns {Float64Array}
|
|
2331
|
+
*/
|
|
2332
|
+
export function mesh_get_face_boundary_loops(vertex_count, buffer, face_index) {
|
|
2333
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2334
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2335
|
+
const ret = wasm.mesh_get_face_boundary_loops(vertex_count, ptr0, len0, face_index);
|
|
2336
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2337
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2338
|
+
return v2;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
1933
2341
|
/**
|
|
1934
2342
|
* Face centroid as [x, y, z].
|
|
1935
2343
|
* @param {number} vertex_count
|
|
@@ -2205,6 +2613,36 @@ export function mesh_plane_intersect(vertex_count, buffer, nx, ny, nz, d) {
|
|
|
2205
2613
|
return v2;
|
|
2206
2614
|
}
|
|
2207
2615
|
|
|
2616
|
+
/**
|
|
2617
|
+
* Compute all transversal crossing points of a polyline with a triangle
|
|
2618
|
+
* mesh. Works on OPEN meshes (sheets) — the mesh is NOT required to be a
|
|
2619
|
+
* closed volume, unlike `mesh_clip_polyline`.
|
|
2620
|
+
*
|
|
2621
|
+
* `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
|
|
2622
|
+
* (segment `i` runs `points[i] → points[(i+1) % n]`; open polylines have
|
|
2623
|
+
* n−1 segments, closed ones n).
|
|
2624
|
+
*
|
|
2625
|
+
* Packing: `[count, (x, y, z, segmentIndex, segmentT, triangleIndex)·count]`,
|
|
2626
|
+
* sorted by (segmentIndex, segmentT). Shared-edge/vertex crossings dedupe to
|
|
2627
|
+
* one hit (smallest triangle index kept); coplanar sliding overlaps yield no
|
|
2628
|
+
* hits. Returns an empty buffer on failure (degenerate polyline/mesh).
|
|
2629
|
+
* @param {number} vertex_count
|
|
2630
|
+
* @param {Float64Array} buffer
|
|
2631
|
+
* @param {Float64Array} points
|
|
2632
|
+
* @param {boolean} closed
|
|
2633
|
+
* @returns {Float64Array}
|
|
2634
|
+
*/
|
|
2635
|
+
export function mesh_polyline_intersection_points(vertex_count, buffer, points, closed) {
|
|
2636
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2637
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2638
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
2639
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2640
|
+
const ret = wasm.mesh_polyline_intersection_points(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
2641
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2642
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2643
|
+
return v3;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2208
2646
|
/**
|
|
2209
2647
|
* Shift closed boolean cutter curve and adjust height.
|
|
2210
2648
|
* Returns [height, epsilon, pointCount, x,y,z,...]
|
|
@@ -2379,6 +2817,64 @@ export function mesh_solid_split_plane(vertex_count, buffer, nx, ny, nz, d, oper
|
|
|
2379
2817
|
return v3;
|
|
2380
2818
|
}
|
|
2381
2819
|
|
|
2820
|
+
/**
|
|
2821
|
+
* One-shot production path: closed manifold triangle mesh ÷ NURBS surface →
|
|
2822
|
+
* both halves as exact capped BREPs, in a single WASM crossing (mesh→BREP
|
|
2823
|
+
* conversion, sheet construction and the parametric split all run kernel-side).
|
|
2824
|
+
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
2825
|
+
* @param {number} vertex_count
|
|
2826
|
+
* @param {Float64Array} buffer
|
|
2827
|
+
* @param {Float64Array} surface_data
|
|
2828
|
+
* @param {number} tolerance
|
|
2829
|
+
* @param {number} normal_angle_tol_deg
|
|
2830
|
+
* @param {number} max_faces
|
|
2831
|
+
* @returns {string}
|
|
2832
|
+
*/
|
|
2833
|
+
export function mesh_split_by_surface_to_brep(vertex_count, buffer, surface_data, tolerance, normal_angle_tol_deg, max_faces) {
|
|
2834
|
+
let deferred3_0;
|
|
2835
|
+
let deferred3_1;
|
|
2836
|
+
try {
|
|
2837
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2838
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2839
|
+
const ptr1 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
|
|
2840
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2841
|
+
const ret = wasm.mesh_split_by_surface_to_brep(vertex_count, ptr0, len0, ptr1, len1, tolerance, normal_angle_tol_deg, max_faces);
|
|
2842
|
+
deferred3_0 = ret[0];
|
|
2843
|
+
deferred3_1 = ret[1];
|
|
2844
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2845
|
+
} finally {
|
|
2846
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* Intersect a polyline with a triangle mesh (open sheets allowed) and split
|
|
2852
|
+
* it into pieces at every crossing. Hit points become the shared endpoints
|
|
2853
|
+
* of adjacent pieces; a closed loop is opened at the first hit (N hits → N
|
|
2854
|
+
* pieces), an open polyline yields N + 1 pieces. With no crossings the
|
|
2855
|
+
* original polyline comes back as one piece.
|
|
2856
|
+
*
|
|
2857
|
+
* Packing: a single flat polyline-group buffer
|
|
2858
|
+
* `[num_polylines, n1, x,y,z,..., n2, x,y,z,...]` (same group encoding as
|
|
2859
|
+
* `mesh_clip_polyline`, but ONE list — pieces are not classified). Returns
|
|
2860
|
+
* an empty buffer on failure.
|
|
2861
|
+
* @param {number} vertex_count
|
|
2862
|
+
* @param {Float64Array} buffer
|
|
2863
|
+
* @param {Float64Array} points
|
|
2864
|
+
* @param {boolean} closed
|
|
2865
|
+
* @returns {Float64Array}
|
|
2866
|
+
*/
|
|
2867
|
+
export function mesh_split_polyline(vertex_count, buffer, points, closed) {
|
|
2868
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
2869
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2870
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
2871
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2872
|
+
const ret = wasm.mesh_split_polyline(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
2873
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2874
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2875
|
+
return v3;
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2382
2878
|
/**
|
|
2383
2879
|
* Trim an OPEN host surface by all closed cutter meshes in one WASM call.
|
|
2384
2880
|
*
|
|
@@ -2520,6 +3016,32 @@ export function nurbs_curve_curve_intersect(data_a, data_b) {
|
|
|
2520
3016
|
return v3;
|
|
2521
3017
|
}
|
|
2522
3018
|
|
|
3019
|
+
/**
|
|
3020
|
+
* Find all intersections between two NURBS curves, with exact parameters.
|
|
3021
|
+
*
|
|
3022
|
+
* Inputs are standard NURBS curve encodings
|
|
3023
|
+
* `[degree, num_cp, cp_xyz..., weights..., knots...]` (the same format
|
|
3024
|
+
* consumed by `sample_nurbs_curve` / produced by `build_nurbs_curve`).
|
|
3025
|
+
*
|
|
3026
|
+
* Packing: `[count, (x, y, z, paramA, paramB)·count]`. Parameters are
|
|
3027
|
+
* normalized to [0, 1]; results are sorted by `paramA`. Coincident
|
|
3028
|
+
* (overlapping) curve runs yield NO points (identical curves return
|
|
3029
|
+
* `[0]`). Returns an empty buffer on malformed input.
|
|
3030
|
+
* @param {Float64Array} curve_a_data
|
|
3031
|
+
* @param {Float64Array} curve_b_data
|
|
3032
|
+
* @returns {Float64Array}
|
|
3033
|
+
*/
|
|
3034
|
+
export function nurbs_curve_curve_intersect_params(curve_a_data, curve_b_data) {
|
|
3035
|
+
const ptr0 = passArrayF64ToWasm0(curve_a_data, wasm.__wbindgen_malloc);
|
|
3036
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3037
|
+
const ptr1 = passArrayF64ToWasm0(curve_b_data, wasm.__wbindgen_malloc);
|
|
3038
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3039
|
+
const ret = wasm.nurbs_curve_curve_intersect_params(ptr0, len0, ptr1, len1);
|
|
3040
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3041
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3042
|
+
return v3;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
2523
3045
|
/**
|
|
2524
3046
|
* Intersect a NURBS curve with a plane.
|
|
2525
3047
|
* Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
|
|
@@ -2540,6 +3062,68 @@ export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
|
|
|
2540
3062
|
return v2;
|
|
2541
3063
|
}
|
|
2542
3064
|
|
|
3065
|
+
/**
|
|
3066
|
+
* Split a NURBS curve at multiple normalized parameters t ∈ [0, 1].
|
|
3067
|
+
*
|
|
3068
|
+
* Splitting is exact (knot insertion), so every returned piece lies exactly
|
|
3069
|
+
* on the input curve. Parameters are sorted/deduplicated/clamped internally;
|
|
3070
|
+
* closed curves are opened at the FIRST parameter (N interior parameters →
|
|
3071
|
+
* N pieces), open curves yield N + 1 pieces. With no valid parameters the
|
|
3072
|
+
* (clamped) curve comes back as the single piece.
|
|
3073
|
+
*
|
|
3074
|
+
* `closed_hint` is an explicit topology override: `> 0` forces closed
|
|
3075
|
+
* (seam-rejoin) semantics, `0` forces open semantics (an open curve whose
|
|
3076
|
+
* endpoints merely coincide keeps N + 1 pieces), `< 0` infers closedness
|
|
3077
|
+
* geometrically from the endpoint distance (the historical behavior).
|
|
3078
|
+
*
|
|
3079
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
|
|
3080
|
+
* is the standard NURBS curve encoding (same multi-curve packing as
|
|
3081
|
+
* `brep_face_iso_curves_trimmed`). Returns an empty buffer on malformed
|
|
3082
|
+
* input.
|
|
3083
|
+
* @param {Float64Array} curve_data
|
|
3084
|
+
* @param {Float64Array} params
|
|
3085
|
+
* @param {number} closed_hint
|
|
3086
|
+
* @returns {Float64Array}
|
|
3087
|
+
*/
|
|
3088
|
+
export function nurbs_curve_split_at_params(curve_data, params, closed_hint) {
|
|
3089
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
3090
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3091
|
+
const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
3092
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3093
|
+
const ret = wasm.nurbs_curve_split_at_params(ptr0, len0, ptr1, len1, closed_hint);
|
|
3094
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3095
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3096
|
+
return v3;
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
/**
|
|
3100
|
+
* Find all isolated intersections of a NURBS curve with a NURBS surface,
|
|
3101
|
+
* with exact parameters.
|
|
3102
|
+
*
|
|
3103
|
+
* `curve_data` is the standard NURBS curve encoding; `surface_data` is the
|
|
3104
|
+
* standard NURBS surface encoding `[degree_u, degree_v, num_u, num_v,
|
|
3105
|
+
* cp(flat)..., weights..., knots_u..., knots_v...]` (same as
|
|
3106
|
+
* `nurbs_surface_evaluate`).
|
|
3107
|
+
*
|
|
3108
|
+
* Packing: `[count, (x, y, z, t, u, v)·count]`. All parameters are
|
|
3109
|
+
* normalized to [0, 1]; results are sorted by `t`. Curve segments lying ON
|
|
3110
|
+
* the surface (coincident runs) yield no points. Returns an empty buffer on
|
|
3111
|
+
* malformed input.
|
|
3112
|
+
* @param {Float64Array} curve_data
|
|
3113
|
+
* @param {Float64Array} surface_data
|
|
3114
|
+
* @returns {Float64Array}
|
|
3115
|
+
*/
|
|
3116
|
+
export function nurbs_curve_surface_intersect_exact(curve_data, surface_data) {
|
|
3117
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
3118
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3119
|
+
const ptr1 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
|
|
3120
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3121
|
+
const ret = wasm.nurbs_curve_surface_intersect_exact(ptr0, len0, ptr1, len1);
|
|
3122
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3123
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3124
|
+
return v3;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
2543
3127
|
/**
|
|
2544
3128
|
* Closest point on the surface to (x, y, z).
|
|
2545
3129
|
* Returns [u, v, px, py, pz] with u, v normalized to [0,1].
|
|
@@ -2828,6 +3412,37 @@ export function nurbs_surface_surface_intersect(data_a, data_b, tess) {
|
|
|
2828
3412
|
return v3;
|
|
2829
3413
|
}
|
|
2830
3414
|
|
|
3415
|
+
/**
|
|
3416
|
+
* EXACT intersection curves of two FULL (untrimmed) NURBS surfaces: the
|
|
3417
|
+
* parametric boolean's SSI pipeline (seeded tri-tri, chaining, tangent-plane
|
|
3418
|
+
* relaxation) fitted to tolerance-verified interpolating NURBS curves —
|
|
3419
|
+
* unlike `nurbs_surface_surface_intersect`, which returns tessellated
|
|
3420
|
+
* polylines.
|
|
3421
|
+
*
|
|
3422
|
+
* Inputs are standard NURBS surface encodings; `tolerance` is absolute
|
|
3423
|
+
* (floored relative to the combined model scale kernel-side). Closed loops
|
|
3424
|
+
* come back as ONE closed curve; coincident (overlapping) surfaces yield no
|
|
3425
|
+
* curves (their overlap is a 2D region).
|
|
3426
|
+
*
|
|
3427
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` where curveData
|
|
3428
|
+
* is the standard NURBS curve encoding. Returns an empty buffer on
|
|
3429
|
+
* malformed input.
|
|
3430
|
+
* @param {Float64Array} surf_a_data
|
|
3431
|
+
* @param {Float64Array} surf_b_data
|
|
3432
|
+
* @param {number} tolerance
|
|
3433
|
+
* @returns {Float64Array}
|
|
3434
|
+
*/
|
|
3435
|
+
export function nurbs_surface_surface_intersect_curves(surf_a_data, surf_b_data, tolerance) {
|
|
3436
|
+
const ptr0 = passArrayF64ToWasm0(surf_a_data, wasm.__wbindgen_malloc);
|
|
3437
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3438
|
+
const ptr1 = passArrayF64ToWasm0(surf_b_data, wasm.__wbindgen_malloc);
|
|
3439
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3440
|
+
const ret = wasm.nurbs_surface_surface_intersect_curves(ptr0, len0, ptr1, len1, tolerance);
|
|
3441
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3442
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3443
|
+
return v3;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
2831
3446
|
/**
|
|
2832
3447
|
* Curvature-adaptive tessellation against a chordal tolerance.
|
|
2833
3448
|
* Returns the standard mesh buffer [vertexCount, positions..., indices...].
|