okgeometry-api 1.22.0 → 1.23.0

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
@@ -1,60 +1,60 @@
1
- {
2
- "name": "okgeometry-api",
3
- "version": "1.22.0",
4
- "description": "Geometry engine API for AEC applications - NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "files": [
15
- "dist/",
16
- "src/"
17
- ],
18
- "scripts": {
19
- "build:wasm": "node -e \"require('fs').rmSync('wasm',{recursive:true,force:true})\" && cd .. && wasm-pack build --target web --out-dir okgeometry-api/wasm",
20
- "sync:wasm-bindings": "node scripts/sync-wasm-bindings.mjs",
21
- "inline-wasm": "tsx scripts/inline-wasm.ts",
22
- "build": "npm run build:wasm && npm run sync:wasm-bindings && npm run inline-wasm && tsc",
23
- "bench:boolean-heavy": "npm run build && tsx scripts/bench-boolean-heavy.ts",
24
- "bench:boolean-ab": "npm run build && tsx scripts/bench-boolean-ab.ts",
25
- "bench:boolean-batch": "npm run build && tsx scripts/bench-boolean-batch.ts",
26
- "bench:boolean-matrix": "tsx scripts/bench-boolean-matrix.ts",
27
- "smoke:brep-boolean": "tsx scripts/smoke-brep-boolean.ts",
28
- "prepublishOnly": "npm run build",
29
- "smoke:brep-parametric": "tsx scripts/smoke-brep-parametric.ts",
30
- "smoke:brep-from-mesh": "tsx scripts/smoke-brep-from-mesh.ts",
31
- "smoke:brep-faces": "tsx scripts/smoke-brep-faces.ts",
32
- "smoke:curve-intersections": "tsx scripts/smoke-curve-intersections.ts",
33
- "smoke:brep-intersections": "tsx scripts/smoke-brep-intersections.ts",
34
- "smoke:brep-sheet-boolean": "tsx scripts/smoke-brep-sheet-boolean.ts",
35
- "smoke:geometry-boolean": "tsx scripts/smoke-geometry-boolean.ts",
36
- "smoke:curve-region": "tsx scripts/smoke-curve-region.ts",
37
- "smoke:sculpt": "tsx scripts/smoke-sculpt.ts",
38
- "smoke:offset-chamfer": "tsx scripts/smoke-offset-chamfer.ts"
39
- },
40
- "keywords": [
41
- "geometry",
42
- "wasm",
43
- "nurbs",
44
- "mesh",
45
- "boolean",
46
- "cad",
47
- "aec",
48
- "3d"
49
- ],
50
- "author": "Mostafa El Ayoubi",
51
- "license": "Proprietary License",
52
- "repository": {
53
- "type": "git",
54
- "url": "https://www.orkestra.online"
55
- },
56
- "devDependencies": {
57
- "tsx": "^4.7.0",
58
- "typescript": "^5.4.0"
59
- }
60
- }
1
+ {
2
+ "name": "okgeometry-api",
3
+ "version": "1.23.0",
4
+ "description": "Geometry engine API for AEC applications - NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/",
16
+ "src/"
17
+ ],
18
+ "scripts": {
19
+ "build:wasm": "node -e \"require('fs').rmSync('wasm',{recursive:true,force:true})\" && cd .. && wasm-pack build --target web --out-dir okgeometry-api/wasm",
20
+ "sync:wasm-bindings": "node scripts/sync-wasm-bindings.mjs",
21
+ "inline-wasm": "tsx scripts/inline-wasm.ts",
22
+ "build": "npm run build:wasm && npm run sync:wasm-bindings && npm run inline-wasm && tsc",
23
+ "bench:boolean-heavy": "npm run build && tsx scripts/bench-boolean-heavy.ts",
24
+ "bench:boolean-ab": "npm run build && tsx scripts/bench-boolean-ab.ts",
25
+ "bench:boolean-batch": "npm run build && tsx scripts/bench-boolean-batch.ts",
26
+ "bench:boolean-matrix": "tsx scripts/bench-boolean-matrix.ts",
27
+ "smoke:brep-boolean": "tsx scripts/smoke-brep-boolean.ts",
28
+ "prepublishOnly": "npm run build",
29
+ "smoke:brep-parametric": "tsx scripts/smoke-brep-parametric.ts",
30
+ "smoke:brep-from-mesh": "tsx scripts/smoke-brep-from-mesh.ts",
31
+ "smoke:brep-faces": "tsx scripts/smoke-brep-faces.ts",
32
+ "smoke:curve-intersections": "tsx scripts/smoke-curve-intersections.ts",
33
+ "smoke:brep-intersections": "tsx scripts/smoke-brep-intersections.ts",
34
+ "smoke:brep-sheet-boolean": "tsx scripts/smoke-brep-sheet-boolean.ts",
35
+ "smoke:geometry-boolean": "tsx scripts/smoke-geometry-boolean.ts",
36
+ "smoke:curve-region": "tsx scripts/smoke-curve-region.ts",
37
+ "smoke:sculpt": "tsx scripts/smoke-sculpt.ts",
38
+ "smoke:offset-chamfer": "tsx scripts/smoke-offset-chamfer.ts"
39
+ },
40
+ "keywords": [
41
+ "geometry",
42
+ "wasm",
43
+ "nurbs",
44
+ "mesh",
45
+ "boolean",
46
+ "cad",
47
+ "aec",
48
+ "3d"
49
+ ],
50
+ "author": "Mostafa El Ayoubi",
51
+ "license": "Proprietary License",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://www.orkestra.online"
55
+ },
56
+ "devDependencies": {
57
+ "tsx": "^4.7.0",
58
+ "typescript": "^5.4.0"
59
+ }
60
+ }
package/src/Brep.ts CHANGED
@@ -485,6 +485,30 @@ export class Brep {
485
485
  );
486
486
  }
487
487
 
488
+ /**
489
+ * Wireframe of the whole BREP in ONE WASM crossing: per face, `uCount`
490
+ * curves running along u plus `vCount` along v, at evenly spaced INTERIOR
491
+ * normalized parameters (i+1)/(count+1), each clipped to that face's
492
+ * trimmed region. The body JSON is parsed once for the entire sweep, so
493
+ * this scales to large face counts where per-face
494
+ * {@link faceIsoCurvesTrimmedNormalized} calls would re-parse the body
495
+ * repeatedly. Boundary parameters are excluded (they coincide with the
496
+ * BREP's edges); faces that fail to evaluate are skipped atomically.
497
+ */
498
+ wireframeCurves(uCount: number, vCount: number): NurbsCurve[] {
499
+ ensureInit();
500
+ const buf = wasm.brep_wireframe_curves(this.json, uCount, vCount);
501
+ // An empty buffer (not even a zero count header) means the call failed
502
+ // outright, e.g. unparseable JSON — surface the reason instead of
503
+ // pretending the wireframe is empty.
504
+ if (buf.length < 1) {
505
+ throw new Error(
506
+ `Brep.wireframeCurves() failed: ${wasm.geometry_last_error() || "unknown error"}`,
507
+ );
508
+ }
509
+ return Brep.parseCurveList(buf);
510
+ }
511
+
488
512
  /** Parse [count, (bufLen, curveData…)·count] into NurbsCurves. */
489
513
  private static parseCurveList(buf: Float64Array): NurbsCurve[] {
490
514
  if (buf.length < 1) return [];