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.
- package/dist/Brep.d.ts +177 -0
- package/dist/Brep.d.ts.map +1 -0
- package/dist/Brep.js +368 -0
- package/dist/Brep.js.map +1 -0
- package/dist/Mesh.d.ts +40 -1
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +103 -0
- package/dist/Mesh.js.map +1 -1
- package/dist/NurbsSurface.d.ts +121 -0
- package/dist/NurbsSurface.d.ts.map +1 -1
- package/dist/NurbsSurface.js +261 -7
- package/dist/NurbsSurface.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- 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 +297 -0
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +588 -0
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +50 -48
- package/src/Brep.ts +437 -0
- package/src/Mesh.ts +124 -1
- package/src/NurbsSurface.ts +367 -62
- package/src/index.ts +77 -68
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +227 -0
- package/src/wasm-bindings.js +611 -0
package/dist/wasm-bindings.js
CHANGED
|
@@ -31,6 +31,307 @@ export function arc_point_at(cx, cy, cz, nx, ny, nz, radius, start_angle, end_an
|
|
|
31
31
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
32
32
|
return v1;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Parametric BREP boolean: exact surface–surface intersection curves with
|
|
36
|
+
* trimmed-surface output. Both operands must be closed solids.
|
|
37
|
+
* op: "union" | "intersect" | "subtract".
|
|
38
|
+
* Returns the result BREP as JSON, or {"error": "..."} on failure.
|
|
39
|
+
* @param {string} a_json
|
|
40
|
+
* @param {string} b_json
|
|
41
|
+
* @param {string} op
|
|
42
|
+
* @param {number} tolerance
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
export function brep_boolean_op(a_json, b_json, op, tolerance) {
|
|
46
|
+
let deferred4_0;
|
|
47
|
+
let deferred4_1;
|
|
48
|
+
try {
|
|
49
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
50
|
+
const len0 = WASM_VECTOR_LEN;
|
|
51
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
52
|
+
const len1 = WASM_VECTOR_LEN;
|
|
53
|
+
const ptr2 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
54
|
+
const len2 = WASM_VECTOR_LEN;
|
|
55
|
+
const ret = wasm.brep_boolean_op(ptr0, len0, ptr1, len1, ptr2, len2, tolerance);
|
|
56
|
+
deferred4_0 = ret[0];
|
|
57
|
+
deferred4_1 = ret[1];
|
|
58
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* All BREP edges as polylines: [num_polylines, n1, x,y,z..., n2, ...].
|
|
66
|
+
* @param {string} json
|
|
67
|
+
* @param {number} tolerance
|
|
68
|
+
* @returns {Float64Array}
|
|
69
|
+
*/
|
|
70
|
+
export function brep_edges(json, tolerance) {
|
|
71
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
72
|
+
const len0 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm.brep_edges(ptr0, len0, tolerance);
|
|
74
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
75
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
76
|
+
return v2;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Extrude a profile curve into a BREP (closed profile → capped solid,
|
|
80
|
+
* open profile → sheet). Returns JSON.
|
|
81
|
+
* @param {Float64Array} curve_data
|
|
82
|
+
* @param {number} dx
|
|
83
|
+
* @param {number} dy
|
|
84
|
+
* @param {number} dz
|
|
85
|
+
* @param {number} height
|
|
86
|
+
* @returns {string}
|
|
87
|
+
*/
|
|
88
|
+
export function brep_extrude_curve(curve_data, dx, dy, dz, height) {
|
|
89
|
+
let deferred2_0;
|
|
90
|
+
let deferred2_1;
|
|
91
|
+
try {
|
|
92
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
93
|
+
const len0 = WASM_VECTOR_LEN;
|
|
94
|
+
const ret = wasm.brep_extrude_curve(ptr0, len0, dx, dy, dz, height);
|
|
95
|
+
deferred2_0 = ret[0];
|
|
96
|
+
deferred2_1 = ret[1];
|
|
97
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Iso-parametric curve of a NURBS face's backing surface (untrimmed).
|
|
105
|
+
* Returns curve data, or empty for planar faces.
|
|
106
|
+
* @param {string} json
|
|
107
|
+
* @param {number} face_index
|
|
108
|
+
* @param {number} t
|
|
109
|
+
* @param {boolean} u_dir
|
|
110
|
+
* @returns {Float64Array}
|
|
111
|
+
*/
|
|
112
|
+
export function brep_face_iso_curve(json, face_index, t, u_dir) {
|
|
113
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
114
|
+
const len0 = WASM_VECTOR_LEN;
|
|
115
|
+
const ret = wasm.brep_face_iso_curve(ptr0, len0, face_index, t, u_dir);
|
|
116
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
117
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
118
|
+
return v2;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Geometric backing of a face.
|
|
122
|
+
* Returns [0, ox,oy,oz, ux,uy,uz, vx,vy,vz] for planes,
|
|
123
|
+
* or [1, surface_data...] for NURBS faces.
|
|
124
|
+
* @param {string} json
|
|
125
|
+
* @param {number} face_index
|
|
126
|
+
* @returns {Float64Array}
|
|
127
|
+
*/
|
|
128
|
+
export function brep_face_surface(json, face_index) {
|
|
129
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
130
|
+
const len0 = WASM_VECTOR_LEN;
|
|
131
|
+
const ret = wasm.brep_face_surface(ptr0, len0, face_index);
|
|
132
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
133
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
134
|
+
return v2;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Tessellate a single BREP face. Returns the standard mesh buffer.
|
|
138
|
+
* @param {string} json
|
|
139
|
+
* @param {number} face_index
|
|
140
|
+
* @param {number} tolerance
|
|
141
|
+
* @returns {Float64Array}
|
|
142
|
+
*/
|
|
143
|
+
export function brep_face_tessellate(json, face_index, tolerance) {
|
|
144
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
const ret = wasm.brep_face_tessellate(ptr0, len0, face_index, tolerance);
|
|
147
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
148
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
149
|
+
return v2;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* BREP structure summary: [face_count, edge_count, vertex_count, is_closed].
|
|
153
|
+
* @param {string} json
|
|
154
|
+
* @returns {Float64Array}
|
|
155
|
+
*/
|
|
156
|
+
export function brep_info(json) {
|
|
157
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
158
|
+
const len0 = WASM_VECTOR_LEN;
|
|
159
|
+
const ret = wasm.brep_info(ptr0, len0);
|
|
160
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
161
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
162
|
+
return v2;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Loft through profile curves into a BREP.
|
|
166
|
+
* Input: [num_curves, curve1_data..., curve2_data...]. Returns JSON.
|
|
167
|
+
* @param {Float64Array} data
|
|
168
|
+
* @returns {string}
|
|
169
|
+
*/
|
|
170
|
+
export function brep_loft_curves(data) {
|
|
171
|
+
let deferred2_0;
|
|
172
|
+
let deferred2_1;
|
|
173
|
+
try {
|
|
174
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
175
|
+
const len0 = WASM_VECTOR_LEN;
|
|
176
|
+
const ret = wasm.brep_loft_curves(ptr0, len0);
|
|
177
|
+
deferred2_0 = ret[0];
|
|
178
|
+
deferred2_1 = ret[1];
|
|
179
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* BREP primitives.
|
|
187
|
+
* kind: "box" [minx,miny,minz, maxx,maxy,maxz]
|
|
188
|
+
* "cylinder" [bx,by,bz, ax,ay,az, radius, height]
|
|
189
|
+
* "sphere" [cx,cy,cz, radius]
|
|
190
|
+
* "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
|
|
191
|
+
* "torus" [cx,cy,cz, major, minor]
|
|
192
|
+
* Returns the BREP as JSON ("" on failure).
|
|
193
|
+
* @param {string} kind
|
|
194
|
+
* @param {Float64Array} params
|
|
195
|
+
* @returns {string}
|
|
196
|
+
*/
|
|
197
|
+
export function brep_primitive(kind, params) {
|
|
198
|
+
let deferred3_0;
|
|
199
|
+
let deferred3_1;
|
|
200
|
+
try {
|
|
201
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
202
|
+
const len0 = WASM_VECTOR_LEN;
|
|
203
|
+
const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
204
|
+
const len1 = WASM_VECTOR_LEN;
|
|
205
|
+
const ret = wasm.brep_primitive(ptr0, len0, ptr1, len1);
|
|
206
|
+
deferred3_0 = ret[0];
|
|
207
|
+
deferred3_1 = ret[1];
|
|
208
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Revolve a profile curve into a BREP. Returns JSON.
|
|
216
|
+
* @param {Float64Array} curve_data
|
|
217
|
+
* @param {number} ox
|
|
218
|
+
* @param {number} oy
|
|
219
|
+
* @param {number} oz
|
|
220
|
+
* @param {number} ax
|
|
221
|
+
* @param {number} ay
|
|
222
|
+
* @param {number} az
|
|
223
|
+
* @param {number} angle
|
|
224
|
+
* @returns {string}
|
|
225
|
+
*/
|
|
226
|
+
export function brep_revolve_curve(curve_data, ox, oy, oz, ax, ay, az, angle) {
|
|
227
|
+
let deferred2_0;
|
|
228
|
+
let deferred2_1;
|
|
229
|
+
try {
|
|
230
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
231
|
+
const len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ret = wasm.brep_revolve_curve(ptr0, len0, ox, oy, oz, ax, ay, az, angle);
|
|
233
|
+
deferred2_0 = ret[0];
|
|
234
|
+
deferred2_1 = ret[1];
|
|
235
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Untrimmed sheet BREP from a NURBS surface. Returns JSON.
|
|
243
|
+
* @param {Float64Array} surface_data
|
|
244
|
+
* @returns {string}
|
|
245
|
+
*/
|
|
246
|
+
export function brep_sheet_from_surface(surface_data) {
|
|
247
|
+
let deferred2_0;
|
|
248
|
+
let deferred2_1;
|
|
249
|
+
try {
|
|
250
|
+
const ptr0 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
|
|
251
|
+
const len0 = WASM_VECTOR_LEN;
|
|
252
|
+
const ret = wasm.brep_sheet_from_surface(ptr0, len0);
|
|
253
|
+
deferred2_0 = ret[0];
|
|
254
|
+
deferred2_1 = ret[1];
|
|
255
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Tessellate a BREP into the standard mesh buffer
|
|
263
|
+
* [vertexCount, positions..., indices...]. Crack-free across shared edges.
|
|
264
|
+
* @param {string} json
|
|
265
|
+
* @param {number} tolerance
|
|
266
|
+
* @returns {Float64Array}
|
|
267
|
+
*/
|
|
268
|
+
export function brep_tessellate(json, tolerance) {
|
|
269
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
const ret = wasm.brep_tessellate(ptr0, len0, tolerance);
|
|
272
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
273
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
274
|
+
return v2;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Apply a row-major 4x4 matrix to a BREP. Returns transformed JSON.
|
|
278
|
+
* @param {string} json
|
|
279
|
+
* @param {Float64Array} matrix
|
|
280
|
+
* @returns {string}
|
|
281
|
+
*/
|
|
282
|
+
export function brep_transform(json, matrix) {
|
|
283
|
+
let deferred3_0;
|
|
284
|
+
let deferred3_1;
|
|
285
|
+
try {
|
|
286
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
287
|
+
const len0 = WASM_VECTOR_LEN;
|
|
288
|
+
const ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
289
|
+
const len1 = WASM_VECTOR_LEN;
|
|
290
|
+
const ret = wasm.brep_transform(ptr0, len0, ptr1, len1);
|
|
291
|
+
deferred3_0 = ret[0];
|
|
292
|
+
deferred3_1 = ret[1];
|
|
293
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Validate a BREP. Returns a JSON report:
|
|
301
|
+
* {"isClosed":bool,"boundaryEdgeCount":n,"maxCoherenceError":e,"issues":[...]}
|
|
302
|
+
* @param {string} json
|
|
303
|
+
* @param {number} tolerance
|
|
304
|
+
* @returns {string}
|
|
305
|
+
*/
|
|
306
|
+
export function brep_validate(json, tolerance) {
|
|
307
|
+
let deferred2_0;
|
|
308
|
+
let deferred2_1;
|
|
309
|
+
try {
|
|
310
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
311
|
+
const len0 = WASM_VECTOR_LEN;
|
|
312
|
+
const ret = wasm.brep_validate(ptr0, len0, tolerance);
|
|
313
|
+
deferred2_0 = ret[0];
|
|
314
|
+
deferred2_1 = ret[1];
|
|
315
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Volume and surface area from tessellation: [volume, area].
|
|
323
|
+
* @param {string} json
|
|
324
|
+
* @param {number} tolerance
|
|
325
|
+
* @returns {Float64Array}
|
|
326
|
+
*/
|
|
327
|
+
export function brep_volume_area(json, tolerance) {
|
|
328
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
329
|
+
const len0 = WASM_VECTOR_LEN;
|
|
330
|
+
const ret = wasm.brep_volume_area(ptr0, len0, tolerance);
|
|
331
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
332
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
333
|
+
return v2;
|
|
334
|
+
}
|
|
34
335
|
/**
|
|
35
336
|
* Build a NURBS curve from raw control points with kernel-managed knots and weights.
|
|
36
337
|
*
|
|
@@ -1192,6 +1493,30 @@ export function mesh_chamfer_all_edges(mesh_type, params, offset) {
|
|
|
1192
1493
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1193
1494
|
return v3;
|
|
1194
1495
|
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Clip a polyline against a closed mesh volume (boolean intersection for curves).
|
|
1498
|
+
*
|
|
1499
|
+
* `points` is a flat [x,y,z, ...] vertex list; `closed` marks a closed loop
|
|
1500
|
+
* (no duplicated seam point required, one is tolerated).
|
|
1501
|
+
* Returns two concatenated polyline buffers — inside pieces first, then
|
|
1502
|
+
* outside pieces — each encoded as [num_polylines, n1, x,y,z,..., ...].
|
|
1503
|
+
* Returns an empty buffer on failure (open cutter, degenerate polyline).
|
|
1504
|
+
* @param {number} vertex_count
|
|
1505
|
+
* @param {Float64Array} buffer
|
|
1506
|
+
* @param {Float64Array} points
|
|
1507
|
+
* @param {boolean} closed
|
|
1508
|
+
* @returns {Float64Array}
|
|
1509
|
+
*/
|
|
1510
|
+
export function mesh_clip_polyline(vertex_count, buffer, points, closed) {
|
|
1511
|
+
const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1512
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1513
|
+
const ptr1 = passArrayF64ToWasm0(points, wasm.__wbindgen_malloc);
|
|
1514
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1515
|
+
const ret = wasm.mesh_clip_polyline(vertex_count, ptr0, len0, ptr1, len1, closed);
|
|
1516
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1517
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1518
|
+
return v3;
|
|
1519
|
+
}
|
|
1195
1520
|
/**
|
|
1196
1521
|
* Compute planar curve normal from ordered points.
|
|
1197
1522
|
* @param {Float64Array} coords
|
|
@@ -1865,6 +2190,31 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
|
|
|
1865
2190
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1866
2191
|
return v2;
|
|
1867
2192
|
}
|
|
2193
|
+
/**
|
|
2194
|
+
* Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
|
|
2195
|
+
* `outside` = the solid on the negative side of the surface, `inside` = the
|
|
2196
|
+
* positive side; each is capped by the portion of the surface inside the
|
|
2197
|
+
* solid, welded into a watertight result. Same packed layout as the other
|
|
2198
|
+
* split exports.
|
|
2199
|
+
* @param {number} vertex_count_a
|
|
2200
|
+
* @param {Float64Array} buffer_a
|
|
2201
|
+
* @param {number} vertex_count_b
|
|
2202
|
+
* @param {Float64Array} buffer_b
|
|
2203
|
+
* @param {string} operation
|
|
2204
|
+
* @returns {Float64Array}
|
|
2205
|
+
*/
|
|
2206
|
+
export function mesh_solid_split_by_surface(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
|
|
2207
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
2208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2209
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
2210
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2211
|
+
const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2212
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2213
|
+
const ret = wasm.mesh_solid_split_by_surface(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
2214
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2215
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2216
|
+
return v4;
|
|
2217
|
+
}
|
|
1868
2218
|
/**
|
|
1869
2219
|
* @param {number} vertex_count
|
|
1870
2220
|
* @param {Float64Array} buffer
|
|
@@ -2038,6 +2388,70 @@ export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
|
|
|
2038
2388
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2039
2389
|
return v2;
|
|
2040
2390
|
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Closest point on the surface to (x, y, z).
|
|
2393
|
+
* Returns [u, v, px, py, pz] with u, v normalized to [0,1].
|
|
2394
|
+
* @param {Float64Array} data
|
|
2395
|
+
* @param {number} x
|
|
2396
|
+
* @param {number} y
|
|
2397
|
+
* @param {number} z
|
|
2398
|
+
* @returns {Float64Array}
|
|
2399
|
+
*/
|
|
2400
|
+
export function nurbs_surface_closest_point(data, x, y, z) {
|
|
2401
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2402
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2403
|
+
const ret = wasm.nurbs_surface_closest_point(ptr0, len0, x, y, z);
|
|
2404
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2405
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2406
|
+
return v2;
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* Surface curvature at normalized (u, v): [k1, k2, gaussian, mean, nx, ny, nz].
|
|
2410
|
+
* @param {Float64Array} data
|
|
2411
|
+
* @param {number} u
|
|
2412
|
+
* @param {number} v
|
|
2413
|
+
* @returns {Float64Array}
|
|
2414
|
+
*/
|
|
2415
|
+
export function nurbs_surface_curvature(data, u, v) {
|
|
2416
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2418
|
+
const ret = wasm.nurbs_surface_curvature(ptr0, len0, u, v);
|
|
2419
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2420
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2421
|
+
return v2;
|
|
2422
|
+
}
|
|
2423
|
+
/**
|
|
2424
|
+
* Analytic surface derivatives at normalized (u, v) in [0,1]².
|
|
2425
|
+
* Returns 18 floats: [S, Su, Sv, Suu, Suv, Svv] (xyz each), derivatives taken
|
|
2426
|
+
* with respect to the NORMALIZED parameters (chain rule applied).
|
|
2427
|
+
* @param {Float64Array} data
|
|
2428
|
+
* @param {number} u
|
|
2429
|
+
* @param {number} v
|
|
2430
|
+
* @returns {Float64Array}
|
|
2431
|
+
*/
|
|
2432
|
+
export function nurbs_surface_derivatives(data, u, v) {
|
|
2433
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2434
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2435
|
+
const ret = wasm.nurbs_surface_derivatives(ptr0, len0, u, v);
|
|
2436
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2437
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2438
|
+
return v2;
|
|
2439
|
+
}
|
|
2440
|
+
/**
|
|
2441
|
+
* Exact degree elevation by `t` in one direction.
|
|
2442
|
+
* @param {Float64Array} data
|
|
2443
|
+
* @param {boolean} u_dir
|
|
2444
|
+
* @param {number} t
|
|
2445
|
+
* @returns {Float64Array}
|
|
2446
|
+
*/
|
|
2447
|
+
export function nurbs_surface_elevate_degree(data, u_dir, t) {
|
|
2448
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2449
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2450
|
+
const ret = wasm.nurbs_surface_elevate_degree(ptr0, len0, u_dir, t);
|
|
2451
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2452
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2453
|
+
return v2;
|
|
2454
|
+
}
|
|
2041
2455
|
/**
|
|
2042
2456
|
* Evaluate a NURBS surface at normalized parameters (u, v) in [0,1].
|
|
2043
2457
|
* Returns [x, y, z]
|
|
@@ -2054,6 +2468,73 @@ export function nurbs_surface_evaluate(data, u, v) {
|
|
|
2054
2468
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2055
2469
|
return v2;
|
|
2056
2470
|
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Exact sub-patch extraction over normalized ranges.
|
|
2473
|
+
* @param {Float64Array} data
|
|
2474
|
+
* @param {number} u0
|
|
2475
|
+
* @param {number} u1
|
|
2476
|
+
* @param {number} v0
|
|
2477
|
+
* @param {number} v1
|
|
2478
|
+
* @returns {Float64Array}
|
|
2479
|
+
*/
|
|
2480
|
+
export function nurbs_surface_extract_region(data, u0, u1, v0, v1) {
|
|
2481
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2482
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2483
|
+
const ret = wasm.nurbs_surface_extract_region(ptr0, len0, u0, u1, v0, v1);
|
|
2484
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2485
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2486
|
+
return v2;
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Exact extruded (translational) surface from a profile curve.
|
|
2490
|
+
* @param {Float64Array} curve_data
|
|
2491
|
+
* @param {number} dx
|
|
2492
|
+
* @param {number} dy
|
|
2493
|
+
* @param {number} dz
|
|
2494
|
+
* @returns {Float64Array}
|
|
2495
|
+
*/
|
|
2496
|
+
export function nurbs_surface_extrude(curve_data, dx, dy, dz) {
|
|
2497
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
2498
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2499
|
+
const ret = wasm.nurbs_surface_extrude(ptr0, len0, dx, dy, dz);
|
|
2500
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2501
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2502
|
+
return v2;
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* Exact knot insertion at normalized parameter t (repeated `times`).
|
|
2506
|
+
* Returns the refined surface in standard surface format.
|
|
2507
|
+
* @param {Float64Array} data
|
|
2508
|
+
* @param {boolean} u_dir
|
|
2509
|
+
* @param {number} t
|
|
2510
|
+
* @param {number} times
|
|
2511
|
+
* @returns {Float64Array}
|
|
2512
|
+
*/
|
|
2513
|
+
export function nurbs_surface_insert_knot(data, u_dir, t, times) {
|
|
2514
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2515
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2516
|
+
const ret = wasm.nurbs_surface_insert_knot(ptr0, len0, u_dir, t, times);
|
|
2517
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2518
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2519
|
+
return v2;
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Exact rational iso-parametric curve. `u_dir = true` extracts the curve
|
|
2523
|
+
* running along u at constant v = t; false extracts along v at constant u = t.
|
|
2524
|
+
* t is normalized [0,1]. Returns curve data [degree, n, pts..., w..., knots...].
|
|
2525
|
+
* @param {Float64Array} data
|
|
2526
|
+
* @param {number} t
|
|
2527
|
+
* @param {boolean} u_dir
|
|
2528
|
+
* @returns {Float64Array}
|
|
2529
|
+
*/
|
|
2530
|
+
export function nurbs_surface_iso_curve(data, t, u_dir) {
|
|
2531
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2532
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2533
|
+
const ret = wasm.nurbs_surface_iso_curve(ptr0, len0, t, u_dir);
|
|
2534
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2535
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2536
|
+
return v2;
|
|
2537
|
+
}
|
|
2057
2538
|
/**
|
|
2058
2539
|
* Evaluate a NURBS surface unit normal at normalized parameters (u, v) in [0,1].
|
|
2059
2540
|
* Returns [x, y, z]
|
|
@@ -2090,6 +2571,77 @@ export function nurbs_surface_plane_intersect(surface_data, nx, ny, nz, d, tess)
|
|
|
2090
2571
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2091
2572
|
return v2;
|
|
2092
2573
|
}
|
|
2574
|
+
/**
|
|
2575
|
+
* Exact rational primitive surfaces.
|
|
2576
|
+
* kind: "cylinder" [bx,by,bz, ax,ay,az, radius, height]
|
|
2577
|
+
* "sphere" [cx,cy,cz, radius]
|
|
2578
|
+
* "cone" [bx,by,bz, ax,ay,az, radius0, radius1, height]
|
|
2579
|
+
* "torus" [cx,cy,cz, major, minor]
|
|
2580
|
+
* @param {string} kind
|
|
2581
|
+
* @param {Float64Array} params
|
|
2582
|
+
* @returns {Float64Array}
|
|
2583
|
+
*/
|
|
2584
|
+
export function nurbs_surface_primitive(kind, params) {
|
|
2585
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2587
|
+
const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
2588
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2589
|
+
const ret = wasm.nurbs_surface_primitive(ptr0, len0, ptr1, len1);
|
|
2590
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2591
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2592
|
+
return v3;
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Exact surface of revolution from a profile curve (A8.1).
|
|
2596
|
+
* @param {Float64Array} curve_data
|
|
2597
|
+
* @param {number} ox
|
|
2598
|
+
* @param {number} oy
|
|
2599
|
+
* @param {number} oz
|
|
2600
|
+
* @param {number} ax
|
|
2601
|
+
* @param {number} ay
|
|
2602
|
+
* @param {number} az
|
|
2603
|
+
* @param {number} angle
|
|
2604
|
+
* @returns {Float64Array}
|
|
2605
|
+
*/
|
|
2606
|
+
export function nurbs_surface_revolve(curve_data, ox, oy, oz, ax, ay, az, angle) {
|
|
2607
|
+
const ptr0 = passArrayF64ToWasm0(curve_data, wasm.__wbindgen_malloc);
|
|
2608
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2609
|
+
const ret = wasm.nurbs_surface_revolve(ptr0, len0, ox, oy, oz, ax, ay, az, angle);
|
|
2610
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2611
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2612
|
+
return v2;
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* Exact ruled surface between two curves (auto degree/knot compatibility).
|
|
2616
|
+
* @param {Float64Array} curve_a
|
|
2617
|
+
* @param {Float64Array} curve_b
|
|
2618
|
+
* @returns {Float64Array}
|
|
2619
|
+
*/
|
|
2620
|
+
export function nurbs_surface_ruled(curve_a, curve_b) {
|
|
2621
|
+
const ptr0 = passArrayF64ToWasm0(curve_a, wasm.__wbindgen_malloc);
|
|
2622
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2623
|
+
const ptr1 = passArrayF64ToWasm0(curve_b, wasm.__wbindgen_malloc);
|
|
2624
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2625
|
+
const ret = wasm.nurbs_surface_ruled(ptr0, len0, ptr1, len1);
|
|
2626
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2627
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2628
|
+
return v3;
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* Exact split at normalized parameter t. Returns [lenA, surfaceA..., lenB, surfaceB...].
|
|
2632
|
+
* @param {Float64Array} data
|
|
2633
|
+
* @param {boolean} u_dir
|
|
2634
|
+
* @param {number} t
|
|
2635
|
+
* @returns {Float64Array}
|
|
2636
|
+
*/
|
|
2637
|
+
export function nurbs_surface_split(data, u_dir, t) {
|
|
2638
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2639
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2640
|
+
const ret = wasm.nurbs_surface_split(ptr0, len0, u_dir, t);
|
|
2641
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2642
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2643
|
+
return v2;
|
|
2644
|
+
}
|
|
2093
2645
|
/**
|
|
2094
2646
|
* Intersect two NURBS surfaces.
|
|
2095
2647
|
* Returns polyline buffer.
|
|
@@ -2108,6 +2660,42 @@ export function nurbs_surface_surface_intersect(data_a, data_b, tess) {
|
|
|
2108
2660
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2109
2661
|
return v3;
|
|
2110
2662
|
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Curvature-adaptive tessellation against a chordal tolerance.
|
|
2665
|
+
* Returns the standard mesh buffer [vertexCount, positions..., indices...].
|
|
2666
|
+
* @param {Float64Array} data
|
|
2667
|
+
* @param {number} tolerance
|
|
2668
|
+
* @param {number} max_segments_per_span
|
|
2669
|
+
* @returns {Float64Array}
|
|
2670
|
+
*/
|
|
2671
|
+
export function nurbs_surface_tessellate_adaptive(data, tolerance, max_segments_per_span) {
|
|
2672
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2673
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2674
|
+
const ret = wasm.nurbs_surface_tessellate_adaptive(ptr0, len0, tolerance, max_segments_per_span);
|
|
2675
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2676
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2677
|
+
return v2;
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Display-ready render tessellation: twist-aware adaptive grid with ANALYTIC
|
|
2681
|
+
* surface normals, plus feature edges only where the surface really has them
|
|
2682
|
+
* (boundaries, kinked C0 knot lines, kinked closed seams).
|
|
2683
|
+
* Output (f32, same packing as `mesh_build_render_buffers`):
|
|
2684
|
+
* [vertexCount, positions..., normals..., edgeSegmentCount, edgeSegments...]
|
|
2685
|
+
* @param {Float64Array} data
|
|
2686
|
+
* @param {number} tolerance
|
|
2687
|
+
* @param {number} max_segments_per_span
|
|
2688
|
+
* @param {number} crease_angle_deg
|
|
2689
|
+
* @returns {Float32Array}
|
|
2690
|
+
*/
|
|
2691
|
+
export function nurbs_surface_tessellate_render(data, tolerance, max_segments_per_span, crease_angle_deg) {
|
|
2692
|
+
const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
|
|
2693
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2694
|
+
const ret = wasm.nurbs_surface_tessellate_render(ptr0, len0, tolerance, max_segments_per_span, crease_angle_deg);
|
|
2695
|
+
var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
2696
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2697
|
+
return v2;
|
|
2698
|
+
}
|
|
2111
2699
|
/**
|
|
2112
2700
|
* Offset a polycurve made of line and arc segments.
|
|
2113
2701
|
* Input format: [segment_count, type, ...data, ...]
|