@ifc-lite/wasm 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "2.1.0",
8
+ "version": "2.1.1",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -1,6 +1,40 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ export class ClashRunResult {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ readonly a: Uint32Array;
9
+ readonly b: Uint32Array;
10
+ readonly bounds: Float64Array;
11
+ readonly points: Float64Array;
12
+ readonly status: Uint8Array;
13
+ readonly distance: Float64Array;
14
+ }
15
+
16
+ export class ClashSession {
17
+ free(): void;
18
+ [Symbol.dispose](): void;
19
+ constructor();
20
+ /**
21
+ * Ingest N elements from flat arenas.
22
+ *
23
+ * - `positions`: concatenated per-element vertex coords (x,y,z,...)
24
+ * - `pos_ranges`: 2 per element = [float_offset, float_len]
25
+ * - `indices`: concatenated per-element LOCAL (0-based) triangle indices
26
+ * - `idx_ranges`: 2 per element = [idx_offset, idx_len]
27
+ * - `aabbs`: 6 per element = [minx,miny,minz,maxx,maxy,maxz]
28
+ */
29
+ ingest(positions: Float32Array, pos_ranges: Uint32Array, indices: Uint32Array, idx_ranges: Uint32Array, aabbs: Float32Array): void;
30
+ /**
31
+ * Run one rule. `group_a`/`group_b` are GLOBAL element indices; an empty
32
+ * `group_b` means a self-clash within `group_a`. `mode`: 0 = hard,
33
+ * 1 = clearance. Records carry GLOBAL element indices.
34
+ */
35
+ runRule(group_a: Uint32Array, group_b: Uint32Array, mode: number, tolerance: number, clearance: number, report_touch: boolean): ClashRunResult;
36
+ }
37
+
4
38
  export class IfcAPI {
5
39
  free(): void;
6
40
  [Symbol.dispose](): void;
@@ -553,6 +587,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
553
587
 
554
588
  export interface InitOutput {
555
589
  readonly memory: WebAssembly.Memory;
590
+ readonly __wbg_clashrunresult_free: (a: number, b: number) => void;
591
+ readonly __wbg_clashsession_free: (a: number, b: number) => void;
556
592
  readonly __wbg_ifcapi_free: (a: number, b: number) => void;
557
593
  readonly __wbg_meshcollection_free: (a: number, b: number) => void;
558
594
  readonly __wbg_meshdatajs_free: (a: number, b: number) => void;
@@ -563,6 +599,15 @@ export interface InitOutput {
563
599
  readonly __wbg_symbolicpolyline_free: (a: number, b: number) => void;
564
600
  readonly __wbg_symbolicrepresentationcollection_free: (a: number, b: number) => void;
565
601
  readonly __wbg_symbolictext_free: (a: number, b: number) => void;
602
+ readonly clashrunresult_a: (a: number, b: number) => void;
603
+ readonly clashrunresult_b: (a: number, b: number) => void;
604
+ readonly clashrunresult_bounds: (a: number, b: number) => void;
605
+ readonly clashrunresult_distance: (a: number, b: number) => void;
606
+ readonly clashrunresult_points: (a: number, b: number) => void;
607
+ readonly clashrunresult_status: (a: number, b: number) => void;
608
+ readonly clashsession_ingest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
609
+ readonly clashsession_new: () => number;
610
+ readonly clashsession_runRule: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
566
611
  readonly ifcapi_buildPrePassFast: (a: number, b: number, c: number) => number;
567
612
  readonly ifcapi_buildPrePassOnce: (a: number, b: number, c: number) => number;
568
613
  readonly ifcapi_buildPrePassStreaming: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -677,9 +722,9 @@ export interface InitOutput {
677
722
  readonly symbolictext_worldY: (a: number) => number;
678
723
  readonly symbolictext_x: (a: number) => number;
679
724
  readonly symbolictext_y: (a: number) => number;
680
- readonly __wasm_bindgen_func_elem_569: (a: number, b: number, c: number) => void;
681
- readonly __wasm_bindgen_func_elem_568: (a: number, b: number) => void;
682
- readonly __wasm_bindgen_func_elem_603: (a: number, b: number, c: number, d: number) => void;
725
+ readonly __wasm_bindgen_func_elem_593: (a: number, b: number, c: number) => void;
726
+ readonly __wasm_bindgen_func_elem_592: (a: number, b: number) => void;
727
+ readonly __wasm_bindgen_func_elem_627: (a: number, b: number, c: number, d: number) => void;
683
728
  readonly __wbindgen_export: (a: number) => void;
684
729
  readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
685
730
  readonly __wbindgen_export3: (a: number, b: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -40,6 +40,11 @@ function getArrayU32FromWasm0(ptr, len) {
40
40
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
41
41
  }
42
42
 
43
+ function getArrayU8FromWasm0(ptr, len) {
44
+ ptr = ptr >>> 0;
45
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
46
+ }
47
+
43
48
  let cachedDataViewMemory0 = null;
44
49
  function getDataViewMemory0() {
45
50
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -146,6 +151,13 @@ function passArray8ToWasm0(arg, malloc) {
146
151
  return ptr;
147
152
  }
148
153
 
154
+ function passArrayF32ToWasm0(arg, malloc) {
155
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
156
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
157
+ WASM_VECTOR_LEN = arg.length;
158
+ return ptr;
159
+ }
160
+
149
161
  function passStringToWasm0(arg, malloc, realloc) {
150
162
  if (realloc === undefined) {
151
163
  const buf = cachedTextEncoder.encode(arg);
@@ -220,14 +232,22 @@ if (!('encodeInto' in cachedTextEncoder)) {
220
232
 
221
233
  let WASM_VECTOR_LEN = 0;
222
234
 
223
- function __wasm_bindgen_func_elem_569(arg0, arg1, arg2) {
224
- wasm.__wasm_bindgen_func_elem_569(arg0, arg1, addHeapObject(arg2));
235
+ function __wasm_bindgen_func_elem_593(arg0, arg1, arg2) {
236
+ wasm.__wasm_bindgen_func_elem_593(arg0, arg1, addHeapObject(arg2));
225
237
  }
226
238
 
227
- function __wasm_bindgen_func_elem_603(arg0, arg1, arg2, arg3) {
228
- wasm.__wasm_bindgen_func_elem_603(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
239
+ function __wasm_bindgen_func_elem_627(arg0, arg1, arg2, arg3) {
240
+ wasm.__wasm_bindgen_func_elem_627(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
229
241
  }
230
242
 
243
+ const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
244
+ ? { register: () => {}, unregister: () => {} }
245
+ : new FinalizationRegistry(ptr => wasm.__wbg_clashrunresult_free(ptr >>> 0, 1));
246
+
247
+ const ClashSessionFinalization = (typeof FinalizationRegistry === 'undefined')
248
+ ? { register: () => {}, unregister: () => {} }
249
+ : new FinalizationRegistry(ptr => wasm.__wbg_clashsession_free(ptr >>> 0, 1));
250
+
231
251
  const IfcAPIFinalization = (typeof FinalizationRegistry === 'undefined')
232
252
  ? { register: () => {}, unregister: () => {} }
233
253
  : new FinalizationRegistry(ptr => wasm.__wbg_ifcapi_free(ptr >>> 0, 1));
@@ -268,6 +288,197 @@ const SymbolicTextFinalization = (typeof FinalizationRegistry === 'undefined')
268
288
  ? { register: () => {}, unregister: () => {} }
269
289
  : new FinalizationRegistry(ptr => wasm.__wbg_symbolictext_free(ptr >>> 0, 1));
270
290
 
291
+ /**
292
+ * Packed result of one rule run. Parallel arrays, one entry per clash record;
293
+ * `points` has 3 per record and `bounds` has 6 per record.
294
+ */
295
+ export class ClashRunResult {
296
+ static __wrap(ptr) {
297
+ ptr = ptr >>> 0;
298
+ const obj = Object.create(ClashRunResult.prototype);
299
+ obj.__wbg_ptr = ptr;
300
+ ClashRunResultFinalization.register(obj, obj.__wbg_ptr, obj);
301
+ return obj;
302
+ }
303
+ __destroy_into_raw() {
304
+ const ptr = this.__wbg_ptr;
305
+ this.__wbg_ptr = 0;
306
+ ClashRunResultFinalization.unregister(this);
307
+ return ptr;
308
+ }
309
+ free() {
310
+ const ptr = this.__destroy_into_raw();
311
+ wasm.__wbg_clashrunresult_free(ptr, 0);
312
+ }
313
+ /**
314
+ * @returns {Uint32Array}
315
+ */
316
+ get a() {
317
+ try {
318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
+ wasm.clashrunresult_a(retptr, this.__wbg_ptr);
320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
322
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
323
+ wasm.__wbindgen_export2(r0, r1 * 4, 4);
324
+ return v1;
325
+ } finally {
326
+ wasm.__wbindgen_add_to_stack_pointer(16);
327
+ }
328
+ }
329
+ /**
330
+ * @returns {Uint32Array}
331
+ */
332
+ get b() {
333
+ try {
334
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ wasm.clashrunresult_b(retptr, this.__wbg_ptr);
336
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
337
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
338
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
339
+ wasm.__wbindgen_export2(r0, r1 * 4, 4);
340
+ return v1;
341
+ } finally {
342
+ wasm.__wbindgen_add_to_stack_pointer(16);
343
+ }
344
+ }
345
+ /**
346
+ * @returns {Float64Array}
347
+ */
348
+ get bounds() {
349
+ try {
350
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
351
+ wasm.clashrunresult_bounds(retptr, this.__wbg_ptr);
352
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
353
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
354
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
355
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
356
+ return v1;
357
+ } finally {
358
+ wasm.__wbindgen_add_to_stack_pointer(16);
359
+ }
360
+ }
361
+ /**
362
+ * @returns {Float64Array}
363
+ */
364
+ get points() {
365
+ try {
366
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
367
+ wasm.clashrunresult_points(retptr, this.__wbg_ptr);
368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
371
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
372
+ return v1;
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ }
376
+ }
377
+ /**
378
+ * @returns {Uint8Array}
379
+ */
380
+ get status() {
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ wasm.clashrunresult_status(retptr, this.__wbg_ptr);
384
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
385
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
386
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
387
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
388
+ return v1;
389
+ } finally {
390
+ wasm.__wbindgen_add_to_stack_pointer(16);
391
+ }
392
+ }
393
+ /**
394
+ * @returns {Float64Array}
395
+ */
396
+ get distance() {
397
+ try {
398
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
399
+ wasm.clashrunresult_distance(retptr, this.__wbg_ptr);
400
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
401
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
402
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
403
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
404
+ return v1;
405
+ } finally {
406
+ wasm.__wbindgen_add_to_stack_pointer(16);
407
+ }
408
+ }
409
+ }
410
+ if (Symbol.dispose) ClashRunResult.prototype[Symbol.dispose] = ClashRunResult.prototype.free;
411
+
412
+ /**
413
+ * A clash session: ingest element geometry once, then run rules repeatedly.
414
+ */
415
+ export class ClashSession {
416
+ __destroy_into_raw() {
417
+ const ptr = this.__wbg_ptr;
418
+ this.__wbg_ptr = 0;
419
+ ClashSessionFinalization.unregister(this);
420
+ return ptr;
421
+ }
422
+ free() {
423
+ const ptr = this.__destroy_into_raw();
424
+ wasm.__wbg_clashsession_free(ptr, 0);
425
+ }
426
+ constructor() {
427
+ const ret = wasm.clashsession_new();
428
+ this.__wbg_ptr = ret >>> 0;
429
+ ClashSessionFinalization.register(this, this.__wbg_ptr, this);
430
+ return this;
431
+ }
432
+ /**
433
+ * Ingest N elements from flat arenas.
434
+ *
435
+ * - `positions`: concatenated per-element vertex coords (x,y,z,...)
436
+ * - `pos_ranges`: 2 per element = [float_offset, float_len]
437
+ * - `indices`: concatenated per-element LOCAL (0-based) triangle indices
438
+ * - `idx_ranges`: 2 per element = [idx_offset, idx_len]
439
+ * - `aabbs`: 6 per element = [minx,miny,minz,maxx,maxy,maxz]
440
+ * @param {Float32Array} positions
441
+ * @param {Uint32Array} pos_ranges
442
+ * @param {Uint32Array} indices
443
+ * @param {Uint32Array} idx_ranges
444
+ * @param {Float32Array} aabbs
445
+ */
446
+ ingest(positions, pos_ranges, indices, idx_ranges, aabbs) {
447
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_export3);
448
+ const len0 = WASM_VECTOR_LEN;
449
+ const ptr1 = passArray32ToWasm0(pos_ranges, wasm.__wbindgen_export3);
450
+ const len1 = WASM_VECTOR_LEN;
451
+ const ptr2 = passArray32ToWasm0(indices, wasm.__wbindgen_export3);
452
+ const len2 = WASM_VECTOR_LEN;
453
+ const ptr3 = passArray32ToWasm0(idx_ranges, wasm.__wbindgen_export3);
454
+ const len3 = WASM_VECTOR_LEN;
455
+ const ptr4 = passArrayF32ToWasm0(aabbs, wasm.__wbindgen_export3);
456
+ const len4 = WASM_VECTOR_LEN;
457
+ wasm.clashsession_ingest(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
458
+ }
459
+ /**
460
+ * Run one rule. `group_a`/`group_b` are GLOBAL element indices; an empty
461
+ * `group_b` means a self-clash within `group_a`. `mode`: 0 = hard,
462
+ * 1 = clearance. Records carry GLOBAL element indices.
463
+ * @param {Uint32Array} group_a
464
+ * @param {Uint32Array} group_b
465
+ * @param {number} mode
466
+ * @param {number} tolerance
467
+ * @param {number} clearance
468
+ * @param {boolean} report_touch
469
+ * @returns {ClashRunResult}
470
+ */
471
+ runRule(group_a, group_b, mode, tolerance, clearance, report_touch) {
472
+ const ptr0 = passArray32ToWasm0(group_a, wasm.__wbindgen_export3);
473
+ const len0 = WASM_VECTOR_LEN;
474
+ const ptr1 = passArray32ToWasm0(group_b, wasm.__wbindgen_export3);
475
+ const len1 = WASM_VECTOR_LEN;
476
+ const ret = wasm.clashsession_runRule(this.__wbg_ptr, ptr0, len0, ptr1, len1, mode, tolerance, clearance, report_touch);
477
+ return ClashRunResult.__wrap(ret);
478
+ }
479
+ }
480
+ if (Symbol.dispose) ClashSession.prototype[Symbol.dispose] = ClashSession.prototype.free;
481
+
271
482
  /**
272
483
  * Main IFC-Lite API
273
484
  */
@@ -1950,7 +2161,7 @@ function __wbg_get_imports() {
1950
2161
  const a = state0.a;
1951
2162
  state0.a = 0;
1952
2163
  try {
1953
- return __wasm_bindgen_func_elem_603(a, state0.b, arg0, arg1);
2164
+ return __wasm_bindgen_func_elem_627(a, state0.b, arg0, arg1);
1954
2165
  } finally {
1955
2166
  state0.a = a;
1956
2167
  }
@@ -2062,7 +2273,7 @@ function __wbg_get_imports() {
2062
2273
  };
2063
2274
  imports.wbg.__wbindgen_cast_e7ad0d7b317830d5 = function(arg0, arg1) {
2064
2275
  // Cast intrinsic for `Closure(Closure { dtor_idx: 56, function: Function { arguments: [Externref], shim_idx: 57, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2065
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_568, __wasm_bindgen_func_elem_569);
2276
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_592, __wasm_bindgen_func_elem_593);
2066
2277
  return addHeapObject(ret);
2067
2278
  };
2068
2279
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
Binary file