opengeometry 2.0.10 → 2.0.11

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.
@@ -168,17 +168,42 @@ function getStringFromWasm0(ptr, len) {
168
168
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
169
169
  }
170
170
 
171
- function _assertClass(instance, klass) {
172
- if (!(instance instanceof klass)) {
173
- throw new Error(`expected instance of ${klass.name}`);
174
- }
175
- }
176
-
177
171
  function takeFromExternrefTable0(idx) {
178
172
  const value = wasm.__wbindgen_export_2.get(idx);
179
173
  wasm.__externref_table_dealloc(idx);
180
174
  return value;
181
175
  }
176
+ /**
177
+ * @param {string} local_brep_serialized
178
+ * @param {number} height
179
+ * @returns {string}
180
+ */
181
+ export function extrudeBrepFace(local_brep_serialized, height) {
182
+ let deferred3_0;
183
+ let deferred3_1;
184
+ try {
185
+ const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
186
+ const len0 = WASM_VECTOR_LEN;
187
+ const ret = wasm.extrudeBrepFace(ptr0, len0, height);
188
+ var ptr2 = ret[0];
189
+ var len2 = ret[1];
190
+ if (ret[3]) {
191
+ ptr2 = 0; len2 = 0;
192
+ throw takeFromExternrefTable0(ret[2]);
193
+ }
194
+ deferred3_0 = ptr2;
195
+ deferred3_1 = len2;
196
+ return getStringFromWasm0(ptr2, len2);
197
+ } finally {
198
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
199
+ }
200
+ }
201
+
202
+ function _assertClass(instance, klass) {
203
+ if (!(instance instanceof klass)) {
204
+ throw new Error(`expected instance of ${klass.name}`);
205
+ }
206
+ }
182
207
 
183
208
  let cachedFloat64ArrayMemory0 = null;
184
209
 
@@ -204,9 +229,65 @@ function passArrayJsValueToWasm0(array, malloc) {
204
229
  return ptr;
205
230
  }
206
231
 
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)));
238
+ }
239
+ wasm.__externref_drop_slice(ptr, len);
240
+ return result;
241
+ }
242
+
207
243
  function isLikeNone(x) {
208
244
  return x === undefined || x === null;
209
245
  }
246
+
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;
251
+ return ptr;
252
+ }
253
+ /**
254
+ * Wasm entry point: offset a centreline by `width` into stroked regions via the
255
+ * deterministic analytic offset. `centreline_flat` is `[x0,y0,z0, …]`. Returns
256
+ * CW-outer / CCW-hole regions, canonicalised; empty (does NOT throw) when degenerate.
257
+ * @param {Float64Array} centreline_flat
258
+ * @param {number} width
259
+ * @param {boolean} closed
260
+ * @param {number} miter_limit
261
+ * @returns {OGOffsetRegionsResult}
262
+ */
263
+ export function offsetPolylineRegions(centreline_flat, width, closed, miter_limit) {
264
+ const ptr0 = passArrayF64ToWasm0(centreline_flat, wasm.__wbindgen_malloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.offsetPolylineRegions(ptr0, len0, width, closed, miter_limit);
267
+ if (ret[2]) {
268
+ throw takeFromExternrefTable0(ret[1]);
269
+ }
270
+ return OGOffsetRegionsResult.__wrap(ret[0]);
271
+ }
272
+
273
+ /**
274
+ * Wasm entry point: merge a GROUP of separate polylines (a crossing T / X / L
275
+ * overlap) into one clean stroked region by nonzero-winding union of their mitered
276
+ * bands. `polylines_json` is `[{centreline:[x,y,z,…], width, closed}, …]`. Returns
277
+ * CW-outer / CCW-hole regions (one or more); empty when nothing is buildable.
278
+ * @param {string} polylines_json
279
+ * @returns {OGOffsetRegionsResult}
280
+ */
281
+ export function offsetPolylineGroupRegions(polylines_json) {
282
+ const ptr0 = passStringToWasm0(polylines_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ const ret = wasm.offsetPolylineGroupRegions(ptr0, len0);
285
+ if (ret[2]) {
286
+ throw takeFromExternrefTable0(ret[1]);
287
+ }
288
+ return OGOffsetRegionsResult.__wrap(ret[0]);
289
+ }
290
+
210
291
  /**
211
292
  * Wasm entry point for union.
212
293
  * @param {string} lhs_brep_serialized
@@ -292,40 +373,22 @@ export function booleanSubtractionMany(lhs_brep_serialized, cutters_brep_seriali
292
373
  }
293
374
 
294
375
  /**
295
- * @param {string} local_brep_serialized
296
- * @param {number} height
297
- * @returns {string}
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}
298
381
  */
299
- export function extrudeBrepFace(local_brep_serialized, height) {
300
- let deferred3_0;
301
- let deferred3_1;
302
- try {
303
- const ptr0 = passStringToWasm0(local_brep_serialized, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
- const len0 = WASM_VECTOR_LEN;
305
- const ret = wasm.extrudeBrepFace(ptr0, len0, height);
306
- var ptr2 = ret[0];
307
- var len2 = ret[1];
308
- if (ret[3]) {
309
- ptr2 = 0; len2 = 0;
310
- throw takeFromExternrefTable0(ret[2]);
311
- }
312
- deferred3_0 = ptr2;
313
- deferred3_1 = len2;
314
- return getStringFromWasm0(ptr2, len2);
315
- } finally {
316
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
317
- }
318
- }
319
-
320
- function getArrayJsValueFromWasm0(ptr, len) {
321
- ptr = ptr >>> 0;
322
- const mem = getDataViewMemory0();
323
- const result = [];
324
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
325
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
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]);
326
390
  }
327
- wasm.__externref_drop_slice(ptr, len);
328
- return result;
391
+ return OGBooleanResult.__wrap(ret[0]);
329
392
  }
330
393
 
331
394
  const Matrix3Finalization = (typeof FinalizationRegistry === 'undefined')
@@ -2801,7 +2864,7 @@ export class OGLine {
2801
2864
  * @returns {Vector3}
2802
2865
  */
2803
2866
  get_anchor() {
2804
- const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
2867
+ const ret = wasm.ogline_get_anchor(this.__wbg_ptr);
2805
2868
  return Vector3.__wrap(ret);
2806
2869
  }
2807
2870
  /**
@@ -2856,6 +2919,53 @@ export class OGLine {
2856
2919
  }
2857
2920
  }
2858
2921
 
2922
+ const OGOffsetRegionsResultFinalization = (typeof FinalizationRegistry === 'undefined')
2923
+ ? { register: () => {}, unregister: () => {} }
2924
+ : new FinalizationRegistry(ptr => wasm.__wbg_ogoffsetregionsresult_free(ptr >>> 0, 1));
2925
+ /**
2926
+ * Result payload for a polyline offset: a list of regions (each an outer ring +
2927
+ * inner-void holes). Normally one region; a self-crossing closed centreline (e.g.
2928
+ * a figure-8) yields one per simple sub-loop. The deterministic analytic offset —
2929
+ * no extrude/solid. Used to build the plan polygons + extruded base solids in JS.
2930
+ */
2931
+ export class OGOffsetRegionsResult {
2932
+
2933
+ static __wrap(ptr) {
2934
+ ptr = ptr >>> 0;
2935
+ const obj = Object.create(OGOffsetRegionsResult.prototype);
2936
+ obj.__wbg_ptr = ptr;
2937
+ OGOffsetRegionsResultFinalization.register(obj, obj.__wbg_ptr, obj);
2938
+ return obj;
2939
+ }
2940
+
2941
+ __destroy_into_raw() {
2942
+ const ptr = this.__wbg_ptr;
2943
+ this.__wbg_ptr = 0;
2944
+ OGOffsetRegionsResultFinalization.unregister(this);
2945
+ return ptr;
2946
+ }
2947
+
2948
+ free() {
2949
+ const ptr = this.__destroy_into_raw();
2950
+ wasm.__wbg_ogoffsetregionsresult_free(ptr, 0);
2951
+ }
2952
+ /**
2953
+ * @returns {string}
2954
+ */
2955
+ get regionsSerialized() {
2956
+ let deferred1_0;
2957
+ let deferred1_1;
2958
+ try {
2959
+ const ret = wasm.ogoffsetregionsresult_regionsSerialized(this.__wbg_ptr);
2960
+ deferred1_0 = ret[0];
2961
+ deferred1_1 = ret[1];
2962
+ return getStringFromWasm0(ret[0], ret[1]);
2963
+ } finally {
2964
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2965
+ }
2966
+ }
2967
+ }
2968
+
2859
2969
  const OGPolygonFinalization = (typeof FinalizationRegistry === 'undefined')
2860
2970
  ? { register: () => {}, unregister: () => {} }
2861
2971
  : new FinalizationRegistry(ptr => wasm.__wbg_ogpolygon_free(ptr >>> 0, 1));
@@ -3434,7 +3544,7 @@ export class OGPolyline {
3434
3544
  * @returns {Vector3}
3435
3545
  */
3436
3546
  get_anchor() {
3437
- const ret = wasm.ogcurve_get_anchor(this.__wbg_ptr);
3547
+ const ret = wasm.ogpolyline_get_anchor(this.__wbg_ptr);
3438
3548
  return Vector3.__wrap(ret);
3439
3549
  }
3440
3550
  /**
@@ -5440,7 +5550,7 @@ export class OGWedge {
5440
5550
  * @returns {Vector3}
5441
5551
  */
5442
5552
  get_anchor() {
5443
- const ret = wasm.ogwedge_get_anchor(this.__wbg_ptr);
5553
+ const ret = wasm.ogarc_get_anchor(this.__wbg_ptr);
5444
5554
  return Vector3.__wrap(ret);
5445
5555
  }
5446
5556
  }