opengeometry 2.0.13 → 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 (37) hide show
  1. package/analytic-worker.js +90 -0
  2. package/index.d.ts +16 -1
  3. package/index.js +3065 -3675
  4. package/index.js.map +1 -1
  5. package/opengeometry/pkg/opengeometry.d.ts +261 -236
  6. package/opengeometry/pkg/opengeometry.js +754 -538
  7. package/opengeometry/pkg/opengeometry_bg.wasm +0 -0
  8. package/opengeometry/pkg/opengeometry_bg.wasm.d.ts +211 -190
  9. package/opengeometry_bg.wasm +0 -0
  10. package/opengeometry_bg.wasm.d.ts +211 -190
  11. package/package.json +2 -1
  12. package/src/examples/booleans.d.ts +3 -2
  13. package/src/examples/editor-modes.d.ts +4 -8
  14. package/src/examples/shapes.d.ts +1 -1
  15. package/src/examples/wall-from-offsets.d.ts +7 -14
  16. package/src/export/analytic-ifc.d.ts +61 -0
  17. package/src/freeform/geometry.d.ts +2 -0
  18. package/src/freeform/index.d.ts +1 -1
  19. package/src/operations/analytic-errors.d.ts +8 -0
  20. package/src/operations/boolean.d.ts +9 -141
  21. package/src/operations/index.d.ts +2 -1
  22. package/src/operations/loft.d.ts +13 -0
  23. package/src/primitives/analytic-curve.d.ts +42 -0
  24. package/src/primitives/arc.d.ts +26 -55
  25. package/src/primitives/elliptical_arc.d.ts +29 -57
  26. package/src/rendering/analytic-lod.d.ts +32 -0
  27. package/src/rendering/analytic-tessellation.d.ts +32 -0
  28. package/src/shapes/analytic-pattern.d.ts +36 -0
  29. package/src/shapes/analytic-solid.d.ts +288 -0
  30. package/src/shapes/cuboid.d.ts +40 -54
  31. package/src/shapes/cylinder.d.ts +26 -70
  32. package/src/shapes/opening.d.ts +19 -82
  33. package/src/shapes/polygon.d.ts +4 -5
  34. package/src/shapes/solid.d.ts +0 -8
  35. package/src/shapes/sphere.d.ts +18 -73
  36. package/src/shapes/sweep.d.ts +0 -5
  37. package/src/shapes/wedge.d.ts +0 -5
@@ -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,94 +94,23 @@ 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
- function _assertClass(instance, klass) {
172
- if (!(instance instanceof klass)) {
173
- throw new Error(`expected instance of ${klass.name}`);
174
- }
175
- }
176
-
177
97
  function takeFromExternrefTable0(idx) {
178
98
  const value = wasm.__wbindgen_export_2.get(idx);
179
99
  wasm.__externref_table_dealloc(idx);
180
100
  return value;
181
101
  }
182
-
183
- let cachedFloat64ArrayMemory0 = null;
184
-
185
- function getFloat64ArrayMemory0() {
186
- if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
187
- cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
188
- }
189
- return cachedFloat64ArrayMemory0;
190
- }
191
-
192
- function getArrayF64FromWasm0(ptr, len) {
193
- ptr = ptr >>> 0;
194
- return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
195
- }
196
-
197
- function passArrayJsValueToWasm0(array, malloc) {
198
- const ptr = malloc(array.length * 4, 4) >>> 0;
199
- for (let i = 0; i < array.length; i++) {
200
- const add = addToExternrefTable0(array[i]);
201
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
202
- }
203
- WASM_VECTOR_LEN = array.length;
204
- return ptr;
205
- }
206
-
207
- function passArrayF64ToWasm0(arg, malloc) {
208
- const ptr = malloc(arg.length * 8, 8) >>> 0;
209
- getFloat64ArrayMemory0().set(arg, ptr / 8);
210
- WASM_VECTOR_LEN = arg.length;
211
- return ptr;
212
- }
213
-
214
- function getArrayJsValueFromWasm0(ptr, len) {
215
- ptr = ptr >>> 0;
216
- const mem = getDataViewMemory0();
217
- const result = [];
218
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
219
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
220
- }
221
- wasm.__externref_drop_slice(ptr, len);
222
- return result;
223
- }
224
-
225
- function isLikeNone(x) {
226
- return x === undefined || x === null;
227
- }
228
102
  /**
229
- * Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
230
- * JSON (the corrected points are not returned here; use the kernel API).
231
- * @param {Float64Array} flat_points
103
+ * @param {string} local_brep_serialized
104
+ * @param {number} height
232
105
  * @returns {string}
233
106
  */
234
- export function analyzeProfile(flat_points) {
107
+ export function extrudeBrepFace(local_brep_serialized, height) {
235
108
  let deferred3_0;
236
109
  let deferred3_1;
237
110
  try {
238
- const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
111
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
239
112
  const len0 = WASM_VECTOR_LEN;
240
- const ret = wasm.analyzeProfile(ptr0, len0);
113
+ const ret = wasm.extrudeBrepFace(ptr0, len0, height);
241
114
  var ptr2 = ret[0];
242
115
  var len2 = ret[1];
243
116
  if (ret[3]) {
@@ -252,47 +125,71 @@ export function analyzeProfile(flat_points) {
252
125
  }
253
126
  }
254
127
 
128
+ let cachedFloat64ArrayMemory0 = null;
129
+
130
+ function getFloat64ArrayMemory0() {
131
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
132
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
133
+ }
134
+ return cachedFloat64ArrayMemory0;
135
+ }
136
+
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
+ }
255
143
  /**
256
- * Wasm entry point: check a serialized B-rep's geometric validity, returning
257
- * the [`ValidityReport`] as JSON.
258
- * @param {string} brep_json
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
259
153
  * @returns {string}
260
154
  */
261
- export function checkBrepValidity(brep_json) {
262
- let deferred3_0;
263
- let deferred3_1;
155
+ export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
156
+ let deferred5_0;
157
+ let deferred5_1;
264
158
  try {
265
- const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
159
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266
160
  const len0 = WASM_VECTOR_LEN;
267
- const ret = wasm.checkBrepValidity(ptr0, len0);
268
- var ptr2 = ret[0];
269
- var len2 = ret[1];
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];
270
168
  if (ret[3]) {
271
- ptr2 = 0; len2 = 0;
169
+ ptr4 = 0; len4 = 0;
272
170
  throw takeFromExternrefTable0(ret[2]);
273
171
  }
274
- deferred3_0 = ptr2;
275
- deferred3_1 = len2;
276
- return getStringFromWasm0(ptr2, len2);
172
+ deferred5_0 = ptr4;
173
+ deferred5_1 = len4;
174
+ return getStringFromWasm0(ptr4, len4);
277
175
  } finally {
278
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
176
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
279
177
  }
280
178
  }
281
179
 
282
180
  /**
283
- * Wasm entry point: heal a serialized B-rep, returning JSON
284
- * `{ "brep": <healed brep>, "report": <heal report> }`.
285
- * @param {string} brep_json
286
- * @param {number} tolerance
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
287
184
  * @returns {string}
288
185
  */
289
- export function healBrep(brep_json, tolerance) {
186
+ export function analyzeProfile(flat_points) {
290
187
  let deferred3_0;
291
188
  let deferred3_1;
292
189
  try {
293
- const ptr0 = passStringToWasm0(brep_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
190
+ const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
294
191
  const len0 = WASM_VECTOR_LEN;
295
- const ret = wasm.healBrep(ptr0, len0, tolerance);
192
+ const ret = wasm.analyzeProfile(ptr0, len0);
296
193
  var ptr2 = ret[0];
297
194
  var len2 = ret[1];
298
195
  if (ret[3]) {
@@ -307,6 +204,39 @@ export function healBrep(brep_json, tolerance) {
307
204
  }
308
205
  }
309
206
 
207
+ function _assertClass(instance, klass) {
208
+ if (!(instance instanceof klass)) {
209
+ throw new Error(`expected instance of ${klass.name}`);
210
+ }
211
+ }
212
+
213
+ function isLikeNone(x) {
214
+ return x === undefined || x === null;
215
+ }
216
+
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;
238
+ return ptr;
239
+ }
310
240
  /**
311
241
  * Wasm entry point: offset a centreline by `width` into stroked regions via the
312
242
  * deterministic analytic offset. `centreline_flat` is `[x0,y0,z0, …]`. Returns
@@ -378,17 +308,16 @@ export function offsetRingVariable(ring_flat, distances, holes_json) {
378
308
  }
379
309
 
380
310
  /**
381
- * @param {string} local_brep_serialized
382
- * @param {number} height
311
+ * @param {string} serialized
383
312
  * @returns {string}
384
313
  */
385
- export function extrudeBrepFace(local_brep_serialized, height) {
314
+ export function validateAnalyticBrep(serialized) {
386
315
  let deferred3_0;
387
316
  let deferred3_1;
388
317
  try {
389
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
318
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
390
319
  const len0 = WASM_VECTOR_LEN;
391
- const ret = wasm.extrudeBrepFace(ptr0, len0, height);
320
+ const ret = wasm.validateAnalyticBrep(ptr0, len0);
392
321
  var ptr2 = ret[0];
393
322
  var len2 = ret[1];
394
323
  if (ret[3]) {
@@ -404,143 +333,114 @@ export function extrudeBrepFace(local_brep_serialized, height) {
404
333
  }
405
334
 
406
335
  /**
407
- * Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
408
- * is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
409
- * extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
410
- * distance for one-sided/symmetric).
411
- * @param {string} local_brep_serialized
412
- * @param {Float64Array} direction
413
- * @param {string} extent_kind
414
- * @param {number} d_plus
415
- * @param {number} d_minus
416
- * @returns {string}
417
- */
418
- export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
419
- let deferred5_0;
420
- let deferred5_1;
421
- try {
422
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
- const len0 = WASM_VECTOR_LEN;
424
- const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
425
- const len1 = WASM_VECTOR_LEN;
426
- const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
- const len2 = WASM_VECTOR_LEN;
428
- const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
429
- var ptr4 = ret[0];
430
- var len4 = ret[1];
431
- if (ret[3]) {
432
- ptr4 = 0; len4 = 0;
433
- throw takeFromExternrefTable0(ret[2]);
434
- }
435
- deferred5_0 = ptr4;
436
- deferred5_1 = len4;
437
- return getStringFromWasm0(ptr4, len4);
438
- } finally {
439
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
440
- }
441
- }
442
-
443
- /**
444
- * Wasm entry point for union.
445
- * @param {string} lhs_brep_serialized
446
- * @param {string} rhs_brep_serialized
336
+ * @param {string} serialized
337
+ * @param {number} deflection
447
338
  * @param {string | null} [options_json]
448
- * @returns {OGBooleanResult}
339
+ * @returns {OGAnalyticTessellation}
449
340
  */
450
- export function booleanUnion(lhs_brep_serialized, rhs_brep_serialized, options_json) {
451
- 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);
452
343
  const len0 = WASM_VECTOR_LEN;
453
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
454
- const len1 = WASM_VECTOR_LEN;
455
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
456
- var len2 = WASM_VECTOR_LEN;
457
- const ret = wasm.booleanUnion(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);
458
347
  if (ret[2]) {
459
348
  throw takeFromExternrefTable0(ret[1]);
460
349
  }
461
- return OGBooleanResult.__wrap(ret[0]);
350
+ return OGAnalyticTessellation.__wrap(ret[0]);
462
351
  }
463
352
 
464
- /**
465
- * Wasm entry point for intersection.
466
- * @param {string} lhs_brep_serialized
467
- * @param {string} rhs_brep_serialized
468
- * @param {string | null} [options_json]
469
- * @returns {OGBooleanResult}
470
- */
471
- export function booleanIntersection(lhs_brep_serialized, rhs_brep_serialized, options_json) {
472
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
473
- const len0 = WASM_VECTOR_LEN;
474
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
475
- const len1 = WASM_VECTOR_LEN;
476
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
477
- var len2 = WASM_VECTOR_LEN;
478
- const ret = wasm.booleanIntersection(ptr0, len0, ptr1, len1, ptr2, len2);
479
- if (ret[2]) {
480
- throw takeFromExternrefTable0(ret[1]);
353
+ let cachedFloat32ArrayMemory0 = null;
354
+
355
+ function getFloat32ArrayMemory0() {
356
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
357
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
481
358
  }
482
- return OGBooleanResult.__wrap(ret[0]);
359
+ return cachedFloat32ArrayMemory0;
483
360
  }
484
361
 
485
- /**
486
- * Wasm entry point for subtraction.
487
- * @param {string} lhs_brep_serialized
488
- * @param {string} rhs_brep_serialized
489
- * @param {string | null} [options_json]
490
- * @returns {OGBooleanResult}
491
- */
492
- export function booleanSubtraction(lhs_brep_serialized, rhs_brep_serialized, options_json) {
493
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
494
- const len0 = WASM_VECTOR_LEN;
495
- const ptr1 = passStringToWasm0(rhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
496
- const len1 = WASM_VECTOR_LEN;
497
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
498
- var len2 = WASM_VECTOR_LEN;
499
- const ret = wasm.booleanSubtraction(ptr0, len0, ptr1, len1, ptr2, len2);
500
- if (ret[2]) {
501
- throw takeFromExternrefTable0(ret[1]);
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);
502
372
  }
503
- return OGBooleanResult.__wrap(ret[0]);
373
+ return cachedUint32ArrayMemory0;
504
374
  }
505
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
+ }
506
391
  /**
507
- * Wasm entry point for array-backed repeated subtraction.
508
- * @param {string} lhs_brep_serialized
509
- * @param {string} cutters_brep_serialized
510
- * @param {string | null} [options_json]
511
- * @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}
512
396
  */
513
- export function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_serialized, options_json) {
514
- const ptr0 = passStringToWasm0(lhs_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
515
- const len0 = WASM_VECTOR_LEN;
516
- const ptr1 = passStringToWasm0(cutters_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
517
- const len1 = WASM_VECTOR_LEN;
518
- var ptr2 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
519
- var len2 = WASM_VECTOR_LEN;
520
- const ret = wasm.booleanSubtractionMany(ptr0, len0, ptr1, len1, ptr2, len2);
521
- if (ret[2]) {
522
- 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);
523
415
  }
524
- return OGBooleanResult.__wrap(ret[0]);
525
416
  }
526
417
 
527
418
  /**
528
- * Wasm entry point for array-backed batched union. Accepts a JSON array of
529
- * serialized BReps and folds them with `batch_union` in one boundary crossing.
530
- * @param {string} operands_brep_serialized
531
- * @param {string | null} [options_json]
532
- * @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}
533
424
  */
534
- export function batchUnion(operands_brep_serialized, options_json) {
535
- const ptr0 = passStringToWasm0(operands_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
536
- const len0 = WASM_VECTOR_LEN;
537
- var ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
538
- var len1 = WASM_VECTOR_LEN;
539
- const ret = wasm.batchUnion(ptr0, len0, ptr1, len1);
540
- if (ret[2]) {
541
- 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);
542
443
  }
543
- return OGBooleanResult.__wrap(ret[0]);
544
444
  }
545
445
 
546
446
  const Matrix3Finalization = (typeof FinalizationRegistry === 'undefined')
@@ -661,207 +561,617 @@ export class Matrix4 {
661
561
 
662
562
  static __wrap(ptr) {
663
563
  ptr = ptr >>> 0;
664
- const obj = Object.create(Matrix4.prototype);
564
+ const obj = Object.create(Matrix4.prototype);
565
+ obj.__wbg_ptr = ptr;
566
+ Matrix4Finalization.register(obj, obj.__wbg_ptr, obj);
567
+ return obj;
568
+ }
569
+
570
+ __destroy_into_raw() {
571
+ const ptr = this.__wbg_ptr;
572
+ this.__wbg_ptr = 0;
573
+ Matrix4Finalization.unregister(this);
574
+ return ptr;
575
+ }
576
+
577
+ free() {
578
+ const ptr = this.__destroy_into_raw();
579
+ wasm.__wbg_matrix4_free(ptr, 0);
580
+ }
581
+ /**
582
+ * @returns {Float64Array}
583
+ */
584
+ get elements() {
585
+ const ret = wasm.matrix4_elements(this.__wbg_ptr);
586
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
587
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
588
+ return v1;
589
+ }
590
+ /**
591
+ *
592
+ * * Create a new Matrix4 with identity elements.
593
+ *
594
+ */
595
+ constructor() {
596
+ const ret = wasm.matrix4_new();
597
+ this.__wbg_ptr = ret >>> 0;
598
+ Matrix4Finalization.register(this, this.__wbg_ptr, this);
599
+ return this;
600
+ }
601
+ /**
602
+ * @param {number} m0
603
+ * @param {number} m1
604
+ * @param {number} m2
605
+ * @param {number} m3
606
+ * @param {number} m4
607
+ * @param {number} m5
608
+ * @param {number} m6
609
+ * @param {number} m7
610
+ * @param {number} m8
611
+ * @param {number} m9
612
+ * @param {number} m10
613
+ * @param {number} m11
614
+ * @param {number} m12
615
+ * @param {number} m13
616
+ * @param {number} m14
617
+ * @param {number} m15
618
+ * @returns {Matrix4}
619
+ */
620
+ static set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
621
+ const ret = wasm.matrix4_set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15);
622
+ return Matrix4.__wrap(ret);
623
+ }
624
+ /**
625
+ *
626
+ * * Clone the Matrix4 instance and return a new one.
627
+ *
628
+ * @returns {Matrix4}
629
+ */
630
+ clone() {
631
+ const ret = wasm.matrix4_clone(this.__wbg_ptr);
632
+ return Matrix4.__wrap(ret);
633
+ }
634
+ /**
635
+ *
636
+ * * Sets the matrix element to create an identity matrix.
637
+ *
638
+ */
639
+ identity() {
640
+ wasm.matrix4_identity(this.__wbg_ptr);
641
+ }
642
+ /**
643
+ *
644
+ * * Determinant for a 4x4 matrix.
645
+ * * https://en.wikipedia.org/wiki/Determinant
646
+ *
647
+ * @returns {number}
648
+ */
649
+ determinant() {
650
+ const ret = wasm.matrix4_determinant(this.__wbg_ptr);
651
+ return ret;
652
+ }
653
+ /**
654
+ * @returns {Matrix4}
655
+ */
656
+ adjucate() {
657
+ const ret = wasm.matrix4_adjucate(this.__wbg_ptr);
658
+ return Matrix4.__wrap(ret);
659
+ }
660
+ /**
661
+ *
662
+ * * Inverse of a matrix
663
+ * * Returns a new Matrix4 instance.
664
+ * * If the determinant is zero, it returns a zero matrix.
665
+ * * It can be checked with is_zero() method.
666
+ *
667
+ * @returns {Matrix4}
668
+ */
669
+ inverse() {
670
+ const ret = wasm.matrix4_inverse(this.__wbg_ptr);
671
+ return Matrix4.__wrap(ret);
672
+ }
673
+ /**
674
+ *
675
+ * * Multiply this matrix with another Matrix4
676
+ * * Returns a new Matrix4 instance
677
+ *
678
+ * @param {Matrix4} other
679
+ * @returns {Matrix4}
680
+ */
681
+ multiply(other) {
682
+ _assertClass(other, Matrix4);
683
+ const ret = wasm.matrix4_multiply(this.__wbg_ptr, other.__wbg_ptr);
684
+ return Matrix4.__wrap(ret);
685
+ }
686
+ /**
687
+ *
688
+ * * Add another Matrix4 to this one.
689
+ * * Returns a new Matrix4 instance with the result.
690
+ *
691
+ * @param {Matrix4} incoming
692
+ * @returns {Matrix4}
693
+ */
694
+ add(incoming) {
695
+ _assertClass(incoming, Matrix4);
696
+ const ret = wasm.matrix4_add(this.__wbg_ptr, incoming.__wbg_ptr);
697
+ return Matrix4.__wrap(ret);
698
+ }
699
+ /**
700
+ *
701
+ * * Subtract another Matrix4 from this one.
702
+ * * Returns a new Matrix4 instance with the result.
703
+ *
704
+ * @param {Matrix4} incoming
705
+ * @returns {Matrix4}
706
+ */
707
+ subtract(incoming) {
708
+ _assertClass(incoming, Matrix4);
709
+ const ret = wasm.matrix4_subtract(this.__wbg_ptr, incoming.__wbg_ptr);
710
+ return Matrix4.__wrap(ret);
711
+ }
712
+ /**
713
+ *
714
+ * * Flatten the matrix into a vector of f64.
715
+ *
716
+ * @returns {Float64Array}
717
+ */
718
+ flatten() {
719
+ const ret = wasm.matrix4_flatten(this.__wbg_ptr);
720
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
721
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
722
+ return v1;
723
+ }
724
+ /**
725
+ *
726
+ * * Get the element at a specific index in the flattened matrix.
727
+ *
728
+ * @param {number} index
729
+ * @returns {number | undefined}
730
+ */
731
+ get_element_at(index) {
732
+ const ret = wasm.matrix4_get_element_at(this.__wbg_ptr, index);
733
+ return ret[0] === 0 ? undefined : ret[1];
734
+ }
735
+ /**
736
+ *
737
+ * * Check if the matrix is a zero matrix.
738
+ *
739
+ * @returns {boolean}
740
+ */
741
+ is_zero() {
742
+ const ret = wasm.matrix4_is_zero(this.__wbg_ptr);
743
+ return ret !== 0;
744
+ }
745
+ /**
746
+ *
747
+ * * Check if the matrix is an identity matrix.
748
+ *
749
+ * @returns {boolean}
750
+ */
751
+ is_identity() {
752
+ const ret = wasm.matrix4_is_identity(this.__wbg_ptr);
753
+ return ret !== 0;
754
+ }
755
+ /**
756
+ *
757
+ * * Create a Transpose of the matrix.
758
+ * * Returns a new Matrix4 instance.
759
+ *
760
+ * @returns {Matrix4}
761
+ */
762
+ transpose() {
763
+ const ret = wasm.matrix4_transpose(this.__wbg_ptr);
764
+ return Matrix4.__wrap(ret);
765
+ }
766
+ }
767
+
768
+ const OGAnalyticBrepFinalization = (typeof FinalizationRegistry === 'undefined')
769
+ ? { register: () => {}, unregister: () => {} }
770
+ : new FinalizationRegistry(ptr => wasm.__wbg_oganalyticbrep_free(ptr >>> 0, 1));
771
+
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
+ }
781
+
782
+ __destroy_into_raw() {
783
+ const ptr = this.__wbg_ptr;
784
+ this.__wbg_ptr = 0;
785
+ OGAnalyticBrepFinalization.unregister(this);
786
+ return ptr;
787
+ }
788
+
789
+ free() {
790
+ const ptr = this.__destroy_into_raw();
791
+ wasm.__wbg_oganalyticbrep_free(ptr, 0);
792
+ }
793
+ /**
794
+ * @param {string} serialized
795
+ */
796
+ constructor(serialized) {
797
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
798
+ const len0 = WASM_VECTOR_LEN;
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]);
819
+ }
820
+ /**
821
+ * @returns {string}
822
+ */
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);
665
1092
  obj.__wbg_ptr = ptr;
666
- Matrix4Finalization.register(obj, obj.__wbg_ptr, obj);
1093
+ OGAnalyticTessellationFinalization.register(obj, obj.__wbg_ptr, obj);
667
1094
  return obj;
668
1095
  }
669
1096
 
670
1097
  __destroy_into_raw() {
671
1098
  const ptr = this.__wbg_ptr;
672
1099
  this.__wbg_ptr = 0;
673
- Matrix4Finalization.unregister(this);
1100
+ OGAnalyticTessellationFinalization.unregister(this);
674
1101
  return ptr;
675
1102
  }
676
1103
 
677
1104
  free() {
678
1105
  const ptr = this.__destroy_into_raw();
679
- wasm.__wbg_matrix4_free(ptr, 0);
1106
+ wasm.__wbg_oganalytictessellation_free(ptr, 0);
680
1107
  }
681
1108
  /**
682
1109
  * @returns {Float64Array}
683
1110
  */
684
- get elements() {
685
- const ret = wasm.matrix4_elements(this.__wbg_ptr);
1111
+ positions() {
1112
+ const ret = wasm.oganalytictessellation_positions(this.__wbg_ptr);
686
1113
  var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
687
1114
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
688
1115
  return v1;
689
1116
  }
690
1117
  /**
691
- *
692
- * * Create a new Matrix4 with identity elements.
693
- *
694
- */
695
- constructor() {
696
- const ret = wasm.matrix4_new();
697
- this.__wbg_ptr = ret >>> 0;
698
- Matrix4Finalization.register(this, this.__wbg_ptr, this);
699
- return this;
700
- }
701
- /**
702
- * @param {number} m0
703
- * @param {number} m1
704
- * @param {number} m2
705
- * @param {number} m3
706
- * @param {number} m4
707
- * @param {number} m5
708
- * @param {number} m6
709
- * @param {number} m7
710
- * @param {number} m8
711
- * @param {number} m9
712
- * @param {number} m10
713
- * @param {number} m11
714
- * @param {number} m12
715
- * @param {number} m13
716
- * @param {number} m14
717
- * @param {number} m15
718
- * @returns {Matrix4}
719
- */
720
- static set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
721
- const ret = wasm.matrix4_set(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15);
722
- return Matrix4.__wrap(ret);
723
- }
724
- /**
725
- *
726
- * * Clone the Matrix4 instance and return a new one.
727
- *
728
- * @returns {Matrix4}
729
- */
730
- clone() {
731
- const ret = wasm.matrix4_clone(this.__wbg_ptr);
732
- return Matrix4.__wrap(ret);
733
- }
734
- /**
735
- *
736
- * * Sets the matrix element to create an identity matrix.
737
- *
738
- */
739
- identity() {
740
- wasm.matrix4_identity(this.__wbg_ptr);
741
- }
742
- /**
743
- *
744
- * * Determinant for a 4x4 matrix.
745
- * * https://en.wikipedia.org/wiki/Determinant
746
- *
747
- * @returns {number}
748
- */
749
- determinant() {
750
- const ret = wasm.matrix4_determinant(this.__wbg_ptr);
751
- return ret;
752
- }
753
- /**
754
- * @returns {Matrix4}
755
- */
756
- adjucate() {
757
- const ret = wasm.matrix4_adjucate(this.__wbg_ptr);
758
- return Matrix4.__wrap(ret);
759
- }
760
- /**
761
- *
762
- * * Inverse of a matrix
763
- * * Returns a new Matrix4 instance.
764
- * * If the determinant is zero, it returns a zero matrix.
765
- * * It can be checked with is_zero() method.
766
- *
767
- * @returns {Matrix4}
768
- */
769
- inverse() {
770
- const ret = wasm.matrix4_inverse(this.__wbg_ptr);
771
- return Matrix4.__wrap(ret);
772
- }
773
- /**
774
- *
775
- * * Multiply this matrix with another Matrix4
776
- * * Returns a new Matrix4 instance
777
- *
778
- * @param {Matrix4} other
779
- * @returns {Matrix4}
1118
+ * @returns {Float32Array}
780
1119
  */
781
- multiply(other) {
782
- _assertClass(other, Matrix4);
783
- const ret = wasm.matrix4_multiply(this.__wbg_ptr, other.__wbg_ptr);
784
- return Matrix4.__wrap(ret);
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;
785
1125
  }
786
1126
  /**
787
- *
788
- * * Add another Matrix4 to this one.
789
- * * Returns a new Matrix4 instance with the result.
790
- *
791
- * @param {Matrix4} incoming
792
- * @returns {Matrix4}
1127
+ * @returns {Uint32Array}
793
1128
  */
794
- add(incoming) {
795
- _assertClass(incoming, Matrix4);
796
- const ret = wasm.matrix4_add(this.__wbg_ptr, incoming.__wbg_ptr);
797
- return Matrix4.__wrap(ret);
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;
798
1134
  }
799
1135
  /**
800
- *
801
- * * Subtract another Matrix4 from this one.
802
- * * Returns a new Matrix4 instance with the result.
803
- *
804
- * @param {Matrix4} incoming
805
- * @returns {Matrix4}
1136
+ * @returns {Uint32Array}
806
1137
  */
807
- subtract(incoming) {
808
- _assertClass(incoming, Matrix4);
809
- const ret = wasm.matrix4_subtract(this.__wbg_ptr, incoming.__wbg_ptr);
810
- return Matrix4.__wrap(ret);
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;
811
1143
  }
812
1144
  /**
813
- *
814
- * * Flatten the matrix into a vector of f64.
815
- *
816
1145
  * @returns {Float64Array}
817
1146
  */
818
- flatten() {
819
- const ret = wasm.matrix4_flatten(this.__wbg_ptr);
1147
+ outline_positions() {
1148
+ const ret = wasm.oganalytictessellation_outline_positions(this.__wbg_ptr);
820
1149
  var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
821
1150
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
822
1151
  return v1;
823
1152
  }
824
1153
  /**
825
- *
826
- * * Get the element at a specific index in the flattened matrix.
827
- *
828
- * @param {number} index
829
- * @returns {number | undefined}
830
- */
831
- get_element_at(index) {
832
- const ret = wasm.matrix4_get_element_at(this.__wbg_ptr, index);
833
- return ret[0] === 0 ? undefined : ret[1];
834
- }
835
- /**
836
- *
837
- * * Check if the matrix is a zero matrix.
838
- *
839
- * @returns {boolean}
1154
+ * @returns {Uint32Array}
840
1155
  */
841
- is_zero() {
842
- const ret = wasm.matrix4_is_zero(this.__wbg_ptr);
843
- return ret !== 0;
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;
844
1161
  }
845
1162
  /**
846
- *
847
- * * Check if the matrix is an identity matrix.
848
- *
849
- * @returns {boolean}
1163
+ * @returns {bigint}
850
1164
  */
851
- is_identity() {
852
- const ret = wasm.matrix4_is_identity(this.__wbg_ptr);
853
- return ret !== 0;
1165
+ revision() {
1166
+ const ret = wasm.oganalytictessellation_revision(this.__wbg_ptr);
1167
+ return BigInt.asUintN(64, ret);
854
1168
  }
855
1169
  /**
856
- *
857
- * * Create a Transpose of the matrix.
858
- * * Returns a new Matrix4 instance.
859
- *
860
- * @returns {Matrix4}
1170
+ * @returns {number}
861
1171
  */
862
- transpose() {
863
- const ret = wasm.matrix4_transpose(this.__wbg_ptr);
864
- return Matrix4.__wrap(ret);
1172
+ achieved_deflection() {
1173
+ const ret = wasm.oganalytictessellation_achieved_deflection(this.__wbg_ptr);
1174
+ return ret;
865
1175
  }
866
1176
  }
867
1177
 
@@ -1082,95 +1392,6 @@ export class OGArc {
1082
1392
  }
1083
1393
  }
1084
1394
 
1085
- const OGBooleanResultFinalization = (typeof FinalizationRegistry === 'undefined')
1086
- ? { register: () => {}, unregister: () => {} }
1087
- : new FinalizationRegistry(ptr => wasm.__wbg_ogbooleanresult_free(ptr >>> 0, 1));
1088
- /**
1089
- * Result payload returned across the wasm boundary.
1090
- */
1091
- export class OGBooleanResult {
1092
-
1093
- static __wrap(ptr) {
1094
- ptr = ptr >>> 0;
1095
- const obj = Object.create(OGBooleanResult.prototype);
1096
- obj.__wbg_ptr = ptr;
1097
- OGBooleanResultFinalization.register(obj, obj.__wbg_ptr, obj);
1098
- return obj;
1099
- }
1100
-
1101
- __destroy_into_raw() {
1102
- const ptr = this.__wbg_ptr;
1103
- this.__wbg_ptr = 0;
1104
- OGBooleanResultFinalization.unregister(this);
1105
- return ptr;
1106
- }
1107
-
1108
- free() {
1109
- const ptr = this.__destroy_into_raw();
1110
- wasm.__wbg_ogbooleanresult_free(ptr, 0);
1111
- }
1112
- /**
1113
- * @returns {string}
1114
- */
1115
- get brepSerialized() {
1116
- let deferred1_0;
1117
- let deferred1_1;
1118
- try {
1119
- const ret = wasm.ogbooleanresult_brepSerialized(this.__wbg_ptr);
1120
- deferred1_0 = ret[0];
1121
- deferred1_1 = ret[1];
1122
- return getStringFromWasm0(ret[0], ret[1]);
1123
- } finally {
1124
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1125
- }
1126
- }
1127
- /**
1128
- * @returns {string}
1129
- */
1130
- get geometrySerialized() {
1131
- let deferred1_0;
1132
- let deferred1_1;
1133
- try {
1134
- const ret = wasm.ogbooleanresult_geometrySerialized(this.__wbg_ptr);
1135
- deferred1_0 = ret[0];
1136
- deferred1_1 = ret[1];
1137
- return getStringFromWasm0(ret[0], ret[1]);
1138
- } finally {
1139
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1140
- }
1141
- }
1142
- /**
1143
- * @returns {string}
1144
- */
1145
- get outlineGeometrySerialized() {
1146
- let deferred1_0;
1147
- let deferred1_1;
1148
- try {
1149
- const ret = wasm.ogbooleanresult_outlineGeometrySerialized(this.__wbg_ptr);
1150
- deferred1_0 = ret[0];
1151
- deferred1_1 = ret[1];
1152
- return getStringFromWasm0(ret[0], ret[1]);
1153
- } finally {
1154
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1155
- }
1156
- }
1157
- /**
1158
- * @returns {string}
1159
- */
1160
- get reportJson() {
1161
- let deferred1_0;
1162
- let deferred1_1;
1163
- try {
1164
- const ret = wasm.ogbooleanresult_reportJson(this.__wbg_ptr);
1165
- deferred1_0 = ret[0];
1166
- deferred1_1 = ret[1];
1167
- return getStringFromWasm0(ret[0], ret[1]);
1168
- } finally {
1169
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1170
- }
1171
- }
1172
- }
1173
-
1174
1395
  const OGCuboidFinalization = (typeof FinalizationRegistry === 'undefined')
1175
1396
  ? { register: () => {}, unregister: () => {} }
1176
1397
  : new FinalizationRegistry(ptr => wasm.__wbg_ogcuboid_free(ptr >>> 0, 1));
@@ -5243,7 +5464,7 @@ export class OGSphere {
5243
5464
  * @returns {Vector3}
5244
5465
  */
5245
5466
  get_anchor() {
5246
- const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
5467
+ const ret = wasm.ogsphere_get_anchor(this.__wbg_ptr);
5247
5468
  return Vector3.__wrap(ret);
5248
5469
  }
5249
5470
  }
@@ -5636,7 +5857,7 @@ export class OGSweep {
5636
5857
  * @returns {Vector3}
5637
5858
  */
5638
5859
  get_anchor() {
5639
- const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
5860
+ const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
5640
5861
  return Vector3.__wrap(ret);
5641
5862
  }
5642
5863
  /**
@@ -5920,7 +6141,7 @@ export class OGWedge {
5920
6141
  * @returns {Vector3}
5921
6142
  */
5922
6143
  get_anchor() {
5923
- const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
6144
+ const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
5924
6145
  return Vector3.__wrap(ret);
5925
6146
  }
5926
6147
  }
@@ -6305,7 +6526,7 @@ export class WorkPlane {
6305
6526
  * @returns {Vector3}
6306
6527
  */
6307
6528
  get origin() {
6308
- const ret = wasm.workplane_origin(this.__wbg_ptr);
6529
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
6309
6530
  return Vector3.__wrap(ret);
6310
6531
  }
6311
6532
  /**
@@ -6362,13 +6583,6 @@ function __wbg_get_imports() {
6362
6583
  const ret = Vector3.__unwrap(arg0);
6363
6584
  return ret;
6364
6585
  };
6365
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
6366
- const ret = debugString(arg1);
6367
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
6368
- const len1 = WASM_VECTOR_LEN;
6369
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
6370
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
6371
- };
6372
6586
  imports.wbg.__wbindgen_init_externref_table = function() {
6373
6587
  const table = wasm.__wbindgen_export_2;
6374
6588
  const offset = table.grow(4);
@@ -6398,7 +6612,9 @@ function __wbg_finalize_init(instance, module) {
6398
6612
  wasm = instance.exports;
6399
6613
  __wbg_init.__wbindgen_wasm_module = module;
6400
6614
  cachedDataViewMemory0 = null;
6615
+ cachedFloat32ArrayMemory0 = null;
6401
6616
  cachedFloat64ArrayMemory0 = null;
6617
+ cachedUint32ArrayMemory0 = null;
6402
6618
  cachedUint8ArrayMemory0 = null;
6403
6619
 
6404
6620