@ifc-lite/wasm 1.15.0 → 1.16.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": "1.15.0",
8
+ "version": "1.16.1",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -434,6 +434,29 @@ export class IfcAPI {
434
434
  * ```
435
435
  */
436
436
  parseZeroCopy(content: string): ZeroCopyMesh;
437
+ /**
438
+ * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
439
+ * representations.
440
+ *
441
+ * Returns a [`ProfileCollection`] whose entries each carry:
442
+ * - A 2D polygon (outer + holes) in local profile space (metres)
443
+ * - A 4 × 4 column-major transform in WebGL Y-up world space
444
+ * - Extrusion direction (world space) and depth (metres)
445
+ *
446
+ * Use [`ProfileProjector`] (TypeScript) to convert these into `DrawingLine[]`
447
+ * for clean projection without tessellation artifacts.
448
+ *
449
+ * ```javascript
450
+ * const api = new IfcAPI();
451
+ * const profiles = api.extractProfiles(ifcContent, 0);
452
+ * console.log('Profiles:', profiles.length);
453
+ * for (let i = 0; i < profiles.length; i++) {
454
+ * const p = profiles.get(i);
455
+ * console.log(p.ifcType, 'depth:', p.extrusionDepth);
456
+ * }
457
+ * ```
458
+ */
459
+ extractProfiles(content: string, model_index: number): ProfileCollection;
437
460
  /**
438
461
  * Debug: Test processing entity #953 (FacetedBrep wall)
439
462
  */
@@ -692,6 +715,63 @@ export class MeshDataJs {
692
715
  readonly positions: Float32Array;
693
716
  }
694
717
 
718
+ export class ProfileCollection {
719
+ private constructor();
720
+ free(): void;
721
+ [Symbol.dispose](): void;
722
+ /**
723
+ * Get profile at `index`. Returns `undefined` for out-of-bounds index.
724
+ */
725
+ get(index: number): ProfileEntryJs | undefined;
726
+ /**
727
+ * Number of profiles.
728
+ */
729
+ readonly length: number;
730
+ }
731
+
732
+ export class ProfileEntryJs {
733
+ private constructor();
734
+ free(): void;
735
+ [Symbol.dispose](): void;
736
+ /**
737
+ * Express ID of the building element.
738
+ */
739
+ readonly expressId: number;
740
+ /**
741
+ * Number of points per hole.
742
+ */
743
+ readonly holeCounts: Uint32Array;
744
+ /**
745
+ * All hole points concatenated: `[x0, y0, x1, y1, …]` (metres).
746
+ */
747
+ readonly holePoints: Float32Array;
748
+ /**
749
+ * Model index for multi-model federation.
750
+ */
751
+ readonly modelIndex: number;
752
+ /**
753
+ * Outer boundary: flat `[x0, y0, x1, y1, …]` in local profile space (metres).
754
+ */
755
+ readonly outerPoints: Float32Array;
756
+ /**
757
+ * Extrusion direction `[dx, dy, dz]` in WebGL Y-up world space (unit vector).
758
+ */
759
+ readonly extrusionDir: Float32Array;
760
+ /**
761
+ * Extrusion depth (metres).
762
+ */
763
+ readonly extrusionDepth: number;
764
+ /**
765
+ * IFC type name (e.g., `"IfcWall"`).
766
+ */
767
+ readonly ifcType: string;
768
+ /**
769
+ * 4 × 4 column-major transform in WebGL Y-up world space.
770
+ * `M * [x, y, 0, 1]ᵀ` gives the world position.
771
+ */
772
+ readonly transform: Float32Array;
773
+ }
774
+
695
775
  export class RtcOffsetJs {
696
776
  private constructor();
697
777
  free(): void;
@@ -904,6 +984,8 @@ export interface InitOutput {
904
984
  readonly __wbg_meshcollection_free: (a: number, b: number) => void;
905
985
  readonly __wbg_meshcollectionwithrtc_free: (a: number, b: number) => void;
906
986
  readonly __wbg_meshdatajs_free: (a: number, b: number) => void;
987
+ readonly __wbg_profilecollection_free: (a: number, b: number) => void;
988
+ readonly __wbg_profileentryjs_free: (a: number, b: number) => void;
907
989
  readonly __wbg_rtcoffsetjs_free: (a: number, b: number) => void;
908
990
  readonly __wbg_set_georeferencejs_eastings: (a: number, b: number) => void;
909
991
  readonly __wbg_set_georeferencejs_northings: (a: number, b: number) => void;
@@ -967,6 +1049,7 @@ export interface InitOutput {
967
1049
  readonly ifcapi_buildPrePassOnce: (a: number, b: number, c: number) => number;
968
1050
  readonly ifcapi_debugProcessEntity953: (a: number, b: number, c: number, d: number) => void;
969
1051
  readonly ifcapi_debugProcessFirstWall: (a: number, b: number, c: number, d: number) => void;
1052
+ readonly ifcapi_extractProfiles: (a: number, b: number, c: number, d: number) => number;
970
1053
  readonly ifcapi_getGeoReference: (a: number, b: number, c: number) => number;
971
1054
  readonly ifcapi_getMemory: (a: number) => number;
972
1055
  readonly ifcapi_is_ready: (a: number) => number;
@@ -1019,6 +1102,16 @@ export interface InitOutput {
1019
1102
  readonly meshdatajs_positions: (a: number) => number;
1020
1103
  readonly meshdatajs_triangleCount: (a: number) => number;
1021
1104
  readonly meshdatajs_vertexCount: (a: number) => number;
1105
+ readonly profilecollection_get: (a: number, b: number) => number;
1106
+ readonly profilecollection_length: (a: number) => number;
1107
+ readonly profileentryjs_extrusionDepth: (a: number) => number;
1108
+ readonly profileentryjs_extrusionDir: (a: number) => number;
1109
+ readonly profileentryjs_holeCounts: (a: number) => number;
1110
+ readonly profileentryjs_holePoints: (a: number) => number;
1111
+ readonly profileentryjs_ifcType: (a: number, b: number) => void;
1112
+ readonly profileentryjs_modelIndex: (a: number) => number;
1113
+ readonly profileentryjs_outerPoints: (a: number) => number;
1114
+ readonly profileentryjs_transform: (a: number) => number;
1022
1115
  readonly rtcoffsetjs_isSignificant: (a: number) => number;
1023
1116
  readonly rtcoffsetjs_toWorld: (a: number, b: number, c: number, d: number, e: number) => void;
1024
1117
  readonly symboliccircle_centerX: (a: number) => number;
@@ -1081,11 +1174,12 @@ export interface InitOutput {
1081
1174
  readonly gpuinstancedgeometryref_geometryId: (a: number) => bigint;
1082
1175
  readonly instancedgeometry_geometryId: (a: number) => bigint;
1083
1176
  readonly meshcollection_rtcOffsetX: (a: number) => number;
1177
+ readonly profileentryjs_expressId: (a: number) => number;
1084
1178
  readonly symboliccircle_expressId: (a: number) => number;
1085
1179
  readonly __wbg_gpuinstancedgeometryref_free: (a: number, b: number) => void;
1086
- readonly __wasm_bindgen_func_elem_1092: (a: number, b: number, c: number) => void;
1087
- readonly __wasm_bindgen_func_elem_1091: (a: number, b: number) => void;
1088
- readonly __wasm_bindgen_func_elem_1132: (a: number, b: number, c: number, d: number) => void;
1180
+ readonly __wasm_bindgen_func_elem_1131: (a: number, b: number, c: number) => void;
1181
+ readonly __wasm_bindgen_func_elem_1130: (a: number, b: number) => void;
1182
+ readonly __wasm_bindgen_func_elem_1173: (a: number, b: number, c: number, d: number) => void;
1089
1183
  readonly __wbindgen_export: (a: number) => void;
1090
1184
  readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
1091
1185
  readonly __wbindgen_export3: (a: number, b: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -212,12 +212,12 @@ if (!('encodeInto' in cachedTextEncoder)) {
212
212
 
213
213
  let WASM_VECTOR_LEN = 0;
214
214
 
215
- function __wasm_bindgen_func_elem_1092(arg0, arg1, arg2) {
216
- wasm.__wasm_bindgen_func_elem_1092(arg0, arg1, addHeapObject(arg2));
215
+ function __wasm_bindgen_func_elem_1131(arg0, arg1, arg2) {
216
+ wasm.__wasm_bindgen_func_elem_1131(arg0, arg1, addHeapObject(arg2));
217
217
  }
218
218
 
219
- function __wasm_bindgen_func_elem_1132(arg0, arg1, arg2, arg3) {
220
- wasm.__wasm_bindgen_func_elem_1132(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
219
+ function __wasm_bindgen_func_elem_1173(arg0, arg1, arg2, arg3) {
220
+ wasm.__wasm_bindgen_func_elem_1173(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
221
221
  }
222
222
 
223
223
  const GeoReferenceJsFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -272,6 +272,14 @@ const MeshDataJsFinalization = (typeof FinalizationRegistry === 'undefined')
272
272
  ? { register: () => {}, unregister: () => {} }
273
273
  : new FinalizationRegistry(ptr => wasm.__wbg_meshdatajs_free(ptr >>> 0, 1));
274
274
 
275
+ const ProfileCollectionFinalization = (typeof FinalizationRegistry === 'undefined')
276
+ ? { register: () => {}, unregister: () => {} }
277
+ : new FinalizationRegistry(ptr => wasm.__wbg_profilecollection_free(ptr >>> 0, 1));
278
+
279
+ const ProfileEntryJsFinalization = (typeof FinalizationRegistry === 'undefined')
280
+ ? { register: () => {}, unregister: () => {} }
281
+ : new FinalizationRegistry(ptr => wasm.__wbg_profileentryjs_free(ptr >>> 0, 1));
282
+
275
283
  const RtcOffsetJsFinalization = (typeof FinalizationRegistry === 'undefined')
276
284
  ? { register: () => {}, unregister: () => {} }
277
285
  : new FinalizationRegistry(ptr => wasm.__wbg_rtcoffsetjs_free(ptr >>> 0, 1));
@@ -1428,6 +1436,37 @@ export class IfcAPI {
1428
1436
  const ret = wasm.ifcapi_parseZeroCopy(this.__wbg_ptr, ptr0, len0);
1429
1437
  return ZeroCopyMesh.__wrap(ret);
1430
1438
  }
1439
+ /**
1440
+ * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
1441
+ * representations.
1442
+ *
1443
+ * Returns a [`ProfileCollection`] whose entries each carry:
1444
+ * - A 2D polygon (outer + holes) in local profile space (metres)
1445
+ * - A 4 × 4 column-major transform in WebGL Y-up world space
1446
+ * - Extrusion direction (world space) and depth (metres)
1447
+ *
1448
+ * Use [`ProfileProjector`] (TypeScript) to convert these into `DrawingLine[]`
1449
+ * for clean projection without tessellation artifacts.
1450
+ *
1451
+ * ```javascript
1452
+ * const api = new IfcAPI();
1453
+ * const profiles = api.extractProfiles(ifcContent, 0);
1454
+ * console.log('Profiles:', profiles.length);
1455
+ * for (let i = 0; i < profiles.length; i++) {
1456
+ * const p = profiles.get(i);
1457
+ * console.log(p.ifcType, 'depth:', p.extrusionDepth);
1458
+ * }
1459
+ * ```
1460
+ * @param {string} content
1461
+ * @param {number} model_index
1462
+ * @returns {ProfileCollection}
1463
+ */
1464
+ extractProfiles(content, model_index) {
1465
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
1466
+ const len0 = WASM_VECTOR_LEN;
1467
+ const ret = wasm.ifcapi_extractProfiles(this.__wbg_ptr, ptr0, len0, model_index);
1468
+ return ProfileCollection.__wrap(ret);
1469
+ }
1431
1470
  /**
1432
1471
  * Debug: Test processing entity #953 (FacetedBrep wall)
1433
1472
  * @param {string} content
@@ -2138,6 +2177,159 @@ export class MeshDataJs {
2138
2177
  }
2139
2178
  if (Symbol.dispose) MeshDataJs.prototype[Symbol.dispose] = MeshDataJs.prototype.free;
2140
2179
 
2180
+ /**
2181
+ * A collection of extracted profiles.
2182
+ */
2183
+ export class ProfileCollection {
2184
+ static __wrap(ptr) {
2185
+ ptr = ptr >>> 0;
2186
+ const obj = Object.create(ProfileCollection.prototype);
2187
+ obj.__wbg_ptr = ptr;
2188
+ ProfileCollectionFinalization.register(obj, obj.__wbg_ptr, obj);
2189
+ return obj;
2190
+ }
2191
+ __destroy_into_raw() {
2192
+ const ptr = this.__wbg_ptr;
2193
+ this.__wbg_ptr = 0;
2194
+ ProfileCollectionFinalization.unregister(this);
2195
+ return ptr;
2196
+ }
2197
+ free() {
2198
+ const ptr = this.__destroy_into_raw();
2199
+ wasm.__wbg_profilecollection_free(ptr, 0);
2200
+ }
2201
+ /**
2202
+ * Get profile at `index`. Returns `undefined` for out-of-bounds index.
2203
+ * @param {number} index
2204
+ * @returns {ProfileEntryJs | undefined}
2205
+ */
2206
+ get(index) {
2207
+ const ret = wasm.profilecollection_get(this.__wbg_ptr, index);
2208
+ return ret === 0 ? undefined : ProfileEntryJs.__wrap(ret);
2209
+ }
2210
+ /**
2211
+ * Number of profiles.
2212
+ * @returns {number}
2213
+ */
2214
+ get length() {
2215
+ const ret = wasm.profilecollection_length(this.__wbg_ptr);
2216
+ return ret >>> 0;
2217
+ }
2218
+ }
2219
+ if (Symbol.dispose) ProfileCollection.prototype[Symbol.dispose] = ProfileCollection.prototype.free;
2220
+
2221
+ /**
2222
+ * A single profile entry – raw 2D polygon + world transform.
2223
+ *
2224
+ * Profile points are in **local 2D profile space** (metres).
2225
+ * Apply `transform` to `[x, y, 0, 1]` to get WebGL Y-up world coordinates.
2226
+ */
2227
+ export class ProfileEntryJs {
2228
+ static __wrap(ptr) {
2229
+ ptr = ptr >>> 0;
2230
+ const obj = Object.create(ProfileEntryJs.prototype);
2231
+ obj.__wbg_ptr = ptr;
2232
+ ProfileEntryJsFinalization.register(obj, obj.__wbg_ptr, obj);
2233
+ return obj;
2234
+ }
2235
+ __destroy_into_raw() {
2236
+ const ptr = this.__wbg_ptr;
2237
+ this.__wbg_ptr = 0;
2238
+ ProfileEntryJsFinalization.unregister(this);
2239
+ return ptr;
2240
+ }
2241
+ free() {
2242
+ const ptr = this.__destroy_into_raw();
2243
+ wasm.__wbg_profileentryjs_free(ptr, 0);
2244
+ }
2245
+ /**
2246
+ * Express ID of the building element.
2247
+ * @returns {number}
2248
+ */
2249
+ get expressId() {
2250
+ const ret = wasm.meshdatajs_expressId(this.__wbg_ptr);
2251
+ return ret >>> 0;
2252
+ }
2253
+ /**
2254
+ * Number of points per hole.
2255
+ * @returns {Uint32Array}
2256
+ */
2257
+ get holeCounts() {
2258
+ const ret = wasm.profileentryjs_holeCounts(this.__wbg_ptr);
2259
+ return takeObject(ret);
2260
+ }
2261
+ /**
2262
+ * All hole points concatenated: `[x0, y0, x1, y1, …]` (metres).
2263
+ * @returns {Float32Array}
2264
+ */
2265
+ get holePoints() {
2266
+ const ret = wasm.profileentryjs_holePoints(this.__wbg_ptr);
2267
+ return takeObject(ret);
2268
+ }
2269
+ /**
2270
+ * Model index for multi-model federation.
2271
+ * @returns {number}
2272
+ */
2273
+ get modelIndex() {
2274
+ const ret = wasm.profileentryjs_modelIndex(this.__wbg_ptr);
2275
+ return ret >>> 0;
2276
+ }
2277
+ /**
2278
+ * Outer boundary: flat `[x0, y0, x1, y1, …]` in local profile space (metres).
2279
+ * @returns {Float32Array}
2280
+ */
2281
+ get outerPoints() {
2282
+ const ret = wasm.profileentryjs_outerPoints(this.__wbg_ptr);
2283
+ return takeObject(ret);
2284
+ }
2285
+ /**
2286
+ * Extrusion direction `[dx, dy, dz]` in WebGL Y-up world space (unit vector).
2287
+ * @returns {Float32Array}
2288
+ */
2289
+ get extrusionDir() {
2290
+ const ret = wasm.profileentryjs_extrusionDir(this.__wbg_ptr);
2291
+ return takeObject(ret);
2292
+ }
2293
+ /**
2294
+ * Extrusion depth (metres).
2295
+ * @returns {number}
2296
+ */
2297
+ get extrusionDepth() {
2298
+ const ret = wasm.profileentryjs_extrusionDepth(this.__wbg_ptr);
2299
+ return ret;
2300
+ }
2301
+ /**
2302
+ * IFC type name (e.g., `"IfcWall"`).
2303
+ * @returns {string}
2304
+ */
2305
+ get ifcType() {
2306
+ let deferred1_0;
2307
+ let deferred1_1;
2308
+ try {
2309
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2310
+ wasm.profileentryjs_ifcType(retptr, this.__wbg_ptr);
2311
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2312
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2313
+ deferred1_0 = r0;
2314
+ deferred1_1 = r1;
2315
+ return getStringFromWasm0(r0, r1);
2316
+ } finally {
2317
+ wasm.__wbindgen_add_to_stack_pointer(16);
2318
+ wasm.__wbindgen_export2(deferred1_0, deferred1_1, 1);
2319
+ }
2320
+ }
2321
+ /**
2322
+ * 4 × 4 column-major transform in WebGL Y-up world space.
2323
+ * `M * [x, y, 0, 1]ᵀ` gives the world position.
2324
+ * @returns {Float32Array}
2325
+ */
2326
+ get transform() {
2327
+ const ret = wasm.profileentryjs_transform(this.__wbg_ptr);
2328
+ return takeObject(ret);
2329
+ }
2330
+ }
2331
+ if (Symbol.dispose) ProfileEntryJs.prototype[Symbol.dispose] = ProfileEntryJs.prototype.free;
2332
+
2141
2333
  /**
2142
2334
  * RTC offset information exposed to JavaScript
2143
2335
  */
@@ -2857,7 +3049,7 @@ function __wbg_get_imports() {
2857
3049
  const a = state0.a;
2858
3050
  state0.a = 0;
2859
3051
  try {
2860
- return __wasm_bindgen_func_elem_1132(a, state0.b, arg0, arg1);
3052
+ return __wasm_bindgen_func_elem_1173(a, state0.b, arg0, arg1);
2861
3053
  } finally {
2862
3054
  state0.a = a;
2863
3055
  }
@@ -2971,7 +3163,7 @@ function __wbg_get_imports() {
2971
3163
  };
2972
3164
  imports.wbg.__wbindgen_cast_8410bcb836a2825d = function(arg0, arg1) {
2973
3165
  // Cast intrinsic for `Closure(Closure { dtor_idx: 145, function: Function { arguments: [Externref], shim_idx: 146, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2974
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1091, __wasm_bindgen_func_elem_1092);
3166
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1130, __wasm_bindgen_func_elem_1131);
2975
3167
  return addHeapObject(ret);
2976
3168
  };
2977
3169
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
Binary file