@bldrs-ai/conway 0.15.836 → 0.15.839

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/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNode.js +1 -1
  2. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmNodeMT.js +1 -1
  3. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWeb.js +1 -1
  4. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.js +1 -1
  5. package/compiled/dependencies/conway-geom/Dist/ConwayGeomWasmWebMT.wasm +0 -0
  6. package/compiled/dependencies/conway-geom/index.d.ts +0 -2
  7. package/compiled/dependencies/conway-geom/index.d.ts.map +1 -1
  8. package/compiled/dependencies/conway-geom/index.js +0 -2
  9. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts +0 -6
  10. package/compiled/dependencies/conway-geom/interface/conway_geometry.d.ts.map +1 -1
  11. package/compiled/dependencies/conway-geom/interface/conway_geometry.js +0 -7
  12. package/compiled/examples/browser-bundled.js +69044 -0
  13. package/compiled/examples/browser.d.ts +3 -0
  14. package/compiled/examples/browser.d.ts.map +1 -0
  15. package/compiled/examples/browser.js +393 -0
  16. package/compiled/examples/validator-bundled.js +69057 -0
  17. package/compiled/examples/validator.d.ts +3 -0
  18. package/compiled/examples/validator.d.ts.map +1 -0
  19. package/compiled/examples/validator.js +378 -0
  20. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +1 -22
  21. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  22. package/compiled/src/ifc/ifc_geometry_extraction.js +38 -109
  23. package/compiled/src/ifc/ifc_step_model.d.ts +1 -0
  24. package/compiled/src/ifc/ifc_step_model.d.ts.map +1 -1
  25. package/compiled/src/ifc/ifc_step_model.js +1 -0
  26. package/compiled/src/ifc/ifc_step_parser.d.ts +1 -0
  27. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  28. package/compiled/src/ifc/ifc_step_parser.js +1 -0
  29. package/compiled/src/version/version.js +1 -1
  30. package/compiled/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +49 -42
  32. package/compiled/dependencies/conway-geom/interface/parameters/flattened_points.d.ts +0 -6
  33. package/compiled/dependencies/conway-geom/interface/parameters/flattened_points.d.ts.map +0 -1
  34. package/compiled/dependencies/conway-geom/interface/parameters/flattened_points.js +0 -1
  35. package/compiled/dependencies/conway-geom/interface/parameters/params_add_face_to_geometry_simple.d.ts +0 -10
  36. package/compiled/dependencies/conway-geom/interface/parameters/params_add_face_to_geometry_simple.d.ts.map +0 -1
  37. package/compiled/dependencies/conway-geom/interface/parameters/params_add_face_to_geometry_simple.js +0 -1
@@ -121,7 +121,6 @@ export class IfcGeometryExtraction {
121
121
  this.TWO_DIMENSIONS = 2;
122
122
  this.THREE_DIMENSIONS = 3;
123
123
  this.circleSegments = 12;
124
- this.pointBuffer = null;
125
124
  this.csgMemoization = true;
126
125
  this.freeVectorPolygonalFaces_ = [];
127
126
  this.csgMemoization = !this.lowMemoryMode;
@@ -2418,91 +2417,6 @@ export class IfcGeometryExtraction {
2418
2417
  });
2419
2418
  return flatCoordinates;
2420
2419
  }
2421
- /**
2422
- * Efficiently flatten the points into a Float64Array while skipping
2423
- * consecutive points with the same localID.
2424
- *
2425
- * @param points - Array of IfcCartesianPoint
2426
- * @param dimensions - Number of coordinates per point (e.g. 3 for x,y,z)
2427
- * @return {Float64Array}
2428
- */
2429
- flattenCartesianPointsToFloat64ArrayFiltered(points, dimensions) {
2430
- // 1) First pass: figure out how many points *actually* get included
2431
- // (skipping consecutive duplicates by localID)
2432
- let uniqueCount = 0;
2433
- for (let i = 0; i < points.length; i++) {
2434
- if (i === 0 || points[i].localID !== points[i - 1].localID) {
2435
- uniqueCount++;
2436
- }
2437
- }
2438
- // 2) Knowing how many we'll include, allocate the final TypedArray
2439
- const totalCoordinates = uniqueCount * dimensions;
2440
- const flatCoordinates = new Float64Array(totalCoordinates);
2441
- // 3) Second pass: populate flatCoordinates
2442
- let offset = 0;
2443
- let prevLocalID = -1;
2444
- for (let i = 0; i < points.length; i++) {
2445
- const point = points[i];
2446
- if (i === 0 || point.localID !== prevLocalID) {
2447
- // Copy only if localID changed
2448
- flatCoordinates.set(point.Coordinates, offset);
2449
- offset += point.Coordinates.length; // or offset += dimensions if all are guaranteed
2450
- prevLocalID = point.localID;
2451
- }
2452
- }
2453
- return flatCoordinates;
2454
- }
2455
- /**
2456
- * Flatten the points into WASM memory (skipping consecutive duplicates).
2457
- * Reuses an existing WASM buffer if provided and large enough.
2458
- *
2459
- * @param points - Array of IfcCartesianPoint
2460
- * @param dimensions - Number of coordinates per point (e.g. 3 for x,y,z)
2461
- * @param existingPtr - (Optional) Pointer to an existing WASM buffer
2462
- * @param existingCapacity - (Optional) Capacity of that buffer in Float64 elements
2463
- * @return {FlattenedPointsResult} pointer, length used, total capacity
2464
- */
2465
- flattenCartesianPointsToWasmFiltered(points, dimensions, existingPtr, existingCapacity) {
2466
- // The maximum we might need if we do NOT skip duplicates
2467
- const maxPossibleFloats = points.length * dimensions;
2468
- const bytesPerElement = 8; // Float64
2469
- // 1) Allocate or reuse memory in WASM
2470
- let pointer = existingPtr ?? 0;
2471
- let capacity = existingCapacity ?? 0;
2472
- // If we have no existing buffer OR it's too small, allocate a new one
2473
- if (!pointer || capacity < maxPossibleFloats) {
2474
- // Free the old buffer if it exists and is too small
2475
- if (pointer) {
2476
- this.wasmModule._free(pointer);
2477
- }
2478
- const numBytes = maxPossibleFloats * bytesPerElement;
2479
- pointer = this.wasmModule._malloc(numBytes);
2480
- capacity = maxPossibleFloats;
2481
- }
2482
- // 2) Create a Float64Array view into WASM memory
2483
- // We only need to create a subarray up to the capacity
2484
- const wasmFloat64View = this.wasmModule.HEAPF64.subarray(pointer / bytesPerElement,
2485
- // eslint-disable-next-line no-mixed-operators
2486
- pointer / bytesPerElement + capacity);
2487
- // 3) Single pass to skip consecutive duplicates, fill up the wasm array
2488
- let offset = 0;
2489
- let prevLocalID = -1;
2490
- for (let i = 0; i < points.length; i++) {
2491
- const point = points[i];
2492
- if (i === 0 || point.localID !== prevLocalID) {
2493
- // Copy 'dimensions' values for the current point
2494
- wasmFloat64View.set(point.Coordinates, offset);
2495
- offset += dimensions;
2496
- prevLocalID = point.localID;
2497
- }
2498
- }
2499
- // 4) Return the pointer, the actual usage, and the capacity
2500
- return {
2501
- pointer,
2502
- length: offset,
2503
- capacity,
2504
- };
2505
- }
2506
2420
  /**
2507
2421
  *
2508
2422
  * @param from
@@ -3170,7 +3084,7 @@ export class IfcGeometryExtraction {
3170
3084
  coordParseBuffer.resize(0);
3171
3085
  }
3172
3086
  vec3Array = this.wasmModule.parseVertexVector(coordParseBuffer);
3173
- conwayModel.freeParseBuffer(coordParseBuffer);
3087
+ this.wasmModule.freeParseBuffer(coordParseBuffer);
3174
3088
  }
3175
3089
  else if (innerBound instanceof IfcEdgeLoop) {
3176
3090
  vec3Array = this.nativeVectorGlmdVec3();
@@ -3452,33 +3366,53 @@ export class IfcGeometryExtraction {
3452
3366
  extractFace(from, geometry) {
3453
3367
  if (from.Bounds.length > 0) {
3454
3368
  const bound3DVector = this.nativeBound3DVector();
3455
- // let pointsPtrs:any[]
3456
3369
  for (let boundIndex = 0; boundIndex < from.Bounds.length; ++boundIndex) {
3370
+ const vec3Array = this.nativeVectorGlmdVec3();
3457
3371
  const bound = from.Bounds[boundIndex];
3458
- const innerBound = bound.Bound;
3459
- if (innerBound instanceof IfcPolyLoop) {
3460
- // Attempt to reuse the pointer/capacity from `pointBuffer`
3461
- const result = this.flattenCartesianPointsToWasmFiltered(innerBound.Polygon, this.THREE_DIMENSIONS, this.pointBuffer?.pointer, this.pointBuffer?.capacity);
3462
- // Now `result.pointer` is your up-to-date pointer (maybe a new allocation).
3463
- // `result.length` is how many Float64 coords are valid.
3464
- // `result.capacity` is how many Float64 coords that pointer can hold.
3465
- // eslint-disable-next-line no-unused-vars
3466
- const { pointer, length, capacity } = result;
3467
- // Use them in your WASM call
3468
- const bound3D = this.wasmModule.createSimpleBound3D(pointer, length, bound.Orientation, bound.type === EntityTypesIfc.IFCFACEOUTERBOUND ? 0 : 1);
3469
- // Push your result somewhere
3470
- bound3DVector.push_back(bound3D);
3471
- // Save the buffer for reuse in the next iteration
3472
- this.pointBuffer = result;
3372
+ if (bound.Bound instanceof IfcPolyLoop) {
3373
+ let prevLocalID = -1;
3374
+ for (let pointIndex = 0; pointIndex < bound.Bound.Polygon.length; ++pointIndex) {
3375
+ const vec3 = {
3376
+ x: bound.Bound.Polygon[pointIndex].Coordinates[0],
3377
+ y: bound.Bound.Polygon[pointIndex].Coordinates[1],
3378
+ z: bound.Bound.Polygon[pointIndex].Coordinates[2],
3379
+ };
3380
+ const currentLocalID = bound.Bound.Polygon[pointIndex].localID;
3381
+ if (currentLocalID !== prevLocalID) {
3382
+ vec3Array.push_back(vec3);
3383
+ prevLocalID = currentLocalID;
3384
+ }
3385
+ }
3473
3386
  }
3387
+ const edgesDummy = this.nativeVectorCurve();
3388
+ // get curve
3389
+ const parameters = {
3390
+ points: vec3Array,
3391
+ edges: edgesDummy,
3392
+ };
3393
+ const curve = this.conwayModel.getLoop(parameters);
3394
+ // create bound vector
3395
+ const parametersCreateBounds3D = {
3396
+ curve: curve,
3397
+ orientation: bound.Orientation,
3398
+ type: (bound.type === EntityTypesIfc.IFCFACEOUTERBOUND) ? 0 : 1,
3399
+ };
3400
+ const bound3D = this.conwayModel.createBound3D(parametersCreateBounds3D);
3401
+ bound3DVector.push_back(bound3D);
3402
+ vec3Array.delete();
3403
+ edgesDummy.delete();
3474
3404
  }
3475
3405
  // add face to geometry
3406
+ const defaultSurface = (new (this.wasmModule.IfcSurface));
3476
3407
  const parameters = {
3477
3408
  boundsArray: bound3DVector,
3409
+ advancedBrep: false,
3410
+ surface: defaultSurface,
3478
3411
  scaling: this.getLinearScalingFactor(),
3479
3412
  };
3480
- this.conwayModel.addFaceToGeometrySimple(parameters, geometry);
3413
+ this.conwayModel.addFaceToGeometry(parameters, geometry);
3481
3414
  bound3DVector.delete();
3415
+ defaultSurface.delete();
3482
3416
  }
3483
3417
  }
3484
3418
  /**
@@ -4432,11 +4366,6 @@ export class IfcGeometryExtraction {
4432
4366
  this.model.geometry.deleteTemporaries();
4433
4367
  this.model.voidGeometry.deleteTemporaries();
4434
4368
  }
4435
- // free buffer at the end if you don't need it anymore
4436
- if (this.pointBuffer?.pointer) {
4437
- this.wasmModule._free(this.pointBuffer.pointer);
4438
- this.pointBuffer = null;
4439
- }
4440
4369
  result = ExtractResult.COMPLETE;
4441
4370
  return [result, this.scene];
4442
4371
  }
@@ -25,6 +25,7 @@ export default class IfcStepModel extends StepModelBase<EntityTypesIfc> {
25
25
  * Construct this model given a buffer containing the data and the parsed data index on that,
26
26
  * adding the typeIndex on top of that.
27
27
  *
28
+ * @param wasmModule
28
29
  * @param buffer The buffer to values from.
29
30
  * @param elementIndex The parsed index to elements in the STEP.
30
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ifc_step_model.d.ts","sourceRoot":"","sources":["../../../src/ifc/ifc_step_model.ts"],"names":[],"mappings":"AAAA,OAAO,cAAqC,MAAM,iCAAiC,CAAA;AACnF,OAAO,aAAa,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,sBAAsB,MAAM,6BAA6B,CAAA;AAChE,OAAO,cAAc,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAKvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa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pD,SAAgB,MAAM,iBAA2B;IACjD,SAAgB,aAAa,iBAAuB;IACpD,SAAgB,SAAS,mBAA+B;IACxD,SAAgB,aAAa,mBAAqC;IAElE;;;;;;;OAOG;gBAEC,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,cAAc,CAAE,cAAc,CAAE,EAAE;CAKrD"}
@@ -17,6 +17,7 @@ export default class IfcStepModel extends StepModelBase {
17
17
  * Construct this model given a buffer containing the data and the parsed data index on that,
18
18
  * adding the typeIndex on top of that.
19
19
  *
20
+ * @param wasmModule
20
21
  * @param buffer The buffer to values from.
21
22
  * @param elementIndex The parsed index to elements in the STEP.
22
23
  */
@@ -20,6 +20,7 @@ export default class IfcStepParser extends StepParser<EntityTypesIfc> {
20
20
  /**
21
21
  * Parse data to the model
22
22
  *
23
+ * @param wasmModule A conway-geom wasm module environnment for this.
23
24
  * @param input The parsing buffer, set to user data, to read.
24
25
  * @return {[ParseResult, IfcStepModel | undefined]} The parse result as well as the model,
25
26
  * if it can be extracted.
@@ -1 +1 @@
1
- {"version":3,"file":"ifc_step_parser.d.ts","sourceRoot":"","sources":["../../../src/ifc/ifc_step_parser.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2BAA2B,CAAA;AACrD,OAAO,UAAU,EAAE,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnE,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAE5D,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAE,cAAc,CAAE;IACrE;;OAEG;;IAKH;;;;;OAKG;IACH,gBAAuB,QAAQ,gBAAsB;IAErD;;;;;;OAMG;IACI,gBAAgB,CACnB,KAAK,EAAE,aAAa,GAAI,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;CAKpE"}
1
+ {"version":3,"file":"ifc_step_parser.d.ts","sourceRoot":"","sources":["../../../src/ifc/ifc_step_parser.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2BAA2B,CAAA;AACrD,OAAO,UAAU,EAAE,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnE,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAE5D,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAE,cAAc,CAAE;IACrE;;OAEG;;IAKH;;;;;OAKG;IACH,gBAAuB,QAAQ,gBAAsB;IAErD;;;;;;;OAOG;IACI,gBAAgB,CACnB,KAAK,EAAE,aAAa,GAAI,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;CAKpE"}
@@ -14,6 +14,7 @@ export default class IfcStepParser extends StepParser {
14
14
  /**
15
15
  * Parse data to the model
16
16
  *
17
+ * @param wasmModule A conway-geom wasm module environnment for this.
17
18
  * @param input The parsing buffer, set to user data, to read.
18
19
  * @return {[ParseResult, IfcStepModel | undefined]} The parse result as well as the model,
19
20
  * if it can be extracted.
@@ -1,2 +1,2 @@
1
- const versionString = 'Conway Web-Ifc Shim v0.15.836';
1
+ const versionString = 'Conway Web-Ifc Shim v0.13.835';
2
2
  export { versionString };