@faicad/faijs 0.18.2 → 0.19.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.
Files changed (129) hide show
  1. package/dist/api/api-namespace.d.ts.map +1 -1
  2. package/dist/api/api-namespace.js +4 -1
  3. package/dist/api/api-namespace.js.map +1 -1
  4. package/dist/api/brep-mirror/joinery-brep.d.ts +1 -1
  5. package/dist/api/brep-mirror/joinery-brep.d.ts.map +1 -1
  6. package/dist/api/brep-mirror/joinery-brep.js +19 -19
  7. package/dist/api/brep-mirror/joinery-brep.js.map +1 -1
  8. package/dist/api/index.d.ts +4 -0
  9. package/dist/api/index.d.ts.map +1 -1
  10. package/dist/api/index.js +3 -0
  11. package/dist/api/index.js.map +1 -1
  12. package/dist/api/profile.d.ts.map +1 -1
  13. package/dist/api/profile.js +113 -182
  14. package/dist/api/profile.js.map +1 -1
  15. package/dist/api/punch-hole.d.ts +74 -0
  16. package/dist/api/punch-hole.d.ts.map +1 -0
  17. package/dist/api/punch-hole.js +207 -0
  18. package/dist/api/punch-hole.js.map +1 -0
  19. package/dist/api/sketch-on-face.d.ts +85 -0
  20. package/dist/api/sketch-on-face.d.ts.map +1 -0
  21. package/dist/api/sketch-on-face.js +136 -0
  22. package/dist/api/sketch-on-face.js.map +1 -0
  23. package/dist/api/sketch-on-plane.d.ts +81 -0
  24. package/dist/api/sketch-on-plane.d.ts.map +1 -0
  25. package/dist/api/sketch-on-plane.js +103 -0
  26. package/dist/api/sketch-on-plane.js.map +1 -0
  27. package/dist/boolean/csg-backend.d.ts +6 -6
  28. package/dist/boolean/csg-backend.d.ts.map +1 -1
  29. package/dist/boolean/csg-backend.js +9 -9
  30. package/dist/boolean/csg-backend.js.map +1 -1
  31. package/dist/boolean/csg-core.d.ts +10 -10
  32. package/dist/boolean/csg-core.d.ts.map +1 -1
  33. package/dist/boolean/csg-core.js +24 -24
  34. package/dist/boolean/csg-core.js.map +1 -1
  35. package/dist/boolean/extrude-helpers.d.ts +8 -8
  36. package/dist/boolean/extrude-helpers.d.ts.map +1 -1
  37. package/dist/boolean/extrude-helpers.js +13 -13
  38. package/dist/boolean/extrude-helpers.js.map +1 -1
  39. package/dist/brep/brep-ops.d.ts +20 -6
  40. package/dist/brep/brep-ops.d.ts.map +1 -1
  41. package/dist/brep/brep-ops.js +38 -12
  42. package/dist/brep/brep-ops.js.map +1 -1
  43. package/dist/browser-host/csg-worker-protocol.d.ts +3 -3
  44. package/dist/browser-host/csg-worker-protocol.d.ts.map +1 -1
  45. package/dist/browser-host/csg-worker-protocol.js.map +1 -1
  46. package/dist/browser-host/csg-worker.js +3 -3
  47. package/dist/browser-host/csg-worker.js.map +1 -1
  48. package/dist/browser-host/inline-csg-backend.d.ts +3 -3
  49. package/dist/browser-host/inline-csg-backend.d.ts.map +1 -1
  50. package/dist/browser-host/inline-csg-backend.js +3 -3
  51. package/dist/browser-host/inline-csg-backend.js.map +1 -1
  52. package/dist/browser-host/worker-csg-backend.d.ts +3 -3
  53. package/dist/browser-host/worker-csg-backend.d.ts.map +1 -1
  54. package/dist/browser-host/worker-csg-backend.js.map +1 -1
  55. package/dist/cad-runtime/ports.d.ts +3 -3
  56. package/dist/cad-runtime/ports.d.ts.map +1 -1
  57. package/dist/cad-runtime/ports.js.map +1 -1
  58. package/dist/geometry2d/adapt.d.ts +46 -0
  59. package/dist/geometry2d/adapt.d.ts.map +1 -0
  60. package/dist/geometry2d/adapt.js +41 -0
  61. package/dist/geometry2d/adapt.js.map +1 -0
  62. package/dist/geometry2d/bbox2d.d.ts +82 -0
  63. package/dist/geometry2d/bbox2d.d.ts.map +1 -0
  64. package/dist/geometry2d/bbox2d.js +123 -0
  65. package/dist/geometry2d/bbox2d.js.map +1 -0
  66. package/dist/geometry2d/blueprint-sketcher.d.ts +27 -0
  67. package/dist/geometry2d/blueprint-sketcher.d.ts.map +1 -0
  68. package/dist/geometry2d/blueprint-sketcher.js +29 -0
  69. package/dist/geometry2d/blueprint-sketcher.js.map +1 -0
  70. package/dist/geometry2d/blueprint.d.ts +102 -0
  71. package/dist/geometry2d/blueprint.d.ts.map +1 -0
  72. package/dist/geometry2d/blueprint.js +225 -0
  73. package/dist/geometry2d/blueprint.js.map +1 -0
  74. package/dist/geometry2d/blueprints.d.ts +58 -0
  75. package/dist/geometry2d/blueprints.d.ts.map +1 -0
  76. package/dist/geometry2d/blueprints.js +72 -0
  77. package/dist/geometry2d/blueprints.js.map +1 -0
  78. package/dist/geometry2d/bridge/lift-on-plane.d.ts +50 -0
  79. package/dist/geometry2d/bridge/lift-on-plane.d.ts.map +1 -0
  80. package/dist/geometry2d/bridge/lift-on-plane.js +72 -0
  81. package/dist/geometry2d/bridge/lift-on-plane.js.map +1 -0
  82. package/dist/geometry2d/bridge/on-surface.d.ts +98 -0
  83. package/dist/geometry2d/bridge/on-surface.d.ts.map +1 -0
  84. package/dist/geometry2d/bridge/on-surface.js +94 -0
  85. package/dist/geometry2d/bridge/on-surface.js.map +1 -0
  86. package/dist/geometry2d/bridge/plane.d.ts +69 -0
  87. package/dist/geometry2d/bridge/plane.d.ts.map +1 -0
  88. package/dist/geometry2d/bridge/plane.js +96 -0
  89. package/dist/geometry2d/bridge/plane.js.map +1 -0
  90. package/dist/geometry2d/canned-blueprints.d.ts +44 -0
  91. package/dist/geometry2d/canned-blueprints.d.ts.map +1 -0
  92. package/dist/geometry2d/canned-blueprints.js +94 -0
  93. package/dist/geometry2d/canned-blueprints.js.map +1 -0
  94. package/dist/geometry2d/compound-blueprint.d.ts +72 -0
  95. package/dist/geometry2d/compound-blueprint.d.ts.map +1 -0
  96. package/dist/geometry2d/compound-blueprint.js +95 -0
  97. package/dist/geometry2d/compound-blueprint.js.map +1 -0
  98. package/dist/geometry2d/curve2d.d.ts +298 -0
  99. package/dist/geometry2d/curve2d.d.ts.map +1 -0
  100. package/dist/geometry2d/curve2d.js +1110 -0
  101. package/dist/geometry2d/curve2d.js.map +1 -0
  102. package/dist/geometry2d/index.d.ts +22 -0
  103. package/dist/geometry2d/index.d.ts.map +1 -0
  104. package/dist/geometry2d/index.js +21 -0
  105. package/dist/geometry2d/index.js.map +1 -0
  106. package/dist/geometry2d/organise.d.ts +28 -0
  107. package/dist/geometry2d/organise.d.ts.map +1 -0
  108. package/dist/geometry2d/organise.js +108 -0
  109. package/dist/geometry2d/organise.js.map +1 -0
  110. package/dist/geometry2d/pen-sketcher.d.ts +340 -0
  111. package/dist/geometry2d/pen-sketcher.d.ts.map +1 -0
  112. package/dist/geometry2d/pen-sketcher.js +477 -0
  113. package/dist/geometry2d/pen-sketcher.js.map +1 -0
  114. package/dist/geometry2d/point.d.ts +44 -0
  115. package/dist/geometry2d/point.d.ts.map +1 -0
  116. package/dist/geometry2d/point.js +57 -0
  117. package/dist/geometry2d/point.js.map +1 -0
  118. package/dist/geometry2d/svg-ellipse.d.ts +74 -0
  119. package/dist/geometry2d/svg-ellipse.d.ts.map +1 -0
  120. package/dist/geometry2d/svg-ellipse.js +163 -0
  121. package/dist/geometry2d/svg-ellipse.js.map +1 -0
  122. package/dist/lang/symbol-table.generated.d.ts +3 -0
  123. package/dist/lang/symbol-table.generated.d.ts.map +1 -1
  124. package/dist/lang/symbol-table.generated.js +3 -0
  125. package/dist/lang/symbol-table.generated.js.map +1 -1
  126. package/dist/mesh/types.d.ts +1 -1
  127. package/dist/mesh/types.d.ts.map +1 -1
  128. package/dist/mesh/types.js.map +1 -1
  129. package/package.json +9 -1
@@ -0,0 +1,103 @@
1
+ import { getBrepApi } from '../brep/handle-bridge.js';
2
+ import { solidToShape } from '../brep/brep-ops.js';
3
+ import { fromBrep, fromBrepCurve } from '../shape.js';
4
+ import { defineOp } from '../sdk.js';
5
+ import { Blueprint } from '../geometry2d/blueprint.js';
6
+ import { CompoundBlueprint } from '../geometry2d/compound-blueprint.js';
7
+ import { organiseBlueprints } from '../geometry2d/organise.js';
8
+ import { namedPlane, makePlane, toVec3 } from '../geometry2d/bridge/plane.js';
9
+ import { assembleWire } from '../geometry2d/bridge/lift-on-plane.js';
10
+ import { profileSegToCurve } from '../geometry2d/adapt.js';
11
+ import { assertProfileParams } from './profile.js';
12
+ /**
13
+ * Resolve a `PlaneSpec` to a plane frame. A named plane wins over an explicit
14
+ * frame; with neither, the XY plane is used.
15
+ * @param planeSpec - the user-facing plane spec (named plane and/or explicit frame).
16
+ * @param fallbackOrigin - the origin used when `planeSpec.origin` is absent (default [0,0,0]).
17
+ * @returns the resolved plane frame.
18
+ */
19
+ export function resolvePlane(planeSpec, fallbackOrigin = [0, 0, 0]) {
20
+ const o = planeSpec.origin ?? toVec3(fallbackOrigin);
21
+ if (planeSpec.name)
22
+ return namedPlane(planeSpec.name, o);
23
+ if (planeSpec.normal)
24
+ return makePlane(o, planeSpec.normal, planeSpec.xAxis);
25
+ return namedPlane('XY', o);
26
+ }
27
+ /**
28
+ * Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set
29
+ * of classified `Blueprint` contours on a plane. This is the shared placement
30
+ * core for every 2D profile source (`cad.profile` / `cad.draw` / sketch): it
31
+ * organises the closed contours (holes vs islands), assembles edge wires on the
32
+ * plane via the geometry2d bridge, and wraps them as a BREP face — ready to be
33
+ * extruded along the plane normal.
34
+ * @param kernel - the BREP engine surface.
35
+ * @param plane - the resolved target plane frame.
36
+ * @param blueprints - ordered closed contours as `Blueprint`s (draw output).
37
+ * @param as - `'face'` (default) or `'wire'` (outer loop only).
38
+ * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).
39
+ */
40
+ export function buildShapeFromBlueprints(kernel, plane, blueprints, as = 'face') {
41
+ const organised = organiseBlueprints(blueprints);
42
+ if (as === 'wire') {
43
+ const outerBp = organised.blueprints[0] instanceof CompoundBlueprint
44
+ ? organised.blueprints[0].blueprints[0]
45
+ : organised.blueprints[0];
46
+ const wire = assembleWire(kernel, plane, outerBp);
47
+ return fromBrepCurve(solidToShape(kernel, wire), { solid: wire });
48
+ }
49
+ const faces = [];
50
+ for (const entry of organised.blueprints) {
51
+ if (entry instanceof CompoundBlueprint) {
52
+ let face = kernel.makeFace(assembleWire(kernel, plane, entry.blueprints[0]));
53
+ const holes = entry.blueprints.slice(1).map((h) => assembleWire(kernel, plane, h));
54
+ if (holes.length > 0) {
55
+ face = kernel.addHolesInFace(face, holes);
56
+ }
57
+ faces.push(face);
58
+ }
59
+ else {
60
+ faces.push(kernel.makeFace(assembleWire(kernel, plane, entry)));
61
+ }
62
+ }
63
+ if (faces.length === 1) {
64
+ const f = faces[0];
65
+ return fromBrep(solidToShape(kernel, f), { solid: f });
66
+ }
67
+ const compound = kernel.makeCompound(faces);
68
+ return fromBrep(solidToShape(kernel, compound), { solid: compound });
69
+ }
70
+ /**
71
+ * Build the 2D→3D placement: convert contour loops to a classified Blueprint
72
+ * set, assemble a wire on the plane, then wrap as a face (or the outer wire).
73
+ * @param kernel - the BREP engine surface.
74
+ * @param params - contour loops + plane + mode.
75
+ * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).
76
+ */
77
+ export function buildSketchOnPlaneWith(kernel, params) {
78
+ const plane = resolvePlane(params.plane);
79
+ const blueprints = params.contours.map((loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s))));
80
+ return buildShapeFromBlueprints(kernel, plane, blueprints, params.as ?? 'face');
81
+ }
82
+ /**
83
+ * `cad.sketchOnPlane`: place 2D contours on a plane and construct a Shape.
84
+ * @group 创建
85
+ * @inputs 0
86
+ * @async false
87
+ * @qual ok
88
+ * @name sketchOnPlane
89
+ * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).
90
+ * @param params.contours - ordered 2D contours (same shape as `cad.profile`).type:any[] required:true
91
+ * @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true
92
+ * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false
93
+ */
94
+ export const sketchOnPlane = defineOp({
95
+ capabilities: ['directEdit'],
96
+ engines: ['occt'],
97
+ brep(params) {
98
+ assertProfileParams(params);
99
+ return buildSketchOnPlaneWith(getBrepApi(), params);
100
+ },
101
+ naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } },
102
+ });
103
+ //# sourceMappingURL=sketch-on-plane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketch-on-plane.js","sourceRoot":"","sources":["../../src/api/sketch-on-plane.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAA8B,MAAM,4BAA4B,CAAA;AACtG,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAoB,MAAM,WAAW,CAAA;AAuBjE;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,SAAoB,EAAE,iBAA4B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtF,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,IAAI,MAAM,CAAC,cAAc,CAAC,CAAA;IACpD,IAAI,SAAS,CAAC,IAAI;QAAE,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACxD,IAAI,SAAS,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;IAC5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,QAAQ,CAAC;IACpC,YAAY,EAAE,CAAC,YAAY,CAAC;IAC5B,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,IAAI,CAAC,MAA+B;QAClC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,OAAO,sBAAsB,CAAC,UAAU,EAAE,EAAE,MAAwC,CAAC,CAAA;IACvF,CAAC;IACD,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,EAAgB;CACtF,CAAC,CAAA","sourcesContent":["/**\n * `cad.sketchOnPlane`: lift 2D contours onto an arbitrary plane (E2 placement).\n *\n * This is the shared \"placement\" step of the plan's unified 3D pipeline: any 2D\n * profile source (profile / draw / sketch) that describes contours as\n * `ProfileLoop`s can be placed here, then extruded along the plane normal. The\n * plane is a named plane (`'XY'` / `'XZ'` / `'top'` …) or an explicit frame\n * `{ origin, normal, xAxis }`. The plane lift runs on the occt platform surface\n * via the geometry2d bridge; the op declares `engines: ['occt']`.\n * @module\n */\nimport type { Shape } from '../mesh/types'\nimport type { BrepEngineApi } from '../brep/engine/primitives'\nimport { getBrepApi } from '../brep/handle-bridge'\nimport { solidToShape } from '../brep/brep-ops'\nimport { fromBrep, fromBrepCurve } from '../shape'\nimport { defineOp } from '../sdk'\nimport type { Provenance } from '../topology/naming/lineage'\nimport { Blueprint } from '../geometry2d/blueprint'\nimport { CompoundBlueprint } from '../geometry2d/compound-blueprint'\nimport { organiseBlueprints } from '../geometry2d/organise'\nimport { namedPlane, makePlane, toVec3, type Plane, type Vec3Input } from '../geometry2d/bridge/plane'\nimport { assembleWire } from '../geometry2d/bridge/lift-on-plane'\nimport { profileSegToCurve, type ProfileSegLike } from '../geometry2d/adapt'\nimport { assertProfileParams, type ProfileLoop } from './profile'\n\n/** A plane given by a named plane and/or an explicit frame (coords accept both array and `{x,y,z}`). */\nexport interface PlaneSpec {\n /** Named plane (`'XY'` / `'XZ'` / `'YZ'` / `'front'` / `'back'` / `'left'` / …). */\n name?: string\n /** The plane origin (default [0,0,0]; array `[x,y,z]` or `{x,y,z}`). */\n origin?: Vec3Input\n /** Explicit normal (used with an explicit frame; array or `{x,y,z}`). */\n normal?: Vec3Input\n /** Explicit in-plane X axis (auto-derived when omitted; array or `{x,y,z}`). */\n xAxis?: Vec3Input\n}\n\n/** Contour loops + a target plane (+ the result mode) for `cad.sketchOnPlane`. */\nexport interface SketchOnPlaneParams {\n contours: ProfileLoop[]\n /** Named plane or explicit `{ origin, normal, xAxis }` frame. */\n plane: PlaneSpec\n /** Result shape: 'face' (default) builds a planar face; 'wire' returns the outer-loop wire only. */\n as?: 'face' | 'wire'\n}\n\n/**\n * Resolve a `PlaneSpec` to a plane frame. A named plane wins over an explicit\n * frame; with neither, the XY plane is used.\n * @param planeSpec - the user-facing plane spec (named plane and/or explicit frame).\n * @param fallbackOrigin - the origin used when `planeSpec.origin` is absent (default [0,0,0]).\n * @returns the resolved plane frame.\n */\nexport function resolvePlane(planeSpec: PlaneSpec, fallbackOrigin: Vec3Input = [0, 0, 0]): Plane {\n const o = planeSpec.origin ?? toVec3(fallbackOrigin)\n if (planeSpec.name) return namedPlane(planeSpec.name, o)\n if (planeSpec.normal) return makePlane(o, planeSpec.normal, planeSpec.xAxis)\n return namedPlane('XY', o)\n}\n\n/**\n * Build a 3D Shape (planar face, or outer-loop wire when `as:'wire'`) from a set\n * of classified `Blueprint` contours on a plane. This is the shared placement\n * core for every 2D profile source (`cad.profile` / `cad.draw` / sketch): it\n * organises the closed contours (holes vs islands), assembles edge wires on the\n * plane via the geometry2d bridge, and wraps them as a BREP face — ready to be\n * extruded along the plane normal.\n * @param kernel - the BREP engine surface.\n * @param plane - the resolved target plane frame.\n * @param blueprints - ordered closed contours as `Blueprint`s (draw output).\n * @param as - `'face'` (default) or `'wire'` (outer loop only).\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildShapeFromBlueprints(\n kernel: BrepEngineApi,\n plane: Plane,\n blueprints: Blueprint[],\n as: 'face' | 'wire' = 'face',\n): Shape {\n const organised = organiseBlueprints(blueprints)\n\n if (as === 'wire') {\n const outerBp =\n organised.blueprints[0] instanceof CompoundBlueprint\n ? organised.blueprints[0].blueprints[0]!\n : (organised.blueprints[0] as Blueprint)\n const wire = assembleWire(kernel, plane, outerBp)\n return fromBrepCurve(solidToShape(kernel, wire), { solid: wire })\n }\n\n const faces: ReturnType<BrepEngineApi['makeFace']>[] = []\n for (const entry of organised.blueprints) {\n if (entry instanceof CompoundBlueprint) {\n let face = kernel.makeFace(assembleWire(kernel, plane, entry.blueprints[0]!))\n const holes = entry.blueprints.slice(1).map((h) => assembleWire(kernel, plane, h) as never)\n if (holes.length > 0) {\n face = kernel.addHolesInFace(face, holes)\n }\n faces.push(face)\n } else {\n faces.push(kernel.makeFace(assembleWire(kernel, plane, entry)))\n }\n }\n\n if (faces.length === 1) {\n const f = faces[0]!\n return fromBrep(solidToShape(kernel, f), { solid: f })\n }\n const compound = kernel.makeCompound(faces)\n return fromBrep(solidToShape(kernel, compound), { solid: compound })\n}\n\n/**\n * Build the 2D→3D placement: convert contour loops to a classified Blueprint\n * set, assemble a wire on the plane, then wrap as a face (or the outer wire).\n * @param kernel - the BREP engine surface.\n * @param params - contour loops + plane + mode.\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n */\nexport function buildSketchOnPlaneWith(kernel: BrepEngineApi, params: SketchOnPlaneParams): Shape {\n const plane = resolvePlane(params.plane)\n const blueprints = params.contours.map(\n (loop) => new Blueprint(loop.segments.map((s) => profileSegToCurve(s as ProfileSegLike))),\n )\n return buildShapeFromBlueprints(kernel, plane, blueprints, params.as ?? 'face')\n}\n\n/**\n * `cad.sketchOnPlane`: place 2D contours on a plane and construct a Shape.\n * @group 创建\n * @inputs 0\n * @async false\n * @qual ok\n * @name sketchOnPlane\n * @returns Shape on the target plane (face, or a wire curve when `as:'wire'`).\n * @param params.contours - ordered 2D contours (same shape as `cad.profile`).type:any[] required:true\n * @param params.plane - named plane (`'XY'` / `'XZ'`…) or `{ origin, normal, xAxis }`.type:any required:true\n * @param params.as - `'face'` (default) or `'wire'` (outer loop only).type:string required:false\n */\nexport const sketchOnPlane = defineOp({\n capabilities: ['directEdit'],\n engines: ['occt'],\n brep(params: Record<string, unknown>) {\n assertProfileParams(params)\n return buildSketchOnPlaneWith(getBrepApi(), params as unknown as SketchOnPlaneParams)\n },\n naming: { kind: 'construct', newFaces: { via: 'explicit', vocab: [] } } as Provenance,\n})"]}
@@ -39,14 +39,14 @@ export declare function computeSplit(mesh: ManifoldMeshData, normal: [number, nu
39
39
  * Split a mesh by a plane and cut a dovetail groove via the current backend.
40
40
  * @param mesh The mesh to split.
41
41
  * @param planeNormal The cutting plane normal (unit vector).
42
- * @param planeOriginOffset The cutting plane offset along the normal.
42
+ * @param planeDistance The cutting plane offset along the normal.
43
43
  * @param planeCenter A point on the cutting plane.
44
44
  * @param widthDir The width direction within the cutting plane (unit vector).
45
45
  * @param bboxWidthOnWidthDir The model bounding-box width along the width direction.
46
46
  * @param groove The dovetail groove parameters.
47
47
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
48
48
  */
49
- export declare function computeDovetailSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeOriginOffset: number, planeCenter: [number, number, number], widthDir: [number, number, number], bboxWidthOnWidthDir: number, groove: DovetailGrooveParams): Promise<{
49
+ export declare function computeDovetailSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeDistance: number, planeCenter: [number, number, number], widthDir: [number, number, number], bboxWidthOnWidthDir: number, groove: DovetailGrooveParams): Promise<{
50
50
  front: ManifoldMeshData;
51
51
  back: ManifoldMeshData;
52
52
  wedge: ManifoldMeshData | null;
@@ -55,14 +55,14 @@ export declare function computeDovetailSplit(mesh: ManifoldMeshData, planeNormal
55
55
  * Split a mesh by a plane and cut dowel tenons via the current backend.
56
56
  * @param mesh The mesh to split.
57
57
  * @param planeNormal The cutting plane normal (unit vector).
58
- * @param planeOriginOffset The cutting plane offset along the normal.
58
+ * @param planeDistance The cutting plane offset along the normal.
59
59
  * @param planeCenter A point on the cutting plane.
60
60
  * @param widthDir The width direction within the cutting plane (unit vector).
61
61
  * @param dowel The dowel split parameters.
62
62
  * @param selectedSections Optional list of section indices to place tenons on.
63
63
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
64
64
  */
65
- export declare function computeDowelSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeOriginOffset: number, planeCenter: [number, number, number], widthDir: [number, number, number], dowel: DowelSplitParams, selectedSections?: number[] | null): Promise<{
65
+ export declare function computeDowelSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeDistance: number, planeCenter: [number, number, number], widthDir: [number, number, number], dowel: DowelSplitParams, selectedSections?: number[] | null): Promise<{
66
66
  front: ManifoldMeshData;
67
67
  back: ManifoldMeshData;
68
68
  wedge: ManifoldMeshData | null;
@@ -71,14 +71,14 @@ export declare function computeDowelSplit(mesh: ManifoldMeshData, planeNormal: [
71
71
  * Split a mesh by a plane and cut straight tenons via the current backend.
72
72
  * @param mesh The mesh to split.
73
73
  * @param planeNormal The cutting plane normal (unit vector).
74
- * @param planeOriginOffset The cutting plane offset along the normal.
74
+ * @param planeDistance The cutting plane offset along the normal.
75
75
  * @param planeCenter A point on the cutting plane.
76
76
  * @param widthDir The width direction within the cutting plane (unit vector).
77
77
  * @param tenon The straight-tenon split parameters.
78
78
  * @param selectedSections Optional list of section indices to place tenons on.
79
79
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
80
80
  */
81
- export declare function computeStraightTenonSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeOriginOffset: number, planeCenter: [number, number, number], widthDir: [number, number, number], tenon: StraightTenonSplitParams, selectedSections?: number[] | null): Promise<{
81
+ export declare function computeStraightTenonSplit(mesh: ManifoldMeshData, planeNormal: [number, number, number], planeDistance: number, planeCenter: [number, number, number], widthDir: [number, number, number], tenon: StraightTenonSplitParams, selectedSections?: number[] | null): Promise<{
82
82
  front: ManifoldMeshData;
83
83
  back: ManifoldMeshData;
84
84
  wedge: ManifoldMeshData | null;
@@ -1 +1 @@
1
- {"version":3,"file":"csg-backend.d.ts","sourceRoot":"","sources":["../../src/boolean/csg-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,eAAe,CAAA;AAMtB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAEvD;AAgBD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,gBAAgB,EAAE,EAC1B,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAG3B;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAChC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAI9D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACrC,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAClC,mBAAmB,EAAE,MAAM,EAC3B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC;IAAE,KAAK,EAAE,g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BAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAA"}
@@ -58,18 +58,18 @@ export async function computeSplit(mesh, normal, offset) {
58
58
  * Split a mesh by a plane and cut a dovetail groove via the current backend.
59
59
  * @param mesh The mesh to split.
60
60
  * @param planeNormal The cutting plane normal (unit vector).
61
- * @param planeOriginOffset The cutting plane offset along the normal.
61
+ * @param planeDistance The cutting plane offset along the normal.
62
62
  * @param planeCenter A point on the cutting plane.
63
63
  * @param widthDir The width direction within the cutting plane (unit vector).
64
64
  * @param bboxWidthOnWidthDir The model bounding-box width along the width direction.
65
65
  * @param groove The dovetail groove parameters.
66
66
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
67
67
  */
68
- export async function computeDovetailSplit(mesh, planeNormal, planeOriginOffset, planeCenter, widthDir, bboxWidthOnWidthDir, groove) {
68
+ export async function computeDovetailSplit(mesh, planeNormal, planeDistance, planeCenter, widthDir, bboxWidthOnWidthDir, groove) {
69
69
  const backend = await getBackend();
70
70
  const result = await backend.splitDovetail(mesh, {
71
71
  planeNormal,
72
- planeOriginOffset,
72
+ planeDistance,
73
73
  planeCenter,
74
74
  widthDir,
75
75
  bboxWidthOnWidthDir,
@@ -81,18 +81,18 @@ export async function computeDovetailSplit(mesh, planeNormal, planeOriginOffset,
81
81
  * Split a mesh by a plane and cut dowel tenons via the current backend.
82
82
  * @param mesh The mesh to split.
83
83
  * @param planeNormal The cutting plane normal (unit vector).
84
- * @param planeOriginOffset The cutting plane offset along the normal.
84
+ * @param planeDistance The cutting plane offset along the normal.
85
85
  * @param planeCenter A point on the cutting plane.
86
86
  * @param widthDir The width direction within the cutting plane (unit vector).
87
87
  * @param dowel The dowel split parameters.
88
88
  * @param selectedSections Optional list of section indices to place tenons on.
89
89
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
90
90
  */
91
- export async function computeDowelSplit(mesh, planeNormal, planeOriginOffset, planeCenter, widthDir, dowel, selectedSections) {
91
+ export async function computeDowelSplit(mesh, planeNormal, planeDistance, planeCenter, widthDir, dowel, selectedSections) {
92
92
  const backend = await getBackend();
93
93
  const result = await backend.splitDowel(mesh, {
94
94
  planeNormal,
95
- planeOriginOffset,
95
+ planeDistance,
96
96
  planeCenter,
97
97
  widthDir,
98
98
  dowel,
@@ -104,18 +104,18 @@ export async function computeDowelSplit(mesh, planeNormal, planeOriginOffset, pl
104
104
  * Split a mesh by a plane and cut straight tenons via the current backend.
105
105
  * @param mesh The mesh to split.
106
106
  * @param planeNormal The cutting plane normal (unit vector).
107
- * @param planeOriginOffset The cutting plane offset along the normal.
107
+ * @param planeDistance The cutting plane offset along the normal.
108
108
  * @param planeCenter A point on the cutting plane.
109
109
  * @param widthDir The width direction within the cutting plane (unit vector).
110
110
  * @param tenon The straight-tenon split parameters.
111
111
  * @param selectedSections Optional list of section indices to place tenons on.
112
112
  * @returns The front/back halves plus the wedge mesh (or null when no wedge).
113
113
  */
114
- export async function computeStraightTenonSplit(mesh, planeNormal, planeOriginOffset, planeCenter, widthDir, tenon, selectedSections) {
114
+ export async function computeStraightTenonSplit(mesh, planeNormal, planeDistance, planeCenter, widthDir, tenon, selectedSections) {
115
115
  const backend = await getBackend();
116
116
  const result = await backend.splitStraightTenon(mesh, {
117
117
  planeNormal,
118
- planeOriginOffset,
118
+ planeDistance,
119
119
  planeCenter,
120
120
  widthDir,
121
121
  tenon,
@@ -1 +1 @@
1
- {"version":3,"file":"csg-backend.js","sourceRoot":"","sources":["../../src/boolean/csg-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,eAAe;AAEf,IAAI,QAAQ,GAAsB,IAAI,CAAA;AAEtC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAmB;IAC/C,QAAQ,GAAG,OAAO,CAAA;AACpB,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,UAAU;IACvB,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAC7B,yB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\n * 提供 computeBoolean / computeSplit / computeDovetailSplit / computeDowelSplit / computeStraightTenonSplit\n * 等异步函数,与 csg.ts 的 API 一致。\n *\n * Node 环境:默认使用 InlineCsgBackend(主线程直跑 manifold-3d)。\n * 浏览器环境:通过 setCsgBackend() 注入 WorkerCsgBackend。\n *\n * F1 修复:不静态 import browser-host/inline-csg-backend(L1 不依赖 L3)。\n * 改为延迟动态 import,仅在未注入后端时按需加载。\n */\n\nimport type { CsgBackend } from '../cad-runtime/ports'\nimport type {\n ManifoldMeshData,\n BooleanOperation,\n DovetailGrooveParams,\n DowelSplitParams,\n StraightTenonSplitParams,\n} from './geo-convert'\n\n// ── 后端实例管理 ──\n\nlet _backend: CsgBackend | null = null\n\n/**\n * Inject the CSG backend used by the browser host (e.g. WorkerCsgBackend).\n * @param backend The backend instance to install as the current CSG backend.\n */\nexport function setCsgBackend(backend: CsgBackend): void {\n _backend = backend\n}\n\n/**\n * 获取当前 CSG 后端。\n * F1 修复:延迟动态 import InlineCsgBackend,避免 L1 静态依赖 L3。\n */\nasync function getBackend(): Promise<CsgBackend> {\n if (_backend) return _backend\n // 延迟加载——仅在实际需要时才拉入 L3 代码\n const { InlineCsgBackend } = await import('../browser-host/inline-csg-backend')\n _backend = new InlineCsgBackend()\n return _backend\n}\n\n// ── CSG 操作 API(与 csg.ts 签名一致)──\n\n/**\n * Apply a boolean operation across several meshes via the current backend.\n * @param meshes The input meshes to combine.\n * @param operation The boolean operation to perform (union/subtract/intersect).\n * @returns The resulting mesh of the boolean operation.\n */\nexport async function computeBoolean(\n meshes: ManifoldMeshData[],\n operation: BooleanOperation,\n): Promise<ManifoldMeshData> {\n const backend = await getBackend()\n return backend.boolean(operation, meshes)\n}\n\n/**\n * Split a mesh by a plane via the current backend.\n * @param mesh The mesh to split.\n * @param normal The plane normal (unit vector).\n * @param offset The plane offset along the normal.\n * @returns The front and back halves of the split.\n */\nexport async function computeSplit(\n mesh: ManifoldMeshData,\n normal: [number, number, number],\n offset: number,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData }> {\n const backend = await getBackend()\n const result = await backend.splitPlane(mesh, { normal, offset })\n return { front: result.front, back: result.back }\n}\n\n/**\n * Split a mesh by a plane and cut a dovetail groove via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeOriginOffset The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param bboxWidthOnWidthDir The model bounding-box width along the width direction.\n * @param groove The dovetail groove parameters.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeDovetailSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeOriginOffset: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n bboxWidthOnWidthDir: number,\n groove: DovetailGrooveParams,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitDovetail(mesh, {\n planeNormal,\n planeOriginOffset,\n planeCenter,\n widthDir,\n bboxWidthOnWidthDir,\n groove,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Split a mesh by a plane and cut dowel tenons via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeOriginOffset The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param dowel The dowel split parameters.\n * @param selectedSections Optional list of section indices to place tenons on.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeDowelSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeOriginOffset: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n dowel: DowelSplitParams,\n selectedSections?: number[] | null,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitDowel(mesh, {\n planeNormal,\n planeOriginOffset,\n planeCenter,\n widthDir,\n dowel,\n selectedSections,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Split a mesh by a plane and cut straight tenons via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeOriginOffset The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param tenon The straight-tenon split parameters.\n * @param selectedSections Optional list of section indices to place tenons on.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeStraightTenonSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeOriginOffset: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n tenon: StraightTenonSplitParams,\n selectedSections?: number[] | null,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitStraightTenon(mesh, {\n planeNormal,\n planeOriginOffset,\n planeCenter,\n widthDir,\n tenon,\n selectedSections,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Terminate the worker held by the backend, if any.\n * The InlineCsgBackend owns no worker to terminate; the WorkerCsgBackend\n * termination logic is managed by the browser host.\n */\nexport function terminateWorker(): void {\n // InlineCsgBackend has no worker to terminate\n // WorkerCsgBackend termination is managed by the browser host\n}\n\n// ── 纯函数重导出(从 geo-convert)──\n\nexport { geoToManifoldMesh, manifoldMeshToGeo } from './geo-convert'\n\n// ── 类型重导出 ──\n\nexport type {\n ManifoldMeshData,\n BooleanOperation,\n DovetailGrooveParams,\n DowelSplitParams,\n StraightTenonSplitParams,\n} from './geo-convert'\n"]}
1
+ {"version":3,"file":"csg-backend.js","sourceRoot":"","sources":["../../src/boolean/csg-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,eAAe;AAEf,IAAI,QAAQ,GAAsB,IAAI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AM,UAAU,eAAe;IAC7B,8CAA8C;IAC9C,8DAA8D;AAChE,CAAC;AAED,6BAA6B;AAE7B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA","sourcesContent":["/**\n * csg-backend — 可注入的 CSG 后端\n *\n * 提供 computeBoolean / computeSplit / computeDovetailSplit / computeDowelSplit / computeStraightTenonSplit\n * 等异步函数,与 csg.ts 的 API 一致。\n *\n * Node 环境:默认使用 InlineCsgBackend(主线程直跑 manifold-3d)。\n * 浏览器环境:通过 setCsgBackend() 注入 WorkerCsgBackend。\n *\n * F1 修复:不静态 import browser-host/inline-csg-backend(L1 不依赖 L3)。\n * 改为延迟动态 import,仅在未注入后端时按需加载。\n */\n\nimport type { CsgBackend } from '../cad-runtime/ports'\nimport type {\n ManifoldMeshData,\n BooleanOperation,\n DovetailGrooveParams,\n DowelSplitParams,\n StraightTenonSplitParams,\n} from './geo-convert'\n\n// ── 后端实例管理 ──\n\nlet _backend: CsgBackend | null = null\n\n/**\n * Inject the CSG backend used by the browser host (e.g. WorkerCsgBackend).\n * @param backend The backend instance to install as the current CSG backend.\n */\nexport function setCsgBackend(backend: CsgBackend): void {\n _backend = backend\n}\n\n/**\n * 获取当前 CSG 后端。\n * F1 修复:延迟动态 import InlineCsgBackend,避免 L1 静态依赖 L3。\n */\nasync function getBackend(): Promise<CsgBackend> {\n if (_backend) return _backend\n // 延迟加载——仅在实际需要时才拉入 L3 代码\n const { InlineCsgBackend } = await import('../browser-host/inline-csg-backend')\n _backend = new InlineCsgBackend()\n return _backend\n}\n\n// ── CSG 操作 API(与 csg.ts 签名一致)──\n\n/**\n * Apply a boolean operation across several meshes via the current backend.\n * @param meshes The input meshes to combine.\n * @param operation The boolean operation to perform (union/subtract/intersect).\n * @returns The resulting mesh of the boolean operation.\n */\nexport async function computeBoolean(\n meshes: ManifoldMeshData[],\n operation: BooleanOperation,\n): Promise<ManifoldMeshData> {\n const backend = await getBackend()\n return backend.boolean(operation, meshes)\n}\n\n/**\n * Split a mesh by a plane via the current backend.\n * @param mesh The mesh to split.\n * @param normal The plane normal (unit vector).\n * @param offset The plane offset along the normal.\n * @returns The front and back halves of the split.\n */\nexport async function computeSplit(\n mesh: ManifoldMeshData,\n normal: [number, number, number],\n offset: number,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData }> {\n const backend = await getBackend()\n const result = await backend.splitPlane(mesh, { normal, offset })\n return { front: result.front, back: result.back }\n}\n\n/**\n * Split a mesh by a plane and cut a dovetail groove via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeDistance The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param bboxWidthOnWidthDir The model bounding-box width along the width direction.\n * @param groove The dovetail groove parameters.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeDovetailSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeDistance: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n bboxWidthOnWidthDir: number,\n groove: DovetailGrooveParams,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitDovetail(mesh, {\n planeNormal,\n planeDistance,\n planeCenter,\n widthDir,\n bboxWidthOnWidthDir,\n groove,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Split a mesh by a plane and cut dowel tenons via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeDistance The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param dowel The dowel split parameters.\n * @param selectedSections Optional list of section indices to place tenons on.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeDowelSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeDistance: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n dowel: DowelSplitParams,\n selectedSections?: number[] | null,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitDowel(mesh, {\n planeNormal,\n planeDistance,\n planeCenter,\n widthDir,\n dowel,\n selectedSections,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Split a mesh by a plane and cut straight tenons via the current backend.\n * @param mesh The mesh to split.\n * @param planeNormal The cutting plane normal (unit vector).\n * @param planeDistance The cutting plane offset along the normal.\n * @param planeCenter A point on the cutting plane.\n * @param widthDir The width direction within the cutting plane (unit vector).\n * @param tenon The straight-tenon split parameters.\n * @param selectedSections Optional list of section indices to place tenons on.\n * @returns The front/back halves plus the wedge mesh (or null when no wedge).\n */\nexport async function computeStraightTenonSplit(\n mesh: ManifoldMeshData,\n planeNormal: [number, number, number],\n planeDistance: number,\n planeCenter: [number, number, number],\n widthDir: [number, number, number],\n tenon: StraightTenonSplitParams,\n selectedSections?: number[] | null,\n): Promise<{ front: ManifoldMeshData; back: ManifoldMeshData; wedge: ManifoldMeshData | null }> {\n const backend = await getBackend()\n const result = await backend.splitStraightTenon(mesh, {\n planeNormal,\n planeDistance,\n planeCenter,\n widthDir,\n tenon,\n selectedSections,\n })\n return { front: result.front, back: result.back, wedge: result.wedge }\n}\n\n/**\n * Terminate the worker held by the backend, if any.\n * The InlineCsgBackend owns no worker to terminate; the WorkerCsgBackend\n * termination logic is managed by the browser host.\n */\nexport function terminateWorker(): void {\n // InlineCsgBackend has no worker to terminate\n // WorkerCsgBackend termination is managed by the browser host\n}\n\n// ── 纯函数重导出(从 geo-convert)──\n\nexport { geoToManifoldMesh, manifoldMeshToGeo } from './geo-convert'\n\n// ── 类型重导出 ──\n\nexport type {\n ManifoldMeshData,\n BooleanOperation,\n DovetailGrooveParams,\n DowelSplitParams,\n StraightTenonSplitParams,\n} from './geo-convert'\n"]}
@@ -95,38 +95,38 @@ export declare function createWedge(Manifold: ManifoldCtor, Mesh: MeshCtor, plan
95
95
  * Returns an array of components, each being a Set of vertex indices.
96
96
  * @param upper The upper mesh to scan for cap faces.
97
97
  * @param normal The cutting plane normal.
98
- * @param originOffset The cutting plane offset along the normal.
98
+ * @param planeDistance The cutting plane offset along the normal.
99
99
  * @returns An array of components, each a Set of vertex indices on the cap.
100
100
  */
101
- export declare function detectCapComponents(upper: ManifoldInstance, normal: Vec3, originOffset: number): Set<number>[];
101
+ export declare function detectCapComponents(upper: ManifoldInstance, normal: Vec3, planeDistance: number): Set<number>[];
102
102
  /**
103
103
  * Compute the actual extent of the model's cross-section at the cutting plane
104
104
  * along the width direction.
105
105
  * @param upper The upper mesh to measure.
106
106
  * @param normal The cutting plane normal.
107
- * @param originOffset The cutting plane offset along the normal.
107
+ * @param planeDistance The cutting plane offset along the normal.
108
108
  * @param widthDir The width direction along which to measure.
109
109
  * @param comp Optional connected component to restrict the measurement to.
110
110
  * @returns The cross-section extent along the width direction (0 when none found).
111
111
  */
112
- export declare function computeCrossSectionWidth(upper: ManifoldInstance, normal: Vec3, originOffset: number, widthDir: Vec3, comp?: Set<number>): number;
112
+ export declare function computeCrossSectionWidth(upper: ManifoldInstance, normal: Vec3, planeDistance: number, widthDir: Vec3, comp?: Set<number>): number;
113
113
  /**
114
114
  * Compute the centroid of vertices lying on the cutting plane.
115
115
  * @param upper The upper mesh to scan.
116
116
  * @param normal The cutting plane normal.
117
- * @param originOffset The cutting plane offset along the normal.
117
+ * @param planeDistance The cutting plane offset along the normal.
118
118
  * @param fallback The centroid fallback when no vertex lies on the plane.
119
119
  * @param comp Optional connected component to restrict the measurement to.
120
120
  * @returns The computed centroid, or the fallback when none is found.
121
121
  */
122
- export declare function computeCrossSectionCentroid(upper: ManifoldInstance, normal: Vec3, originOffset: number, fallback: Vec3, comp?: Set<number>): Vec3;
122
+ export declare function computeCrossSectionCentroid(upper: ManifoldInstance, normal: Vec3, planeDistance: number, fallback: Vec3, comp?: Set<number>): Vec3;
123
123
  /**
124
124
  * Perform the dovetail split using boolean operations.
125
125
  * @param Manifold - the Manifold constructor from the manifold module.
126
126
  * @param Mesh - the Mesh constructor from the manifold module.
127
127
  * @param original - the original manifold to split.
128
128
  * @param normal - the cutting plane normal (unit vector).
129
- * @param originOffset - the plane equation origin offset along the normal.
129
+ * @param planeDistance - the plane equation origin offset along the normal.
130
130
  * @param planeCenter - a point on the cutting plane used to center the wedge.
131
131
  * @param widthDirInput - the width direction in the cutting plane (will be normalized).
132
132
  * @param bboxWidthOnWidthDir - the model's bounding-box width along widthDir, used as a fallback cross-section width.
@@ -134,7 +134,7 @@ export declare function computeCrossSectionCentroid(upper: ManifoldInstance, nor
134
134
  * @param keepOriginal - when true, the original manifold is not deleted after splitting (default false).
135
135
  * @returns a tuple of the split upper manifold, lower manifold, and the trimmed wedge mesh data (or null when empty).
136
136
  */
137
- export declare function dovetailBooleanSplit(Manifold: ManifoldCtor, Mesh: MeshCtor, original: ManifoldInstance, normal: Vec3, originOffset: number, planeCenter: Vec3, widthDirInput: Vec3, bboxWidthOnWidthDir: number, groove: {
137
+ export declare function dovetailBooleanSplit(Manifold: ManifoldCtor, Mesh: MeshCtor, original: ManifoldInstance, normal: Vec3, planeDistance: number, planeCenter: Vec3, widthDirInput: Vec3, bboxWidthOnWidthDir: number, groove: {
138
138
  depth: number;
139
139
  depthTolerance: number;
140
140
  width: number;
@@ -181,7 +181,7 @@ export declare function createStraightTenon(Manifold: ManifoldCtor, Mesh: MeshCt
181
181
  * @param Mesh - the Mesh constructor from the manifold module.
182
182
  * @param original - the original manifold to split.
183
183
  * @param normal - the cutting plane normal (unit vector).
184
- * @param originOffset - the plane equation origin offset along the normal.
184
+ * @param planeDistance - the plane equation origin offset along the normal.
185
185
  * @param planeCenter - a point on the cutting plane used to center the joinery.
186
186
  * @param widthDirInput - the width direction in the cutting plane (will be normalized).
187
187
  * @param shape - the joinery shape: 'dowel' or 'tenon'.
@@ -190,7 +190,7 @@ export declare function createStraightTenon(Manifold: ManifoldCtor, Mesh: MeshCt
190
190
  * @param selectedSections - optional list of indices selecting which cap sections receive joinery placement; null or empty means a single placement at the overall cross-section centroid.
191
191
  * @returns a tuple of the split upper manifold, lower manifold, and the generated joinery mesh data (or null).
192
192
  */
193
- export declare function dowelOrTenonBooleanSplit(Manifold: ManifoldCtor, Mesh: MeshCtor, original: ManifoldInstance, normal: Vec3, originOffset: number, planeCenter: Vec3, widthDirInput: Vec3, shape: 'dowel' | 'tenon', params: {
193
+ export declare function dowelOrTenonBooleanSplit(Manifold: ManifoldCtor, Mesh: MeshCtor, original: ManifoldInstance, normal: Vec3, planeDistance: number, planeCenter: Vec3, widthDirInput: Vec3, shape: 'dowel' | 'tenon', params: {
194
194
  size: number;
195
195
  sizeTolerance: number;
196
196
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"csg-core.d.ts","sourceRoot":"","sources":["../../src/boolean/csg-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAEL,KAAK,IAAI,EACV,MAAM,iBAAiB,CAAA;AASxB,KAAK,YAAY,GAAG,cAAc,sBAAsB,EAAE,QAAQ,CAAA;AAClE,KAAK,QAAQ,GAAG,cAAc,sBAAsB,EAAE,IAAI,CAAA;AAI1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG;IAC9D,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAC9C,CAeA;AAID;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GACtD,gBAAgB,CAiBlB;AAED;;;;;;GA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AAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAW,GACpB,gBAAgB,CAUlB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,IAAI,EACd,MAAM,EAAE,IAAI,EACZ,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,IAAI,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,gBAAgB,CAUlB;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,IAAI,EACZ,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,IAAI,EACjB,aAAa,EAAE,IAAI,EACnB,KAAK,EAAE,OAAO,GAAG,OAAO,EACxB,MAAM,EAAE;IACN,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;CACxB,EACD,YAAY,GAAE,OAAe,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,GACjC;IAAC,gBAAgB;IAAE,gBAAgB;IAClC;QAAE,SAAS,EAAE,YAAY,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI;CAAC,CA2G5D"}
@@ -201,10 +201,10 @@ export function createWedge(Manifold, Mesh, planeCenter, normal, widthDir, depth
201
201
  * Returns an array of components, each being a Set of vertex indices.
202
202
  * @param upper The upper mesh to scan for cap faces.
203
203
  * @param normal The cutting plane normal.
204
- * @param originOffset The cutting plane offset along the normal.
204
+ * @param planeDistance The cutting plane offset along the normal.
205
205
  * @returns An array of components, each a Set of vertex indices on the cap.
206
206
  */
207
- export function detectCapComponents(upper, normal, originOffset) {
207
+ export function detectCapComponents(upper, normal, planeDistance) {
208
208
  const mesh = upper.getMesh();
209
209
  const eps = 0.001;
210
210
  const numProp = mesh.numProp || 3;
@@ -221,13 +221,13 @@ export function detectCapComponents(upper, normal, originOffset) {
221
221
  const i2 = triVerts[t * 3 + 2];
222
222
  const d0 = Math.abs(mesh.vertProperties[i0 * numProp] * normal[0] +
223
223
  mesh.vertProperties[i0 * numProp + 1] * normal[1] +
224
- mesh.vertProperties[i0 * numProp + 2] * normal[2] - originOffset);
224
+ mesh.vertProperties[i0 * numProp + 2] * normal[2] - planeDistance);
225
225
  const d1 = Math.abs(mesh.vertProperties[i1 * numProp] * normal[0] +
226
226
  mesh.vertProperties[i1 * numProp + 1] * normal[1] +
227
- mesh.vertProperties[i1 * numProp + 2] * normal[2] - originOffset);
227
+ mesh.vertProperties[i1 * numProp + 2] * normal[2] - planeDistance);
228
228
  const d2 = Math.abs(mesh.vertProperties[i2 * numProp] * normal[0] +
229
229
  mesh.vertProperties[i2 * numProp + 1] * normal[1] +
230
- mesh.vertProperties[i2 * numProp + 2] * normal[2] - originOffset);
230
+ mesh.vertProperties[i2 * numProp + 2] * normal[2] - planeDistance);
231
231
  if (d0 < eps && d1 < eps && d2 < eps) {
232
232
  capTris.push({ v0: i0, v1: i1, v2: i2 });
233
233
  capVertSet.add(i0);
@@ -258,12 +258,12 @@ export function detectCapComponents(upper, normal, originOffset) {
258
258
  * along the width direction.
259
259
  * @param upper The upper mesh to measure.
260
260
  * @param normal The cutting plane normal.
261
- * @param originOffset The cutting plane offset along the normal.
261
+ * @param planeDistance The cutting plane offset along the normal.
262
262
  * @param widthDir The width direction along which to measure.
263
263
  * @param comp Optional connected component to restrict the measurement to.
264
264
  * @returns The cross-section extent along the width direction (0 when none found).
265
265
  */
266
- export function computeCrossSectionWidth(upper, normal, originOffset, widthDir, comp) {
266
+ export function computeCrossSectionWidth(upper, normal, planeDistance, widthDir, comp) {
267
267
  const mesh = upper.getMesh();
268
268
  const eps = 0.001;
269
269
  let minProj = Infinity;
@@ -278,7 +278,7 @@ export function computeCrossSectionWidth(upper, normal, originOffset, widthDir,
278
278
  const x = mesh.vertProperties[base];
279
279
  const y = mesh.vertProperties[base + 1];
280
280
  const z = mesh.vertProperties[base + 2];
281
- const dist = x * normal[0] + y * normal[1] + z * normal[2] - originOffset;
281
+ const dist = x * normal[0] + y * normal[1] + z * normal[2] - planeDistance;
282
282
  if (Math.abs(dist) < eps) {
283
283
  const proj = x * widthDir[0] + y * widthDir[1] + z * widthDir[2];
284
284
  if (proj < minProj)
@@ -297,12 +297,12 @@ export function computeCrossSectionWidth(upper, normal, originOffset, widthDir,
297
297
  * Compute the centroid of vertices lying on the cutting plane.
298
298
  * @param upper The upper mesh to scan.
299
299
  * @param normal The cutting plane normal.
300
- * @param originOffset The cutting plane offset along the normal.
300
+ * @param planeDistance The cutting plane offset along the normal.
301
301
  * @param fallback The centroid fallback when no vertex lies on the plane.
302
302
  * @param comp Optional connected component to restrict the measurement to.
303
303
  * @returns The computed centroid, or the fallback when none is found.
304
304
  */
305
- export function computeCrossSectionCentroid(upper, normal, originOffset, fallback, comp) {
305
+ export function computeCrossSectionCentroid(upper, normal, planeDistance, fallback, comp) {
306
306
  const mesh = upper.getMesh();
307
307
  const eps = 0.001;
308
308
  let cx = 0, cy = 0, cz = 0;
@@ -316,7 +316,7 @@ export function computeCrossSectionCentroid(upper, normal, originOffset, fallbac
316
316
  const x = mesh.vertProperties[base];
317
317
  const y = mesh.vertProperties[base + 1];
318
318
  const z = mesh.vertProperties[base + 2];
319
- const dist = x * normal[0] + y * normal[1] + z * normal[2] - originOffset;
319
+ const dist = x * normal[0] + y * normal[1] + z * normal[2] - planeDistance;
320
320
  if (Math.abs(dist) < eps) {
321
321
  cx += x;
322
322
  cy += y;
@@ -335,7 +335,7 @@ export function computeCrossSectionCentroid(upper, normal, originOffset, fallbac
335
335
  * @param Mesh - the Mesh constructor from the manifold module.
336
336
  * @param original - the original manifold to split.
337
337
  * @param normal - the cutting plane normal (unit vector).
338
- * @param originOffset - the plane equation origin offset along the normal.
338
+ * @param planeDistance - the plane equation origin offset along the normal.
339
339
  * @param planeCenter - a point on the cutting plane used to center the wedge.
340
340
  * @param widthDirInput - the width direction in the cutting plane (will be normalized).
341
341
  * @param bboxWidthOnWidthDir - the model's bounding-box width along widthDir, used as a fallback cross-section width.
@@ -343,14 +343,14 @@ export function computeCrossSectionCentroid(upper, normal, originOffset, fallbac
343
343
  * @param keepOriginal - when true, the original manifold is not deleted after splitting (default false).
344
344
  * @returns a tuple of the split upper manifold, lower manifold, and the trimmed wedge mesh data (or null when empty).
345
345
  */
346
- export function dovetailBooleanSplit(Manifold, Mesh, original, normal, originOffset, planeCenter, widthDirInput, bboxWidthOnWidthDir, groove, keepOriginal = false) {
346
+ export function dovetailBooleanSplit(Manifold, Mesh, original, normal, planeDistance, planeCenter, widthDirInput, bboxWidthOnWidthDir, groove, keepOriginal = false) {
347
347
  const widthDir = vec3Normalize(widthDirInput);
348
348
  // Step 1: Split by plane → upper + lower
349
- const [upper, lower] = original.splitByPlane(normal, originOffset);
349
+ const [upper, lower] = original.splitByPlane(normal, planeDistance);
350
350
  if (!keepOriginal)
351
351
  original.delete();
352
352
  // Step 2: Compute actual cross-section width at the cutting plane
353
- let crossSectionWidth = computeCrossSectionWidth(upper, normal, originOffset, widthDir);
353
+ let crossSectionWidth = computeCrossSectionWidth(upper, normal, planeDistance, widthDir);
354
354
  if (crossSectionWidth <= 0) {
355
355
  crossSectionWidth = bboxWidthOnWidthDir;
356
356
  }
@@ -466,7 +466,7 @@ export function createStraightTenon(Manifold, Mesh, centroid, normal, widthDir,
466
466
  * @param Mesh - the Mesh constructor from the manifold module.
467
467
  * @param original - the original manifold to split.
468
468
  * @param normal - the cutting plane normal (unit vector).
469
- * @param originOffset - the plane equation origin offset along the normal.
469
+ * @param planeDistance - the plane equation origin offset along the normal.
470
470
  * @param planeCenter - a point on the cutting plane used to center the joinery.
471
471
  * @param widthDirInput - the width direction in the cutting plane (will be normalized).
472
472
  * @param shape - the joinery shape: 'dowel' or 'tenon'.
@@ -475,25 +475,25 @@ export function createStraightTenon(Manifold, Mesh, centroid, normal, widthDir,
475
475
  * @param selectedSections - optional list of indices selecting which cap sections receive joinery placement; null or empty means a single placement at the overall cross-section centroid.
476
476
  * @returns a tuple of the split upper manifold, lower manifold, and the generated joinery mesh data (or null).
477
477
  */
478
- export function dowelOrTenonBooleanSplit(Manifold, Mesh, original, normal, originOffset, planeCenter, widthDirInput, shape, params, keepOriginal = false, selectedSections) {
478
+ export function dowelOrTenonBooleanSplit(Manifold, Mesh, original, normal, planeDistance, planeCenter, widthDirInput, shape, params, keepOriginal = false, selectedSections) {
479
479
  const widthDir = vec3Normalize(widthDirInput);
480
480
  const depthDir = vec3Normalize(vec3Cross(normal, widthDir));
481
481
  // Step 1: Split by plane → upper + lower
482
- const [upper, lower] = original.splitByPlane(normal, originOffset);
482
+ const [upper, lower] = original.splitByPlane(normal, planeDistance);
483
483
  if (!keepOriginal)
484
484
  original.delete();
485
485
  // Step 2: Detect cap components (multi-section support)
486
- const components = detectCapComponents(upper, normal, originOffset);
486
+ const components = detectCapComponents(upper, normal, planeDistance);
487
487
  let placements;
488
488
  if (components.length <= 1 || !selectedSections || selectedSections.length === 0) {
489
- const centroid = computeCrossSectionCentroid(upper, normal, originOffset, planeCenter);
489
+ const centroid = computeCrossSectionCentroid(upper, normal, planeDistance, planeCenter);
490
490
  placements = [{ centroid }];
491
491
  }
492
492
  else {
493
493
  const compInfo = components.map((comp, idx) => {
494
- const compWidth = computeCrossSectionWidth(upper, normal, originOffset, widthDir, comp);
495
- const compCentroid = computeCrossSectionCentroid(upper, normal, originOffset, planeCenter, comp);
496
- const compDepth = computeCrossSectionWidth(upper, normal, originOffset, depthDir, comp);
494
+ const compWidth = computeCrossSectionWidth(upper, normal, planeDistance, widthDir, comp);
495
+ const compCentroid = computeCrossSectionCentroid(upper, normal, planeDistance, planeCenter, comp);
496
+ const compDepth = computeCrossSectionWidth(upper, normal, planeDistance, depthDir, comp);
497
497
  const area = compWidth * compDepth;
498
498
  return { idx, comp, area, centroid: compCentroid };
499
499
  });
@@ -505,7 +505,7 @@ export function dowelOrTenonBooleanSplit(Manifold, Mesh, original, normal, origi
505
505
  }
506
506
  }
507
507
  if (placements.length === 0) {
508
- const centroid = computeCrossSectionCentroid(upper, normal, originOffset, planeCenter);
508
+ const centroid = computeCrossSectionCentroid(upper, normal, planeDistance, planeCenter);
509
509
  placements = [{ centroid }];
510
510
  }
511
511
  }