opengeometry 2.0.11 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/analytic-worker.js +90 -0
  2. package/index.d.ts +16 -1
  3. package/index.js +3222 -3057
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +362 -224
  6. package/opengeometry/pkg/opengeometry.js +982 -298
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +251 -198
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +251 -198
  11. package/package.json +2 -1
  12. package/src/editor/types.d.ts +1 -1
  13. package/src/examples/booleans.d.ts +3 -2
  14. package/src/examples/editor-modes.d.ts +4 -8
  15. package/src/examples/index.d.ts +1 -0
  16. package/src/examples/offset-ring-variable.d.ts +13 -0
  17. package/src/examples/shapes.d.ts +1 -1
  18. package/src/examples/wall-from-offsets.d.ts +7 -14
  19. package/src/export/analytic-ifc.d.ts +61 -0
  20. package/src/freeform/geometry.d.ts +2 -0
  21. package/src/freeform/index.d.ts +1 -1
  22. package/src/operations/analytic-errors.d.ts +8 -0
  23. package/src/operations/boolean.d.ts +9 -141
  24. package/src/operations/index.d.ts +2 -4
  25. package/src/operations/loft.d.ts +13 -0
  26. package/src/operations/offset-regions.d.ts +36 -0
  27. package/src/primitives/analytic-curve.d.ts +42 -0
  28. package/src/primitives/arc.d.ts +26 -55
  29. package/src/primitives/elliptical_arc.d.ts +38 -0
  30. package/src/primitives/index.d.ts +1 -0
  31. package/src/rendering/analytic-lod.d.ts +32 -0
  32. package/src/rendering/analytic-tessellation.d.ts +32 -0
  33. package/src/shapes/analytic-pattern.d.ts +36 -0
  34. package/src/shapes/analytic-solid.d.ts +288 -0
  35. package/src/shapes/cuboid.d.ts +40 -54
  36. package/src/shapes/cylinder.d.ts +26 -70
  37. package/src/shapes/opening.d.ts +19 -82
  38. package/src/shapes/polygon.d.ts +4 -5
  39. package/src/shapes/solid.d.ts +0 -8
  40. package/src/shapes/sphere.d.ts +18 -73
  41. package/src/shapes/sweep.d.ts +0 -5
  42. package/src/shapes/wedge.d.ts +0 -5
  43. package/src/toolkit/index.d.ts +0 -4
  44. package/src/toolkit/wall.d.ts +0 -40
@@ -29,69 +29,13 @@ function handleError(f, args) {
29
29
  }
30
30
  }
31
31
 
32
- function debugString(val) {
33
- // primitive types
34
- const type = typeof val;
35
- if (type == 'number' || type == 'boolean' || val == null) {
36
- return `${val}`;
37
- }
38
- if (type == 'string') {
39
- return `"${val}"`;
40
- }
41
- if (type == 'symbol') {
42
- const description = val.description;
43
- if (description == null) {
44
- return 'Symbol';
45
- } else {
46
- return `Symbol(${description})`;
47
- }
48
- }
49
- if (type == 'function') {
50
- const name = val.name;
51
- if (typeof name == 'string' && name.length > 0) {
52
- return `Function(${name})`;
53
- } else {
54
- return 'Function';
55
- }
56
- }
57
- // objects
58
- if (Array.isArray(val)) {
59
- const length = val.length;
60
- let debug = '[';
61
- if (length > 0) {
62
- debug += debugString(val[0]);
63
- }
64
- for(let i = 1; i < length; i++) {
65
- debug += ', ' + debugString(val[i]);
66
- }
67
- debug += ']';
68
- return debug;
69
- }
70
- // Test for built-in
71
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
72
- let className;
73
- if (builtInMatches && builtInMatches.length > 1) {
74
- className = builtInMatches[1];
75
- } else {
76
- // Failed to match the standard '[object ClassName]'
77
- return toString.call(val);
78
- }
79
- if (className == 'Object') {
80
- // we're a user defined class or Object
81
- // JSON.stringify avoids problems with cycles, and is generally much
82
- // easier than looping through ownProperties of `val`.
83
- try {
84
- return 'Object(' + JSON.stringify(val) + ')';
85
- } catch (_) {
86
- return 'Object';
87
- }
88
- }
89
- // errors
90
- if (val instanceof Error) {
91
- return `${val.name}: ${val.message}\n${val.stack}`;
92
- }
93
- // TODO we could test for more things here, like `Set`s and `Map`s.
94
- return className;
32
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
33
+
34
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
35
+
36
+ function getStringFromWasm0(ptr, len) {
37
+ ptr = ptr >>> 0;
38
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
95
39
  }
96
40
 
97
41
  let WASM_VECTOR_LEN = 0;
@@ -150,24 +94,6 @@ function passStringToWasm0(arg, malloc, realloc) {
150
94
  return ptr;
151
95
  }
152
96
 
153
- let cachedDataViewMemory0 = null;
154
-
155
- function getDataViewMemory0() {
156
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
157
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
158
- }
159
- return cachedDataViewMemory0;
160
- }
161
-
162
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
163
-
164
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
165
-
166
- function getStringFromWasm0(ptr, len) {
167
- ptr = ptr >>> 0;
168
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
169
- }
170
-
171
97
  function takeFromExternrefTable0(idx) {
172
98
  const value = wasm.__wbindgen_export_2.get(idx);
173
99
  wasm.__externref_table_dealloc(idx);
@@ -199,12 +125,6 @@ export function extrudeBrepFace(local_brep_serialized, height) {
199
125
  }
200
126
  }
201
127
 
202
- function _assertClass(instance, klass) {
203
- if (!(instance instanceof klass)) {
204
- throw new Error(`expected instance of ${klass.name}`);
205
- }
206
- }
207
-
208
128
  let cachedFloat64ArrayMemory0 = null;
209
129
 
210
130
  function getFloat64ArrayMemory0() {
@@ -214,40 +134,107 @@ function getFloat64ArrayMemory0() {
214
134
  return cachedFloat64ArrayMemory0;
215
135
  }
216
136
 
217
- function getArrayF64FromWasm0(ptr, len) {
218
- ptr = ptr >>> 0;
219
- return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
137
+ function passArrayF64ToWasm0(arg, malloc) {
138
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
139
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
140
+ WASM_VECTOR_LEN = arg.length;
141
+ return ptr;
142
+ }
143
+ /**
144
+ * Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
145
+ * is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
146
+ * extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
147
+ * distance for one-sided/symmetric).
148
+ * @param {string} local_brep_serialized
149
+ * @param {Float64Array} direction
150
+ * @param {string} extent_kind
151
+ * @param {number} d_plus
152
+ * @param {number} d_minus
153
+ * @returns {string}
154
+ */
155
+ export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
156
+ let deferred5_0;
157
+ let deferred5_1;
158
+ try {
159
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
162
+ const len1 = WASM_VECTOR_LEN;
163
+ const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
164
+ const len2 = WASM_VECTOR_LEN;
165
+ const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
166
+ var ptr4 = ret[0];
167
+ var len4 = ret[1];
168
+ if (ret[3]) {
169
+ ptr4 = 0; len4 = 0;
170
+ throw takeFromExternrefTable0(ret[2]);
171
+ }
172
+ deferred5_0 = ptr4;
173
+ deferred5_1 = len4;
174
+ return getStringFromWasm0(ptr4, len4);
175
+ } finally {
176
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
177
+ }
220
178
  }
221
179
 
222
- function passArrayJsValueToWasm0(array, malloc) {
223
- const ptr = malloc(array.length * 4, 4) >>> 0;
224
- for (let i = 0; i < array.length; i++) {
225
- const add = addToExternrefTable0(array[i]);
226
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
180
+ /**
181
+ * Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
182
+ * JSON (the corrected points are not returned here; use the kernel API).
183
+ * @param {Float64Array} flat_points
184
+ * @returns {string}
185
+ */
186
+ export function analyzeProfile(flat_points) {
187
+ let deferred3_0;
188
+ let deferred3_1;
189
+ try {
190
+ const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
191
+ const len0 = WASM_VECTOR_LEN;
192
+ const ret = wasm.analyzeProfile(ptr0, len0);
193
+ var ptr2 = ret[0];
194
+ var len2 = ret[1];
195
+ if (ret[3]) {
196
+ ptr2 = 0; len2 = 0;
197
+ throw takeFromExternrefTable0(ret[2]);
198
+ }
199
+ deferred3_0 = ptr2;
200
+ deferred3_1 = len2;
201
+ return getStringFromWasm0(ptr2, len2);
202
+ } finally {
203
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
227
204
  }
228
- WASM_VECTOR_LEN = array.length;
229
- return ptr;
230
205
  }
231
206
 
232
- function getArrayJsValueFromWasm0(ptr, len) {
233
- ptr = ptr >>> 0;
234
- const mem = getDataViewMemory0();
235
- const result = [];
236
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
237
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
207
+ function _assertClass(instance, klass) {
208
+ if (!(instance instanceof klass)) {
209
+ throw new Error(`expected instance of ${klass.name}`);
238
210
  }
239
- wasm.__externref_drop_slice(ptr, len);
240
- return result;
241
211
  }
242
212
 
243
213
  function isLikeNone(x) {
244
214
  return x === undefined || x === null;
245
215
  }
246
216
 
247
- function passArrayF64ToWasm0(arg, malloc) {
248
- const ptr = malloc(arg.length * 8, 8) >>> 0;
249
- getFloat64ArrayMemory0().set(arg, ptr / 8);
250
- WASM_VECTOR_LEN = arg.length;
217
+ function getArrayF64FromWasm0(ptr, len) {
218
+ ptr = ptr >>> 0;
219
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
220
+ }
221
+
222
+ let cachedDataViewMemory0 = null;
223
+
224
+ function getDataViewMemory0() {
225
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
226
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
227
+ }
228
+ return cachedDataViewMemory0;
229
+ }
230
+
231
+ function passArrayJsValueToWasm0(array, malloc) {
232
+ const ptr = malloc(array.length * 4, 4) >>> 0;
233
+ for (let i = 0; i < array.length; i++) {
234
+ const add = addToExternrefTable0(array[i]);
235
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
236
+ }
237
+ WASM_VECTOR_LEN = array.length;
251
238
  return ptr;
252
239
  }
253
240
  /**
@@ -289,106 +276,171 @@ export function offsetPolylineGroupRegions(polylines_json) {
289
276
  }
290
277
 
291
278
  /**
292
- * Wasm entry point for union.
293
- * @param {string} lhs_brep_serialized
294
- * @param {string} rhs_brep_serialized
295
- * @param {string | null} [options_json]
296
- * @returns {OGBooleanResult}
279
+ * Wasm entry point: inset a CLOSED ring inward with one distance per edge
280
+ * (edge i = ring[i] → ring[i+1]). `ring_flat` is `[x0,y0,z0, …]`;
281
+ * `holes_json` is `[{ring:[x,y,z,…], distances:[…]}, …]` (`"[]"` = none) —
282
+ * excluded interior rings, each grown outward by its own per-edge distances.
283
+ * Returns CW-outer / CCW-hole regions, canonicalised; possibly several when a
284
+ * deep inset (or a hole) splits the ring, and empty (does NOT throw) when the
285
+ * inset collapses or the outer ring is degenerate. THROWS on malformed
286
+ * arguments: a distance count that does not match an edge count, a negative /
287
+ * non-finite distance, a degenerate hole, or unparsable `holes_json`. Corners
288
+ * where distances differ are circumscribed clearance arcs (conservative), so
289
+ * no output point is ever closer to an edge than that edge's distance —
290
+ * there is no miter-limit knob because there are no miters.
291
+ * @param {Float64Array} ring_flat
292
+ * @param {Float64Array} distances
293
+ * @param {string} holes_json
294
+ * @returns {OGOffsetRegionsResult}
297
295
  */
298
- export function booleanUnion(lhs_brep_serialized, rhs_brep_serialized, options_json) {
299
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ export function offsetRingVariable(ring_flat, distances, holes_json) {
297
+ const ptr0 = passArrayF64ToWasm0(ring_flat, wasm.__wbindgen_malloc);
300
298
  const len0 = WASM_VECTOR_LEN;
301
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
+ const ptr1 = passArrayF64ToWasm0(distances, wasm.__wbindgen_malloc);
302
300
  const len1 = WASM_VECTOR_LEN;
303
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
- var len2 = WASM_VECTOR_LEN;
305
- const ret = wasm.booleanUnion(ptr0, len0, ptr1, len1, ptr2, len2);
301
+ const ptr2 = passStringToWasm0(holes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
302
+ const len2 = WASM_VECTOR_LEN;
303
+ const ret = wasm.offsetRingVariable(ptr0, len0, ptr1, len1, ptr2, len2);
306
304
  if (ret[2]) {
307
305
  throw takeFromExternrefTable0(ret[1]);
308
306
  }
309
- return OGBooleanResult.__wrap(ret[0]);
307
+ return OGOffsetRegionsResult.__wrap(ret[0]);
310
308
  }
311
309
 
312
310
  /**
313
- * Wasm entry point for intersection.
314
- * @param {string} lhs_brep_serialized
315
- * @param {string} rhs_brep_serialized
316
- * @param {string | null} [options_json]
317
- * @returns {OGBooleanResult}
311
+ * @param {string} serialized
312
+ * @returns {string}
318
313
  */
319
- export function booleanIntersection(lhs_brep_serialized, rhs_brep_serialized, options_json) {
320
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
- const len0 = WASM_VECTOR_LEN;
322
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
323
- const len1 = WASM_VECTOR_LEN;
324
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
325
- var len2 = WASM_VECTOR_LEN;
326
- const ret = wasm.booleanIntersection(ptr0, len0, ptr1, len1, ptr2, len2);
327
- if (ret[2]) {
328
- throw takeFromExternrefTable0(ret[1]);
314
+ export function validateAnalyticBrep(serialized) {
315
+ let deferred3_0;
316
+ let deferred3_1;
317
+ try {
318
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
319
+ const len0 = WASM_VECTOR_LEN;
320
+ const ret = wasm.validateAnalyticBrep(ptr0, len0);
321
+ var ptr2 = ret[0];
322
+ var len2 = ret[1];
323
+ if (ret[3]) {
324
+ ptr2 = 0; len2 = 0;
325
+ throw takeFromExternrefTable0(ret[2]);
326
+ }
327
+ deferred3_0 = ptr2;
328
+ deferred3_1 = len2;
329
+ return getStringFromWasm0(ptr2, len2);
330
+ } finally {
331
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
329
332
  }
330
- return OGBooleanResult.__wrap(ret[0]);
331
333
  }
332
334
 
333
335
  /**
334
- * Wasm entry point for subtraction.
335
- * @param {string} lhs_brep_serialized
336
- * @param {string} rhs_brep_serialized
336
+ * @param {string} serialized
337
+ * @param {number} deflection
337
338
  * @param {string | null} [options_json]
338
- * @returns {OGBooleanResult}
339
+ * @returns {OGAnalyticTessellation}
339
340
  */
340
- export function booleanSubtraction(lhs_brep_serialized, rhs_brep_serialized, options_json) {
341
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
+ export function tessellate_brep(serialized, deflection, options_json) {
342
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
343
  const len0 = WASM_VECTOR_LEN;
343
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
- const len1 = WASM_VECTOR_LEN;
345
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
- var len2 = WASM_VECTOR_LEN;
347
- const ret = wasm.booleanSubtraction(ptr0, len0, ptr1, len1, ptr2, len2);
344
+ var ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
345
+ var len1 = WASM_VECTOR_LEN;
346
+ const ret = wasm.tessellate_brep(ptr0, len0, deflection, ptr1, len1);
348
347
  if (ret[2]) {
349
348
  throw takeFromExternrefTable0(ret[1]);
350
349
  }
351
- return OGBooleanResult.__wrap(ret[0]);
350
+ return OGAnalyticTessellation.__wrap(ret[0]);
351
+ }
352
+
353
+ let cachedFloat32ArrayMemory0 = null;
354
+
355
+ function getFloat32ArrayMemory0() {
356
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
357
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
358
+ }
359
+ return cachedFloat32ArrayMemory0;
360
+ }
361
+
362
+ function getArrayF32FromWasm0(ptr, len) {
363
+ ptr = ptr >>> 0;
364
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
365
+ }
366
+
367
+ let cachedUint32ArrayMemory0 = null;
368
+
369
+ function getUint32ArrayMemory0() {
370
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
371
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
372
+ }
373
+ return cachedUint32ArrayMemory0;
352
374
  }
353
375
 
376
+ function getArrayU32FromWasm0(ptr, len) {
377
+ ptr = ptr >>> 0;
378
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
379
+ }
380
+
381
+ function getArrayJsValueFromWasm0(ptr, len) {
382
+ ptr = ptr >>> 0;
383
+ const mem = getDataViewMemory0();
384
+ const result = [];
385
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
386
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
387
+ }
388
+ wasm.__externref_drop_slice(ptr, len);
389
+ return result;
390
+ }
354
391
  /**
355
- * Wasm entry point for array-backed repeated subtraction.
356
- * @param {string} lhs_brep_serialized
357
- * @param {string} cutters_brep_serialized
358
- * @param {string | null} [options_json]
359
- * @returns {OGBooleanResult}
392
+ * Wasm entry point: check a serialized B-rep's geometric validity, returning
393
+ * the [`ValidityReport`] as JSON.
394
+ * @param {string} brep_json
395
+ * @returns {string}
360
396
  */
361
- export function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_serialized, options_json) {
362
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
363
- const len0 = WASM_VECTOR_LEN;
364
- const ptr1 = passStringToWasm0(cutters_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
365
- const len1 = WASM_VECTOR_LEN;
366
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
367
- var len2 = WASM_VECTOR_LEN;
368
- const ret = wasm.booleanSubtractionMany(ptr0, len0, ptr1, len1, ptr2, len2);
369
- if (ret[2]) {
370
- throw takeFromExternrefTable0(ret[1]);
397
+ export function checkBrepValidity(brep_json) {
398
+ let deferred3_0;
399
+ let deferred3_1;
400
+ try {
401
+ const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ const ret = wasm.checkBrepValidity(ptr0, len0);
404
+ var ptr2 = ret[0];
405
+ var len2 = ret[1];
406
+ if (ret[3]) {
407
+ ptr2 = 0; len2 = 0;
408
+ throw takeFromExternrefTable0(ret[2]);
409
+ }
410
+ deferred3_0 = ptr2;
411
+ deferred3_1 = len2;
412
+ return getStringFromWasm0(ptr2, len2);
413
+ } finally {
414
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
371
415
  }
372
- return OGBooleanResult.__wrap(ret[0]);
373
416
  }
374
417
 
375
418
  /**
376
- * Wasm entry point for array-backed batched union. Accepts a JSON array of
377
- * serialized BReps and folds them with `batch_union` in one boundary crossing.
378
- * @param {string} operands_brep_serialized
379
- * @param {string | null} [options_json]
380
- * @returns {OGBooleanResult}
419
+ * Wasm entry point: heal a serialized B-rep, returning JSON
420
+ * `{ "brep": <healed brep>, "report": <heal report> }`.
421
+ * @param {string} brep_json
422
+ * @param {number} tolerance
423
+ * @returns {string}
381
424
  */
382
- export function batchUnion(operands_brep_serialized, options_json) {
383
- const ptr0 = passStringToWasm0(operands_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
384
- const len0 = WASM_VECTOR_LEN;
385
- var ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
- var len1 = WASM_VECTOR_LEN;
387
- const ret = wasm.batchUnion(ptr0, len0, ptr1, len1);
388
- if (ret[2]) {
389
- throw takeFromExternrefTable0(ret[1]);
425
+ export function healBrep(brep_json, tolerance) {
426
+ let deferred3_0;
427
+ let deferred3_1;
428
+ try {
429
+ const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
+ const len0 = WASM_VECTOR_LEN;
431
+ const ret = wasm.healBrep(ptr0, len0, tolerance);
432
+ var ptr2 = ret[0];
433
+ var len2 = ret[1];
434
+ if (ret[3]) {
435
+ ptr2 = 0; len2 = 0;
436
+ throw takeFromExternrefTable0(ret[2]);
437
+ }
438
+ deferred3_0 = ptr2;
439
+ deferred3_1 = len2;
440
+ return getStringFromWasm0(ptr2, len2);
441
+ } finally {
442
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
390
443
  }
391
- return OGBooleanResult.__wrap(ret[0]);
392
444
  }
393
445
 
394
446
  const Matrix3Finalization = (typeof FinalizationRegistry === 'undefined')
@@ -713,39 +765,449 @@ export class Matrix4 {
713
765
  }
714
766
  }
715
767
 
716
- const OGArcFinalization = (typeof FinalizationRegistry === 'undefined')
768
+ const OGAnalyticBrepFinalization = (typeof FinalizationRegistry === 'undefined')
717
769
  ? { register: () => {}, unregister: () => {} }
718
- : new FinalizationRegistry(ptr => wasm.__wbg_ogarc_free(ptr >>> 0, 1));
770
+ : new FinalizationRegistry(ptr => wasm.__wbg_oganalyticbrep_free(ptr >>> 0, 1));
719
771
 
720
- export class OGArc {
772
+ export class OGAnalyticBrep {
773
+
774
+ static __wrap(ptr) {
775
+ ptr = ptr >>> 0;
776
+ const obj = Object.create(OGAnalyticBrep.prototype);
777
+ obj.__wbg_ptr = ptr;
778
+ OGAnalyticBrepFinalization.register(obj, obj.__wbg_ptr, obj);
779
+ return obj;
780
+ }
721
781
 
722
782
  __destroy_into_raw() {
723
783
  const ptr = this.__wbg_ptr;
724
784
  this.__wbg_ptr = 0;
725
- OGArcFinalization.unregister(this);
785
+ OGAnalyticBrepFinalization.unregister(this);
726
786
  return ptr;
727
787
  }
728
788
 
729
789
  free() {
730
790
  const ptr = this.__destroy_into_raw();
731
- wasm.__wbg_ogarc_free(ptr, 0);
791
+ wasm.__wbg_oganalyticbrep_free(ptr, 0);
732
792
  }
733
793
  /**
734
- * @param {string} id
794
+ * @param {string} serialized
735
795
  */
736
- set id(id) {
737
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
796
+ constructor(serialized) {
797
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
738
798
  const len0 = WASM_VECTOR_LEN;
739
- wasm.ogarc_set_id(this.__wbg_ptr, ptr0, len0);
799
+ const ret = wasm.oganalyticbrep_new(ptr0, len0);
800
+ if (ret[2]) {
801
+ throw takeFromExternrefTable0(ret[1]);
802
+ }
803
+ this.__wbg_ptr = ret[0] >>> 0;
804
+ OGAnalyticBrepFinalization.register(this, this.__wbg_ptr, this);
805
+ return this;
806
+ }
807
+ /**
808
+ * @param {string} config_json
809
+ * @returns {OGAnalyticBrep}
810
+ */
811
+ static from_primitive(config_json) {
812
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
813
+ const len0 = WASM_VECTOR_LEN;
814
+ const ret = wasm.oganalyticbrep_from_primitive(ptr0, len0);
815
+ if (ret[2]) {
816
+ throw takeFromExternrefTable0(ret[1]);
817
+ }
818
+ return OGAnalyticBrep.__wrap(ret[0]);
740
819
  }
741
820
  /**
742
821
  * @returns {string}
743
822
  */
744
- get id() {
745
- let deferred1_0;
746
- let deferred1_1;
747
- try {
748
- const ret = wasm.ogarc_id(this.__wbg_ptr);
823
+ get_brep_serialized() {
824
+ let deferred2_0;
825
+ let deferred2_1;
826
+ try {
827
+ const ret = wasm.oganalyticbrep_get_brep_serialized(this.__wbg_ptr);
828
+ var ptr1 = ret[0];
829
+ var len1 = ret[1];
830
+ if (ret[3]) {
831
+ ptr1 = 0; len1 = 0;
832
+ throw takeFromExternrefTable0(ret[2]);
833
+ }
834
+ deferred2_0 = ptr1;
835
+ deferred2_1 = len1;
836
+ return getStringFromWasm0(ptr1, len1);
837
+ } finally {
838
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
839
+ }
840
+ }
841
+ /**
842
+ * @param {string} length_unit
843
+ * @returns {string}
844
+ */
845
+ export_step(length_unit) {
846
+ let deferred3_0;
847
+ let deferred3_1;
848
+ try {
849
+ const ptr0 = passStringToWasm0(length_unit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
850
+ const len0 = WASM_VECTOR_LEN;
851
+ const ret = wasm.oganalyticbrep_export_step(this.__wbg_ptr, ptr0, len0);
852
+ var ptr2 = ret[0];
853
+ var len2 = ret[1];
854
+ if (ret[3]) {
855
+ ptr2 = 0; len2 = 0;
856
+ throw takeFromExternrefTable0(ret[2]);
857
+ }
858
+ deferred3_0 = ptr2;
859
+ deferred3_1 = len2;
860
+ return getStringFromWasm0(ptr2, len2);
861
+ } finally {
862
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
863
+ }
864
+ }
865
+ /**
866
+ * @param {string} frame_json
867
+ * @param {number} scale
868
+ * @returns {OGAnalyticBrep}
869
+ */
870
+ placed(frame_json, scale) {
871
+ const ptr0 = passStringToWasm0(frame_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
872
+ const len0 = WASM_VECTOR_LEN;
873
+ const ret = wasm.oganalyticbrep_placed(this.__wbg_ptr, ptr0, len0, scale);
874
+ if (ret[2]) {
875
+ throw takeFromExternrefTable0(ret[1]);
876
+ }
877
+ return OGAnalyticBrep.__wrap(ret[0]);
878
+ }
879
+ /**
880
+ * @returns {string}
881
+ */
882
+ prepare_ifc_exchange() {
883
+ let deferred2_0;
884
+ let deferred2_1;
885
+ try {
886
+ const ret = wasm.oganalyticbrep_prepare_ifc_exchange(this.__wbg_ptr);
887
+ var ptr1 = ret[0];
888
+ var len1 = ret[1];
889
+ if (ret[3]) {
890
+ ptr1 = 0; len1 = 0;
891
+ throw takeFromExternrefTable0(ret[2]);
892
+ }
893
+ deferred2_0 = ptr1;
894
+ deferred2_1 = len1;
895
+ return getStringFromWasm0(ptr1, len1);
896
+ } finally {
897
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
898
+ }
899
+ }
900
+ /**
901
+ * @param {number} face_id
902
+ * @param {Float64Array} point
903
+ * @returns {Float64Array}
904
+ */
905
+ face_normal_at(face_id, point) {
906
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
907
+ const len0 = WASM_VECTOR_LEN;
908
+ const ret = wasm.oganalyticbrep_face_normal_at(this.__wbg_ptr, face_id, ptr0, len0);
909
+ if (ret[3]) {
910
+ throw takeFromExternrefTable0(ret[2]);
911
+ }
912
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
913
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
914
+ return v2;
915
+ }
916
+ /**
917
+ * @param {Float64Array} point
918
+ * @returns {string}
919
+ */
920
+ classify_point(point) {
921
+ let deferred3_0;
922
+ let deferred3_1;
923
+ try {
924
+ const ptr0 = passArrayF64ToWasm0(point, wasm.__wbindgen_malloc);
925
+ const len0 = WASM_VECTOR_LEN;
926
+ const ret = wasm.oganalyticbrep_classify_point(this.__wbg_ptr, ptr0, len0);
927
+ var ptr2 = ret[0];
928
+ var len2 = ret[1];
929
+ if (ret[3]) {
930
+ ptr2 = 0; len2 = 0;
931
+ throw takeFromExternrefTable0(ret[2]);
932
+ }
933
+ deferred3_0 = ptr2;
934
+ deferred3_1 = len2;
935
+ return getStringFromWasm0(ptr2, len2);
936
+ } finally {
937
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
938
+ }
939
+ }
940
+ /**
941
+ * @param {string} camera_json
942
+ * @param {string} hlr_json
943
+ * @param {number} deflection
944
+ * @returns {string}
945
+ */
946
+ project_to_2d_lines(camera_json, hlr_json, deflection) {
947
+ let deferred4_0;
948
+ let deferred4_1;
949
+ try {
950
+ const ptr0 = passStringToWasm0(camera_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
951
+ const len0 = WASM_VECTOR_LEN;
952
+ const ptr1 = passStringToWasm0(hlr_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
953
+ const len1 = WASM_VECTOR_LEN;
954
+ const ret = wasm.oganalyticbrep_project_to_2d_lines(this.__wbg_ptr, ptr0, len0, ptr1, len1, deflection);
955
+ var ptr3 = ret[0];
956
+ var len3 = ret[1];
957
+ if (ret[3]) {
958
+ ptr3 = 0; len3 = 0;
959
+ throw takeFromExternrefTable0(ret[2]);
960
+ }
961
+ deferred4_0 = ptr3;
962
+ deferred4_1 = len3;
963
+ return getStringFromWasm0(ptr3, len3);
964
+ } finally {
965
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
966
+ }
967
+ }
968
+ /**
969
+ * @param {OGAnalyticBrep} other
970
+ * @param {string} operation
971
+ * @param {string} id
972
+ * @returns {OGAnalyticBrep}
973
+ */
974
+ boolean_brep(other, operation, id) {
975
+ _assertClass(other, OGAnalyticBrep);
976
+ const ptr0 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
977
+ const len0 = WASM_VECTOR_LEN;
978
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
979
+ const len1 = WASM_VECTOR_LEN;
980
+ const ret = wasm.oganalyticbrep_boolean_brep(this.__wbg_ptr, other.__wbg_ptr, ptr0, len0, ptr1, len1);
981
+ if (ret[2]) {
982
+ throw takeFromExternrefTable0(ret[1]);
983
+ }
984
+ return OGAnalyticBrep.__wrap(ret[0]);
985
+ }
986
+ /**
987
+ * @param {number} thickness
988
+ * @param {string} id
989
+ * @returns {OGAnalyticBrep}
990
+ */
991
+ shell(thickness, id) {
992
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
+ const len0 = WASM_VECTOR_LEN;
994
+ const ret = wasm.oganalyticbrep_shell(this.__wbg_ptr, thickness, ptr0, len0);
995
+ if (ret[2]) {
996
+ throw takeFromExternrefTable0(ret[1]);
997
+ }
998
+ return OGAnalyticBrep.__wrap(ret[0]);
999
+ }
1000
+ /**
1001
+ * @returns {string | undefined}
1002
+ */
1003
+ get_boolean_report_serialized() {
1004
+ const ret = wasm.oganalyticbrep_get_boolean_report_serialized(this.__wbg_ptr);
1005
+ if (ret[3]) {
1006
+ throw takeFromExternrefTable0(ret[2]);
1007
+ }
1008
+ let v1;
1009
+ if (ret[0] !== 0) {
1010
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1011
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1012
+ }
1013
+ return v1;
1014
+ }
1015
+ /**
1016
+ * @param {number} deflection
1017
+ * @returns {OGAnalyticTessellation}
1018
+ */
1019
+ tessellate(deflection) {
1020
+ const ret = wasm.oganalyticbrep_tessellate(this.__wbg_ptr, deflection);
1021
+ if (ret[2]) {
1022
+ throw takeFromExternrefTable0(ret[1]);
1023
+ }
1024
+ return OGAnalyticTessellation.__wrap(ret[0]);
1025
+ }
1026
+ /**
1027
+ * @returns {number}
1028
+ */
1029
+ get_face_count() {
1030
+ const ret = wasm.oganalyticbrep_get_face_count(this.__wbg_ptr);
1031
+ return ret >>> 0;
1032
+ }
1033
+ /**
1034
+ * @returns {number}
1035
+ */
1036
+ get_edge_count() {
1037
+ const ret = wasm.oganalyticbrep_get_edge_count(this.__wbg_ptr);
1038
+ return ret >>> 0;
1039
+ }
1040
+ /**
1041
+ * @returns {string}
1042
+ */
1043
+ get_id() {
1044
+ let deferred1_0;
1045
+ let deferred1_1;
1046
+ try {
1047
+ const ret = wasm.oganalyticbrep_get_id(this.__wbg_ptr);
1048
+ deferred1_0 = ret[0];
1049
+ deferred1_1 = ret[1];
1050
+ return getStringFromWasm0(ret[0], ret[1]);
1051
+ } finally {
1052
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1053
+ }
1054
+ }
1055
+ /**
1056
+ * @returns {Float64Array}
1057
+ */
1058
+ get_bounds() {
1059
+ const ret = wasm.oganalyticbrep_get_bounds(this.__wbg_ptr);
1060
+ if (ret[3]) {
1061
+ throw takeFromExternrefTable0(ret[2]);
1062
+ }
1063
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1064
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1065
+ return v1;
1066
+ }
1067
+ /**
1068
+ * @returns {number}
1069
+ */
1070
+ get_vertex_count() {
1071
+ const ret = wasm.oganalyticbrep_get_vertex_count(this.__wbg_ptr);
1072
+ return ret >>> 0;
1073
+ }
1074
+ /**
1075
+ * @returns {bigint}
1076
+ */
1077
+ get_revision() {
1078
+ const ret = wasm.oganalyticbrep_get_revision(this.__wbg_ptr);
1079
+ return BigInt.asUintN(64, ret);
1080
+ }
1081
+ }
1082
+
1083
+ const OGAnalyticTessellationFinalization = (typeof FinalizationRegistry === 'undefined')
1084
+ ? { register: () => {}, unregister: () => {} }
1085
+ : new FinalizationRegistry(ptr => wasm.__wbg_oganalytictessellation_free(ptr >>> 0, 1));
1086
+
1087
+ export class OGAnalyticTessellation {
1088
+
1089
+ static __wrap(ptr) {
1090
+ ptr = ptr >>> 0;
1091
+ const obj = Object.create(OGAnalyticTessellation.prototype);
1092
+ obj.__wbg_ptr = ptr;
1093
+ OGAnalyticTessellationFinalization.register(obj, obj.__wbg_ptr, obj);
1094
+ return obj;
1095
+ }
1096
+
1097
+ __destroy_into_raw() {
1098
+ const ptr = this.__wbg_ptr;
1099
+ this.__wbg_ptr = 0;
1100
+ OGAnalyticTessellationFinalization.unregister(this);
1101
+ return ptr;
1102
+ }
1103
+
1104
+ free() {
1105
+ const ptr = this.__destroy_into_raw();
1106
+ wasm.__wbg_oganalytictessellation_free(ptr, 0);
1107
+ }
1108
+ /**
1109
+ * @returns {Float64Array}
1110
+ */
1111
+ positions() {
1112
+ const ret = wasm.oganalytictessellation_positions(this.__wbg_ptr);
1113
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1114
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1115
+ return v1;
1116
+ }
1117
+ /**
1118
+ * @returns {Float32Array}
1119
+ */
1120
+ normals() {
1121
+ const ret = wasm.oganalytictessellation_normals(this.__wbg_ptr);
1122
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1123
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1124
+ return v1;
1125
+ }
1126
+ /**
1127
+ * @returns {Uint32Array}
1128
+ */
1129
+ indices() {
1130
+ const ret = wasm.oganalytictessellation_indices(this.__wbg_ptr);
1131
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1132
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1133
+ return v1;
1134
+ }
1135
+ /**
1136
+ * @returns {Uint32Array}
1137
+ */
1138
+ triangle_face_ids() {
1139
+ const ret = wasm.oganalytictessellation_triangle_face_ids(this.__wbg_ptr);
1140
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1141
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1142
+ return v1;
1143
+ }
1144
+ /**
1145
+ * @returns {Float64Array}
1146
+ */
1147
+ outline_positions() {
1148
+ const ret = wasm.oganalytictessellation_outline_positions(this.__wbg_ptr);
1149
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1150
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1151
+ return v1;
1152
+ }
1153
+ /**
1154
+ * @returns {Uint32Array}
1155
+ */
1156
+ outline_edge_ids() {
1157
+ const ret = wasm.oganalytictessellation_outline_edge_ids(this.__wbg_ptr);
1158
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1159
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1160
+ return v1;
1161
+ }
1162
+ /**
1163
+ * @returns {bigint}
1164
+ */
1165
+ revision() {
1166
+ const ret = wasm.oganalytictessellation_revision(this.__wbg_ptr);
1167
+ return BigInt.asUintN(64, ret);
1168
+ }
1169
+ /**
1170
+ * @returns {number}
1171
+ */
1172
+ achieved_deflection() {
1173
+ const ret = wasm.oganalytictessellation_achieved_deflection(this.__wbg_ptr);
1174
+ return ret;
1175
+ }
1176
+ }
1177
+
1178
+ const OGArcFinalization = (typeof FinalizationRegistry === 'undefined')
1179
+ ? { register: () => {}, unregister: () => {} }
1180
+ : new FinalizationRegistry(ptr => wasm.__wbg_ogarc_free(ptr >>> 0, 1));
1181
+
1182
+ export class OGArc {
1183
+
1184
+ __destroy_into_raw() {
1185
+ const ptr = this.__wbg_ptr;
1186
+ this.__wbg_ptr = 0;
1187
+ OGArcFinalization.unregister(this);
1188
+ return ptr;
1189
+ }
1190
+
1191
+ free() {
1192
+ const ptr = this.__destroy_into_raw();
1193
+ wasm.__wbg_ogarc_free(ptr, 0);
1194
+ }
1195
+ /**
1196
+ * @param {string} id
1197
+ */
1198
+ set id(id) {
1199
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1200
+ const len0 = WASM_VECTOR_LEN;
1201
+ wasm.ogarc_set_id(this.__wbg_ptr, ptr0, len0);
1202
+ }
1203
+ /**
1204
+ * @returns {string}
1205
+ */
1206
+ get id() {
1207
+ let deferred1_0;
1208
+ let deferred1_1;
1209
+ try {
1210
+ const ret = wasm.ogarc_id(this.__wbg_ptr);
749
1211
  deferred1_0 = ret[0];
750
1212
  deferred1_1 = ret[1];
751
1213
  return getStringFromWasm0(ret[0], ret[1]);
@@ -918,104 +1380,15 @@ export class OGArc {
918
1380
  get_local_geometry_buffer() {
919
1381
  const ret = wasm.ogarc_get_local_geometry_buffer(this.__wbg_ptr);
920
1382
  var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
921
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
922
- return v1;
923
- }
924
- /**
925
- * @returns {Vector3}
926
- */
927
- get_anchor() {
928
- const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
929
- return Vector3.__wrap(ret);
930
- }
931
- }
932
-
933
- const OGBooleanResultFinalization = (typeof FinalizationRegistry === 'undefined')
934
- ? { register: () => {}, unregister: () => {} }
935
- : new FinalizationRegistry(ptr => wasm.__wbg_ogbooleanresult_free(ptr >>> 0, 1));
936
- /**
937
- * Result payload returned across the wasm boundary.
938
- */
939
- export class OGBooleanResult {
940
-
941
- static __wrap(ptr) {
942
- ptr = ptr >>> 0;
943
- const obj = Object.create(OGBooleanResult.prototype);
944
- obj.__wbg_ptr = ptr;
945
- OGBooleanResultFinalization.register(obj, obj.__wbg_ptr, obj);
946
- return obj;
947
- }
948
-
949
- __destroy_into_raw() {
950
- const ptr = this.__wbg_ptr;
951
- this.__wbg_ptr = 0;
952
- OGBooleanResultFinalization.unregister(this);
953
- return ptr;
954
- }
955
-
956
- free() {
957
- const ptr = this.__destroy_into_raw();
958
- wasm.__wbg_ogbooleanresult_free(ptr, 0);
959
- }
960
- /**
961
- * @returns {string}
962
- */
963
- get brepSerialized() {
964
- let deferred1_0;
965
- let deferred1_1;
966
- try {
967
- const ret = wasm.ogbooleanresult_brepSerialized(this.__wbg_ptr);
968
- deferred1_0 = ret[0];
969
- deferred1_1 = ret[1];
970
- return getStringFromWasm0(ret[0], ret[1]);
971
- } finally {
972
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
973
- }
974
- }
975
- /**
976
- * @returns {string}
977
- */
978
- get geometrySerialized() {
979
- let deferred1_0;
980
- let deferred1_1;
981
- try {
982
- const ret = wasm.ogbooleanresult_geometrySerialized(this.__wbg_ptr);
983
- deferred1_0 = ret[0];
984
- deferred1_1 = ret[1];
985
- return getStringFromWasm0(ret[0], ret[1]);
986
- } finally {
987
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
988
- }
989
- }
990
- /**
991
- * @returns {string}
992
- */
993
- get outlineGeometrySerialized() {
994
- let deferred1_0;
995
- let deferred1_1;
996
- try {
997
- const ret = wasm.ogbooleanresult_outlineGeometrySerialized(this.__wbg_ptr);
998
- deferred1_0 = ret[0];
999
- deferred1_1 = ret[1];
1000
- return getStringFromWasm0(ret[0], ret[1]);
1001
- } finally {
1002
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1003
- }
1383
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1384
+ return v1;
1004
1385
  }
1005
1386
  /**
1006
- * @returns {string}
1387
+ * @returns {Vector3}
1007
1388
  */
1008
- get reportJson() {
1009
- let deferred1_0;
1010
- let deferred1_1;
1011
- try {
1012
- const ret = wasm.ogbooleanresult_reportJson(this.__wbg_ptr);
1013
- deferred1_0 = ret[0];
1014
- deferred1_1 = ret[1];
1015
- return getStringFromWasm0(ret[0], ret[1]);
1016
- } finally {
1017
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1018
- }
1389
+ get_anchor() {
1390
+ const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
1391
+ return Vector3.__wrap(ret);
1019
1392
  }
1020
1393
  }
1021
1394
 
@@ -1782,6 +2155,224 @@ export class OGCylinder {
1782
2155
  }
1783
2156
  }
1784
2157
 
2158
+ const OGEllipticalArcFinalization = (typeof FinalizationRegistry === 'undefined')
2159
+ ? { register: () => {}, unregister: () => {} }
2160
+ : new FinalizationRegistry(ptr => wasm.__wbg_ogellipticalarc_free(ptr >>> 0, 1));
2161
+
2162
+ export class OGEllipticalArc {
2163
+
2164
+ __destroy_into_raw() {
2165
+ const ptr = this.__wbg_ptr;
2166
+ this.__wbg_ptr = 0;
2167
+ OGEllipticalArcFinalization.unregister(this);
2168
+ return ptr;
2169
+ }
2170
+
2171
+ free() {
2172
+ const ptr = this.__destroy_into_raw();
2173
+ wasm.__wbg_ogellipticalarc_free(ptr, 0);
2174
+ }
2175
+ /**
2176
+ * @param {string} id
2177
+ */
2178
+ set id(id) {
2179
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2180
+ const len0 = WASM_VECTOR_LEN;
2181
+ wasm.ogellipticalarc_set_id(this.__wbg_ptr, ptr0, len0);
2182
+ }
2183
+ /**
2184
+ * @returns {string}
2185
+ */
2186
+ get id() {
2187
+ let deferred1_0;
2188
+ let deferred1_1;
2189
+ try {
2190
+ const ret = wasm.ogellipticalarc_id(this.__wbg_ptr);
2191
+ deferred1_0 = ret[0];
2192
+ deferred1_1 = ret[1];
2193
+ return getStringFromWasm0(ret[0], ret[1]);
2194
+ } finally {
2195
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2196
+ }
2197
+ }
2198
+ /**
2199
+ * @param {string} id
2200
+ */
2201
+ constructor(id) {
2202
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2203
+ const len0 = WASM_VECTOR_LEN;
2204
+ const ret = wasm.ogellipticalarc_new(ptr0, len0);
2205
+ this.__wbg_ptr = ret >>> 0;
2206
+ OGEllipticalArcFinalization.register(this, this.__wbg_ptr, this);
2207
+ return this;
2208
+ }
2209
+ /**
2210
+ * @param {Vector3} center
2211
+ * @param {number} radius_x
2212
+ * @param {number} radius_z
2213
+ * @param {number} start_angle
2214
+ * @param {number} end_angle
2215
+ * @param {number} segments
2216
+ */
2217
+ set_config(center, radius_x, radius_z, start_angle, end_angle, segments) {
2218
+ _assertClass(center, Vector3);
2219
+ var ptr0 = center.__destroy_into_raw();
2220
+ const ret = wasm.ogellipticalarc_set_config(this.__wbg_ptr, ptr0, radius_x, radius_z, start_angle, end_angle, segments);
2221
+ if (ret[1]) {
2222
+ throw takeFromExternrefTable0(ret[0]);
2223
+ }
2224
+ }
2225
+ /**
2226
+ * @param {Vector3} center
2227
+ */
2228
+ set_center(center) {
2229
+ _assertClass(center, Vector3);
2230
+ var ptr0 = center.__destroy_into_raw();
2231
+ wasm.ogellipticalarc_set_center(this.__wbg_ptr, ptr0);
2232
+ }
2233
+ /**
2234
+ * @param {Vector3} position
2235
+ * @param {Vector3} rotation
2236
+ * @param {Vector3} scale
2237
+ */
2238
+ set_transform(position, rotation, scale) {
2239
+ _assertClass(position, Vector3);
2240
+ var ptr0 = position.__destroy_into_raw();
2241
+ _assertClass(rotation, Vector3);
2242
+ var ptr1 = rotation.__destroy_into_raw();
2243
+ _assertClass(scale, Vector3);
2244
+ var ptr2 = scale.__destroy_into_raw();
2245
+ const ret = wasm.ogellipticalarc_set_transform(this.__wbg_ptr, ptr0, ptr1, ptr2);
2246
+ if (ret[1]) {
2247
+ throw takeFromExternrefTable0(ret[0]);
2248
+ }
2249
+ }
2250
+ /**
2251
+ * @param {Vector3} translation
2252
+ */
2253
+ set_translation(translation) {
2254
+ _assertClass(translation, Vector3);
2255
+ var ptr0 = translation.__destroy_into_raw();
2256
+ wasm.ogellipticalarc_set_translation(this.__wbg_ptr, ptr0);
2257
+ }
2258
+ /**
2259
+ * @param {Vector3} rotation
2260
+ */
2261
+ set_rotation(rotation) {
2262
+ _assertClass(rotation, Vector3);
2263
+ var ptr0 = rotation.__destroy_into_raw();
2264
+ wasm.ogellipticalarc_set_rotation(this.__wbg_ptr, ptr0);
2265
+ }
2266
+ /**
2267
+ * @param {Vector3} scale
2268
+ */
2269
+ set_scale(scale) {
2270
+ _assertClass(scale, Vector3);
2271
+ var ptr0 = scale.__destroy_into_raw();
2272
+ const ret = wasm.ogellipticalarc_set_scale(this.__wbg_ptr, ptr0);
2273
+ if (ret[1]) {
2274
+ throw takeFromExternrefTable0(ret[0]);
2275
+ }
2276
+ }
2277
+ generate_geometry() {
2278
+ const ret = wasm.ogellipticalarc_generate_geometry(this.__wbg_ptr);
2279
+ if (ret[1]) {
2280
+ throw takeFromExternrefTable0(ret[0]);
2281
+ }
2282
+ }
2283
+ dispose_points() {
2284
+ wasm.ogellipticalarc_dispose_points(this.__wbg_ptr);
2285
+ }
2286
+ destroy() {
2287
+ wasm.ogellipticalarc_destroy(this.__wbg_ptr);
2288
+ }
2289
+ /**
2290
+ * @returns {string}
2291
+ */
2292
+ get_brep_serialized() {
2293
+ let deferred1_0;
2294
+ let deferred1_1;
2295
+ try {
2296
+ const ret = wasm.ogellipticalarc_get_brep_serialized(this.__wbg_ptr);
2297
+ deferred1_0 = ret[0];
2298
+ deferred1_1 = ret[1];
2299
+ return getStringFromWasm0(ret[0], ret[1]);
2300
+ } finally {
2301
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2302
+ }
2303
+ }
2304
+ /**
2305
+ * @returns {string}
2306
+ */
2307
+ get_local_brep_serialized() {
2308
+ let deferred1_0;
2309
+ let deferred1_1;
2310
+ try {
2311
+ const ret = wasm.ogellipticalarc_get_local_brep_serialized(this.__wbg_ptr);
2312
+ deferred1_0 = ret[0];
2313
+ deferred1_1 = ret[1];
2314
+ return getStringFromWasm0(ret[0], ret[1]);
2315
+ } finally {
2316
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2317
+ }
2318
+ }
2319
+ /**
2320
+ * @returns {string}
2321
+ */
2322
+ get_geometry_serialized() {
2323
+ let deferred1_0;
2324
+ let deferred1_1;
2325
+ try {
2326
+ const ret = wasm.ogellipticalarc_get_geometry_serialized(this.__wbg_ptr);
2327
+ deferred1_0 = ret[0];
2328
+ deferred1_1 = ret[1];
2329
+ return getStringFromWasm0(ret[0], ret[1]);
2330
+ } finally {
2331
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2332
+ }
2333
+ }
2334
+ /**
2335
+ * @returns {string}
2336
+ */
2337
+ get_local_geometry_serialized() {
2338
+ let deferred1_0;
2339
+ let deferred1_1;
2340
+ try {
2341
+ const ret = wasm.ogellipticalarc_get_local_geometry_serialized(this.__wbg_ptr);
2342
+ deferred1_0 = ret[0];
2343
+ deferred1_1 = ret[1];
2344
+ return getStringFromWasm0(ret[0], ret[1]);
2345
+ } finally {
2346
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2347
+ }
2348
+ }
2349
+ /**
2350
+ * @returns {Float64Array}
2351
+ */
2352
+ get_geometry_buffer() {
2353
+ const ret = wasm.ogellipticalarc_get_geometry_buffer(this.__wbg_ptr);
2354
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2355
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2356
+ return v1;
2357
+ }
2358
+ /**
2359
+ * @returns {Float64Array}
2360
+ */
2361
+ get_local_geometry_buffer() {
2362
+ const ret = wasm.ogellipticalarc_get_local_geometry_buffer(this.__wbg_ptr);
2363
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
2364
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
2365
+ return v1;
2366
+ }
2367
+ /**
2368
+ * @returns {Vector3}
2369
+ */
2370
+ get_anchor() {
2371
+ const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
2372
+ return Vector3.__wrap(ret);
2373
+ }
2374
+ }
2375
+
1785
2376
  const OGEntityRegistryFinalization = (typeof FinalizationRegistry === 'undefined')
1786
2377
  ? { register: () => {}, unregister: () => {} }
1787
2378
  : new FinalizationRegistry(ptr => wasm.__wbg_ogentityregistry_free(ptr >>> 0, 1));
@@ -3544,7 +4135,7 @@ export class OGPolyline {
3544
4135
  * @returns {Vector3}
3545
4136
  */
3546
4137
  get_anchor() {
3547
- const ret = wasm.ogpolyline_get_anchor(this.__wbg_ptr);
4138
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
3548
4139
  return Vector3.__wrap(ret);
3549
4140
  }
3550
4141
  /**
@@ -5266,7 +5857,7 @@ export class OGSweep {
5266
5857
  * @returns {Vector3}
5267
5858
  */
5268
5859
  get_anchor() {
5269
- const ret = wasm.ogsweep_get_anchor(this.__wbg_ptr);
5860
+ const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
5270
5861
  return Vector3.__wrap(ret);
5271
5862
  }
5272
5863
  /**
@@ -5550,7 +6141,7 @@ export class OGWedge {
5550
6141
  * @returns {Vector3}
5551
6142
  */
5552
6143
  get_anchor() {
5553
- const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
6144
+ const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
5554
6145
  return Vector3.__wrap(ret);
5555
6146
  }
5556
6147
  }
@@ -5849,6 +6440,104 @@ export class Vector3 {
5849
6440
  }
5850
6441
  }
5851
6442
 
6443
+ const WorkPlaneFinalization = (typeof FinalizationRegistry === 'undefined')
6444
+ ? { register: () => {}, unregister: () => {} }
6445
+ : new FinalizationRegistry(ptr => wasm.__wbg_workplane_free(ptr >>> 0, 1));
6446
+
6447
+ export class WorkPlane {
6448
+
6449
+ static __wrap(ptr) {
6450
+ ptr = ptr >>> 0;
6451
+ const obj = Object.create(WorkPlane.prototype);
6452
+ obj.__wbg_ptr = ptr;
6453
+ WorkPlaneFinalization.register(obj, obj.__wbg_ptr, obj);
6454
+ return obj;
6455
+ }
6456
+
6457
+ __destroy_into_raw() {
6458
+ const ptr = this.__wbg_ptr;
6459
+ this.__wbg_ptr = 0;
6460
+ WorkPlaneFinalization.unregister(this);
6461
+ return ptr;
6462
+ }
6463
+
6464
+ free() {
6465
+ const ptr = this.__destroy_into_raw();
6466
+ wasm.__wbg_workplane_free(ptr, 0);
6467
+ }
6468
+ /**
6469
+ * Builds a work plane from an origin and normal, choosing a stable in-plane
6470
+ * `u` axis automatically (`v = normal × u`).
6471
+ * @param {Vector3} origin
6472
+ * @param {Vector3} normal
6473
+ * @returns {WorkPlane}
6474
+ */
6475
+ static fromOriginNormal(origin, normal) {
6476
+ _assertClass(origin, Vector3);
6477
+ var ptr0 = origin.__destroy_into_raw();
6478
+ _assertClass(normal, Vector3);
6479
+ var ptr1 = normal.__destroy_into_raw();
6480
+ const ret = wasm.workplane_fromOriginNormal(ptr0, ptr1);
6481
+ return WorkPlane.__wrap(ret);
6482
+ }
6483
+ /**
6484
+ * Builds a work plane from an origin, normal, and a preferred `u` axis. The
6485
+ * `u` axis is projected onto the plane and orthonormalized; `v = normal × u`.
6486
+ * @param {Vector3} origin
6487
+ * @param {Vector3} normal
6488
+ * @param {Vector3} u_hint
6489
+ */
6490
+ constructor(origin, normal, u_hint) {
6491
+ _assertClass(origin, Vector3);
6492
+ var ptr0 = origin.__destroy_into_raw();
6493
+ _assertClass(normal, Vector3);
6494
+ var ptr1 = normal.__destroy_into_raw();
6495
+ _assertClass(u_hint, Vector3);
6496
+ var ptr2 = u_hint.__destroy_into_raw();
6497
+ const ret = wasm.workplane_new(ptr0, ptr1, ptr2);
6498
+ this.__wbg_ptr = ret >>> 0;
6499
+ WorkPlaneFinalization.register(this, this.__wbg_ptr, this);
6500
+ return this;
6501
+ }
6502
+ /**
6503
+ * Lifts a single 2D in-plane coordinate to 3D world space.
6504
+ * @param {number} u
6505
+ * @param {number} v
6506
+ * @returns {Vector3}
6507
+ */
6508
+ liftPoint(u, v) {
6509
+ const ret = wasm.workplane_liftPoint(this.__wbg_ptr, u, v);
6510
+ return Vector3.__wrap(ret);
6511
+ }
6512
+ /**
6513
+ * Lifts a flat `[u0,v0,u1,v1,…]` buffer to a flat `[x0,y0,z0,…]` world buffer.
6514
+ * @param {Float64Array} uv
6515
+ * @returns {Float64Array}
6516
+ */
6517
+ liftPoints(uv) {
6518
+ const ptr0 = passArrayF64ToWasm0(uv, wasm.__wbindgen_malloc);
6519
+ const len0 = WASM_VECTOR_LEN;
6520
+ const ret = wasm.workplane_liftPoints(this.__wbg_ptr, ptr0, len0);
6521
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
6522
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
6523
+ return v2;
6524
+ }
6525
+ /**
6526
+ * @returns {Vector3}
6527
+ */
6528
+ get origin() {
6529
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
6530
+ return Vector3.__wrap(ret);
6531
+ }
6532
+ /**
6533
+ * @returns {Vector3}
6534
+ */
6535
+ get normal() {
6536
+ const ret = wasm.workplane_normal(this.__wbg_ptr);
6537
+ return Vector3.__wrap(ret);
6538
+ }
6539
+ }
6540
+
5852
6541
  async function __wbg_load(module, imports) {
5853
6542
  if (typeof Response === 'function' && module instanceof Response) {
5854
6543
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -5894,13 +6583,6 @@ function __wbg_get_imports() {
5894
6583
  const ret = Vector3.__unwrap(arg0);
5895
6584
  return ret;
5896
6585
  };
5897
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
5898
- const ret = debugString(arg1);
5899
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5900
- const len1 = WASM_VECTOR_LEN;
5901
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5902
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5903
- };
5904
6586
  imports.wbg.__wbindgen_init_externref_table = function() {
5905
6587
  const table = wasm.__wbindgen_export_2;
5906
6588
  const offset = table.grow(4);
@@ -5930,7 +6612,9 @@ function __wbg_finalize_init(instance, module) {
5930
6612
  wasm = instance.exports;
5931
6613
  __wbg_init.__wbindgen_wasm_module = module;
5932
6614
  cachedDataViewMemory0 = null;
6615
+ cachedFloat32ArrayMemory0 = null;
5933
6616
  cachedFloat64ArrayMemory0 = null;
6617
+ cachedUint32ArrayMemory0 = null;
5934
6618
  cachedUint8ArrayMemory0 = null;
5935
6619
 
5936
6620