okgeometry-api 1.15.0 → 1.16.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,54 +1,54 @@
1
- {
2
- "name": "okgeometry-api",
3
- "version": "1.15.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
- "smoke:brep-boolean": "tsx scripts/smoke-brep-boolean.ts",
27
- "prepublishOnly": "npm run build",
28
- "smoke:brep-parametric": "tsx scripts/smoke-brep-parametric.ts",
29
- "smoke:brep-from-mesh": "tsx scripts/smoke-brep-from-mesh.ts",
30
- "smoke:brep-faces": "tsx scripts/smoke-brep-faces.ts",
31
- "smoke:curve-intersections": "tsx scripts/smoke-curve-intersections.ts",
32
- "smoke:brep-intersections": "tsx scripts/smoke-brep-intersections.ts"
33
- },
34
- "keywords": [
35
- "geometry",
36
- "wasm",
37
- "nurbs",
38
- "mesh",
39
- "boolean",
40
- "cad",
41
- "aec",
42
- "3d"
43
- ],
44
- "author": "Mostafa El Ayoubi",
45
- "license": "Proprietary License",
46
- "repository": {
47
- "type": "git",
48
- "url": "https://www.orkestra.online"
49
- },
50
- "devDependencies": {
51
- "tsx": "^4.7.0",
52
- "typescript": "^5.4.0"
53
- }
54
- }
1
+ {
2
+ "name": "okgeometry-api",
3
+ "version": "1.16.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
+ "smoke:brep-boolean": "tsx scripts/smoke-brep-boolean.ts",
27
+ "prepublishOnly": "npm run build",
28
+ "smoke:brep-parametric": "tsx scripts/smoke-brep-parametric.ts",
29
+ "smoke:brep-from-mesh": "tsx scripts/smoke-brep-from-mesh.ts",
30
+ "smoke:brep-faces": "tsx scripts/smoke-brep-faces.ts",
31
+ "smoke:curve-intersections": "tsx scripts/smoke-curve-intersections.ts",
32
+ "smoke:brep-intersections": "tsx scripts/smoke-brep-intersections.ts"
33
+ },
34
+ "keywords": [
35
+ "geometry",
36
+ "wasm",
37
+ "nurbs",
38
+ "mesh",
39
+ "boolean",
40
+ "cad",
41
+ "aec",
42
+ "3d"
43
+ ],
44
+ "author": "Mostafa El Ayoubi",
45
+ "license": "Proprietary License",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://www.orkestra.online"
49
+ },
50
+ "devDependencies": {
51
+ "tsx": "^4.7.0",
52
+ "typescript": "^5.4.0"
53
+ }
54
+ }
package/src/Brep.ts CHANGED
@@ -624,12 +624,27 @@ export class Brep {
624
624
  *
625
625
  * `options.tolerance` is the absolute geometric tolerance of the fitted
626
626
  * intersection curves (default 1e-6).
627
+ *
628
+ * `options.join` (default false) JOINS the chained pieces into maximal
629
+ * curves: greedy reversal-aware endpoint chaining, exact degree elevation
630
+ * to the chain maximum, exact knot-vector concatenation (junction
631
+ * multiplicity = degree, no re-parameterization), and a per-curve
632
+ * verification gate — every joined curve is sampled densely and must stay
633
+ * within 5·tolerance of BOTH operands' surfaces, otherwise that chain's
634
+ * pieces come back unjoined (never a corrupted joined curve). A closed
635
+ * intersection loop (e.g. a plane through a cylinder) comes back as ONE
636
+ * closed curve with `pointAt(0)` equal to `pointAt(1)`.
627
637
  */
628
- intersectionCurves(other: Brep | NurbsSurface, options?: { tolerance?: number }): NurbsCurve[] {
638
+ intersectionCurves(
639
+ other: Brep | NurbsSurface,
640
+ options?: { tolerance?: number; join?: boolean },
641
+ ): NurbsCurve[] {
629
642
  ensureInit();
630
643
  const rhs = other instanceof Brep ? other : Brep.fromSurface(other);
631
644
  const tolerance = options?.tolerance ?? 1e-6;
632
- const buf = wasm.brep_intersection_curves_op(this.json, rhs.json, tolerance);
645
+ const buf = options?.join
646
+ ? wasm.brep_intersection_curves_joined_op(this.json, rhs.json, tolerance)
647
+ : wasm.brep_intersection_curves_op(this.json, rhs.json, tolerance);
633
648
  // An EMPTY buffer signals a kernel error (invalid BREP / pipeline
634
649
  // failure); "no intersections" is the non-empty `[0]` packing.
635
650
  if (buf.length < 1) {