opengeometry 2.0.14 → 2.0.15

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.
@@ -94,36 +94,17 @@ function passStringToWasm0(arg, malloc, realloc) {
94
94
  return ptr;
95
95
  }
96
96
 
97
+ function _assertClass(instance, klass) {
98
+ if (!(instance instanceof klass)) {
99
+ throw new Error(`expected instance of ${klass.name}`);
100
+ }
101
+ }
102
+
97
103
  function takeFromExternrefTable0(idx) {
98
104
  const value = wasm.__wbindgen_export_2.get(idx);
99
105
  wasm.__externref_table_dealloc(idx);
100
106
  return value;
101
107
  }
102
- /**
103
- * @param {string} local_brep_serialized
104
- * @param {number} height
105
- * @returns {string}
106
- */
107
- export function extrudeBrepFace(local_brep_serialized, height) {
108
- let deferred3_0;
109
- let deferred3_1;
110
- try {
111
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
112
- const len0 = WASM_VECTOR_LEN;
113
- const ret = wasm.extrudeBrepFace(ptr0, len0, height);
114
- var ptr2 = ret[0];
115
- var len2 = ret[1];
116
- if (ret[3]) {
117
- ptr2 = 0; len2 = 0;
118
- throw takeFromExternrefTable0(ret[2]);
119
- }
120
- deferred3_0 = ptr2;
121
- deferred3_1 = len2;
122
- return getStringFromWasm0(ptr2, len2);
123
- } finally {
124
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
125
- }
126
- }
127
108
 
128
109
  let cachedFloat64ArrayMemory0 = null;
129
110
 
@@ -134,35 +115,73 @@ function getFloat64ArrayMemory0() {
134
115
  return cachedFloat64ArrayMemory0;
135
116
  }
136
117
 
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;
118
+ function getArrayF64FromWasm0(ptr, len) {
119
+ ptr = ptr >>> 0;
120
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
121
+ }
122
+
123
+ let cachedDataViewMemory0 = null;
124
+
125
+ function getDataViewMemory0() {
126
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
127
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
128
+ }
129
+ return cachedDataViewMemory0;
130
+ }
131
+
132
+ function passArrayJsValueToWasm0(array, malloc) {
133
+ const ptr = malloc(array.length * 4, 4) >>> 0;
134
+ for (let i = 0; i < array.length; i++) {
135
+ const add = addToExternrefTable0(array[i]);
136
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
137
+ }
138
+ WASM_VECTOR_LEN = array.length;
141
139
  return ptr;
142
140
  }
141
+
142
+ function isLikeNone(x) {
143
+ return x === undefined || x === null;
144
+ }
143
145
  /**
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
146
+ * @param {string} a_json
147
+ * @param {string} b_json
148
+ * @param {string} operation
149
+ * @returns {OGOffsetRegionsResult}
150
+ */
151
+ export function booleanRegions2D(a_json, b_json, operation) {
152
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
153
+ const len0 = WASM_VECTOR_LEN;
154
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155
+ const len1 = WASM_VECTOR_LEN;
156
+ const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
157
+ const len2 = WASM_VECTOR_LEN;
158
+ const ret = wasm.booleanRegions2D(ptr0, len0, ptr1, len1, ptr2, len2);
159
+ if (ret[2]) {
160
+ throw takeFromExternrefTable0(ret[1]);
161
+ }
162
+ return OGOffsetRegionsResult.__wrap(ret[0]);
163
+ }
164
+
165
+ /**
166
+ * Exact line/arc region Boolean. The JSON rings contain analytic edges rather
167
+ * than vertices, and the result keeps arcs as arcs. As with booleanRegions2D,
168
+ * outer rings are CW in XZ and holes are CCW.
169
+ * @param {string} a_json
170
+ * @param {string} b_json
171
+ * @param {string} operation
153
172
  * @returns {string}
154
173
  */
155
- export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
174
+ export function booleanCurvedRegions2D(a_json, b_json, operation) {
156
175
  let deferred5_0;
157
176
  let deferred5_1;
158
177
  try {
159
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
178
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
179
  const len0 = WASM_VECTOR_LEN;
161
- const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
180
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
162
181
  const len1 = WASM_VECTOR_LEN;
163
- const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
182
+ const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
164
183
  const len2 = WASM_VECTOR_LEN;
165
- const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
184
+ const ret = wasm.booleanCurvedRegions2D(ptr0, len0, ptr1, len1, ptr2, len2);
166
185
  var ptr4 = ret[0];
167
186
  var len4 = ret[1];
168
187
  if (ret[3]) {
@@ -177,64 +196,10 @@ export function extrudeBrepFaceDirectional(local_brep_serialized, direction, ext
177
196
  }
178
197
  }
179
198
 
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);
204
- }
205
- }
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;
199
+ function passArrayF64ToWasm0(arg, malloc) {
200
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
201
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
202
+ WASM_VECTOR_LEN = arg.length;
238
203
  return ptr;
239
204
  }
240
205
  /**
@@ -261,7 +226,7 @@ export function offsetPolylineRegions(centreline_flat, width, closed, miter_limi
261
226
  * Wasm entry point: merge a GROUP of separate polylines (a crossing T / X / L
262
227
  * overlap) into one clean stroked region by nonzero-winding union of their mitered
263
228
  * bands. `polylines_json` is `[{centreline:[x,y,z,…], width, closed}, …]`. Returns
264
- * CW-outer / CCW-hole regions (one or more); empty when nothing is buildable.
229
+ * CW-outer / CCW-hole regions (one or more); empty when no region remains.
265
230
  * @param {string} polylines_json
266
231
  * @returns {OGOffsetRegionsResult}
267
232
  */
@@ -308,16 +273,17 @@ export function offsetRingVariable(ring_flat, distances, holes_json) {
308
273
  }
309
274
 
310
275
  /**
311
- * @param {string} serialized
276
+ * @param {string} local_brep_serialized
277
+ * @param {number} height
312
278
  * @returns {string}
313
279
  */
314
- export function validateAnalyticBrep(serialized) {
280
+ export function extrudeBrepFace(local_brep_serialized, height) {
315
281
  let deferred3_0;
316
282
  let deferred3_1;
317
283
  try {
318
- const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
319
285
  const len0 = WASM_VECTOR_LEN;
320
- const ret = wasm.validateAnalyticBrep(ptr0, len0);
286
+ const ret = wasm.extrudeBrepFace(ptr0, len0, height);
321
287
  var ptr2 = ret[0];
322
288
  var len2 = ret[1];
323
289
  if (ret[3]) {
@@ -333,49 +299,67 @@ export function validateAnalyticBrep(serialized) {
333
299
  }
334
300
 
335
301
  /**
336
- * @param {string} serialized
337
- * @param {number} deflection
338
- * @param {string | null} [options_json]
339
- * @returns {OGAnalyticTessellation}
302
+ * Wasm entry point for general extrude. `direction` is `[x,y,z]`; `extent_kind`
303
+ * is `"one_sided" | "symmetric" | "two_sided"`; `d_plus`/`d_minus` are the
304
+ * extent distances (`d_minus` ignored unless two-sided, `d_plus` is the
305
+ * distance for one-sided/symmetric).
306
+ * @param {string} local_brep_serialized
307
+ * @param {Float64Array} direction
308
+ * @param {string} extent_kind
309
+ * @param {number} d_plus
310
+ * @param {number} d_minus
311
+ * @returns {string}
340
312
  */
341
- export function tessellate_brep(serialized, deflection, options_json) {
342
- const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
- const len0 = WASM_VECTOR_LEN;
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);
347
- if (ret[2]) {
348
- throw takeFromExternrefTable0(ret[1]);
349
- }
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);
313
+ export function extrudeBrepFaceDirectional(local_brep_serialized, direction, extent_kind, d_plus, d_minus) {
314
+ let deferred5_0;
315
+ let deferred5_1;
316
+ try {
317
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
318
+ const len0 = WASM_VECTOR_LEN;
319
+ const ptr1 = passArrayF64ToWasm0(direction, wasm.__wbindgen_malloc);
320
+ const len1 = WASM_VECTOR_LEN;
321
+ const ptr2 = passStringToWasm0(extent_kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
+ const len2 = WASM_VECTOR_LEN;
323
+ const ret = wasm.extrudeBrepFaceDirectional(ptr0, len0, ptr1, len1, ptr2, len2, d_plus, d_minus);
324
+ var ptr4 = ret[0];
325
+ var len4 = ret[1];
326
+ if (ret[3]) {
327
+ ptr4 = 0; len4 = 0;
328
+ throw takeFromExternrefTable0(ret[2]);
329
+ }
330
+ deferred5_0 = ptr4;
331
+ deferred5_1 = len4;
332
+ return getStringFromWasm0(ptr4, len4);
333
+ } finally {
334
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
358
335
  }
359
- return cachedFloat32ArrayMemory0;
360
336
  }
361
337
 
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);
338
+ /**
339
+ * Wasm entry point: analyze a flat `[x0,y0,z0,…]` loop, returning the report as
340
+ * JSON (the corrected points are not returned here; use the kernel API).
341
+ * @param {Float64Array} flat_points
342
+ * @returns {string}
343
+ */
344
+ export function analyzeProfile(flat_points) {
345
+ let deferred3_0;
346
+ let deferred3_1;
347
+ try {
348
+ const ptr0 = passArrayF64ToWasm0(flat_points, wasm.__wbindgen_malloc);
349
+ const len0 = WASM_VECTOR_LEN;
350
+ const ret = wasm.analyzeProfile(ptr0, len0);
351
+ var ptr2 = ret[0];
352
+ var len2 = ret[1];
353
+ if (ret[3]) {
354
+ ptr2 = 0; len2 = 0;
355
+ throw takeFromExternrefTable0(ret[2]);
356
+ }
357
+ deferred3_0 = ptr2;
358
+ deferred3_1 = len2;
359
+ return getStringFromWasm0(ptr2, len2);
360
+ } finally {
361
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
372
362
  }
373
- return cachedUint32ArrayMemory0;
374
- }
375
-
376
- function getArrayU32FromWasm0(ptr, len) {
377
- ptr = ptr >>> 0;
378
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
379
363
  }
380
364
 
381
365
  function getArrayJsValueFromWasm0(ptr, len) {
@@ -443,6 +427,77 @@ export function healBrep(brep_json, tolerance) {
443
427
  }
444
428
  }
445
429
 
430
+ /**
431
+ * @param {string} serialized
432
+ * @returns {string}
433
+ */
434
+ export function validateAnalyticBrep(serialized) {
435
+ let deferred3_0;
436
+ let deferred3_1;
437
+ try {
438
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
439
+ const len0 = WASM_VECTOR_LEN;
440
+ const ret = wasm.validateAnalyticBrep(ptr0, len0);
441
+ var ptr2 = ret[0];
442
+ var len2 = ret[1];
443
+ if (ret[3]) {
444
+ ptr2 = 0; len2 = 0;
445
+ throw takeFromExternrefTable0(ret[2]);
446
+ }
447
+ deferred3_0 = ptr2;
448
+ deferred3_1 = len2;
449
+ return getStringFromWasm0(ptr2, len2);
450
+ } finally {
451
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
452
+ }
453
+ }
454
+
455
+ /**
456
+ * @param {string} serialized
457
+ * @param {number} deflection
458
+ * @param {string | null} [options_json]
459
+ * @returns {OGAnalyticTessellation}
460
+ */
461
+ export function tessellate_brep(serialized, deflection, options_json) {
462
+ const ptr0 = passStringToWasm0(serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
+ const len0 = WASM_VECTOR_LEN;
464
+ var ptr1 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ var len1 = WASM_VECTOR_LEN;
466
+ const ret = wasm.tessellate_brep(ptr0, len0, deflection, ptr1, len1);
467
+ if (ret[2]) {
468
+ throw takeFromExternrefTable0(ret[1]);
469
+ }
470
+ return OGAnalyticTessellation.__wrap(ret[0]);
471
+ }
472
+
473
+ let cachedFloat32ArrayMemory0 = null;
474
+
475
+ function getFloat32ArrayMemory0() {
476
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
477
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
478
+ }
479
+ return cachedFloat32ArrayMemory0;
480
+ }
481
+
482
+ function getArrayF32FromWasm0(ptr, len) {
483
+ ptr = ptr >>> 0;
484
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
485
+ }
486
+
487
+ let cachedUint32ArrayMemory0 = null;
488
+
489
+ function getUint32ArrayMemory0() {
490
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
491
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
492
+ }
493
+ return cachedUint32ArrayMemory0;
494
+ }
495
+
496
+ function getArrayU32FromWasm0(ptr, len) {
497
+ ptr = ptr >>> 0;
498
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
499
+ }
500
+
446
501
  const Matrix3Finalization = (typeof FinalizationRegistry === 'undefined')
447
502
  ? { register: () => {}, unregister: () => {} }
448
503
  : new FinalizationRegistry(ptr => wasm.__wbg_matrix3_free(ptr >>> 0, 1));
@@ -983,6 +1038,22 @@ export class OGAnalyticBrep {
983
1038
  }
984
1039
  return OGAnalyticBrep.__wrap(ret[0]);
985
1040
  }
1041
+ /**
1042
+ * @param {string} cutters_json
1043
+ * @param {string} id
1044
+ * @returns {OGAnalyticBrep}
1045
+ */
1046
+ subtract_planar_cutters(cutters_json, id) {
1047
+ const ptr0 = passStringToWasm0(cutters_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1048
+ const len0 = WASM_VECTOR_LEN;
1049
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1050
+ const len1 = WASM_VECTOR_LEN;
1051
+ const ret = wasm.oganalyticbrep_subtract_planar_cutters(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1052
+ if (ret[2]) {
1053
+ throw takeFromExternrefTable0(ret[1]);
1054
+ }
1055
+ return OGAnalyticBrep.__wrap(ret[0]);
1056
+ }
986
1057
  /**
987
1058
  * @param {number} thickness
988
1059
  * @param {string} id
@@ -5464,7 +5535,7 @@ export class OGSphere {
5464
5535
  * @returns {Vector3}
5465
5536
  */
5466
5537
  get_anchor() {
5467
- const ret = wasm.ogsphere_get_anchor(this.__wbg_ptr);
5538
+ const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
5468
5539
  return Vector3.__wrap(ret);
5469
5540
  }
5470
5541
  }
@@ -5857,7 +5928,7 @@ export class OGSweep {
5857
5928
  * @returns {Vector3}
5858
5929
  */
5859
5930
  get_anchor() {
5860
- const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
5931
+ const ret = wasm.ogsweep_get_anchor(this.__wbg_ptr);
5861
5932
  return Vector3.__wrap(ret);
5862
5933
  }
5863
5934
  /**
@@ -6141,7 +6212,7 @@ export class OGWedge {
6141
6212
  * @returns {Vector3}
6142
6213
  */
6143
6214
  get_anchor() {
6144
- const ret = wasm.ogellipticalarc_get_anchor(this.__wbg_ptr);
6215
+ const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
6145
6216
  return Vector3.__wrap(ret);
6146
6217
  }
6147
6218
  }
@@ -6526,7 +6597,7 @@ export class WorkPlane {
6526
6597
  * @returns {Vector3}
6527
6598
  */
6528
6599
  get origin() {
6529
- const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
6600
+ const ret = wasm.workplane_origin(this.__wbg_ptr);
6530
6601
  return Vector3.__wrap(ret);
6531
6602
  }
6532
6603
  /**