@faicad/faijs 0.18.3 → 0.22.2

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 (241) 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 +22 -20
  7. package/dist/api/brep-mirror/joinery-brep.js.map +1 -1
  8. package/dist/api/generated/script-face-manifest.d.ts +4 -0
  9. package/dist/api/generated/script-face-manifest.d.ts.map +1 -1
  10. package/dist/api/generated/script-face-manifest.js.map +1 -1
  11. package/dist/api/index.d.ts +4 -0
  12. package/dist/api/index.d.ts.map +1 -1
  13. package/dist/api/index.js +3 -0
  14. package/dist/api/index.js.map +1 -1
  15. package/dist/api/knurl.d.ts.map +1 -1
  16. package/dist/api/knurl.js +1 -0
  17. package/dist/api/knurl.js.map +1 -1
  18. package/dist/api/primitives.d.ts +4 -3
  19. package/dist/api/primitives.d.ts.map +1 -1
  20. package/dist/api/primitives.js +9 -3
  21. package/dist/api/primitives.js.map +1 -1
  22. package/dist/api/profile.d.ts +34 -5
  23. package/dist/api/profile.d.ts.map +1 -1
  24. package/dist/api/profile.js +168 -186
  25. package/dist/api/profile.js.map +1 -1
  26. package/dist/api/punch-hole.d.ts +77 -0
  27. package/dist/api/punch-hole.d.ts.map +1 -0
  28. package/dist/api/punch-hole.js +207 -0
  29. package/dist/api/punch-hole.js.map +1 -0
  30. package/dist/api/sketch-on-face.d.ts +85 -0
  31. package/dist/api/sketch-on-face.d.ts.map +1 -0
  32. package/dist/api/sketch-on-face.js +136 -0
  33. package/dist/api/sketch-on-face.js.map +1 -0
  34. package/dist/api/sketch-on-plane.d.ts +87 -0
  35. package/dist/api/sketch-on-plane.d.ts.map +1 -0
  36. package/dist/api/sketch-on-plane.js +106 -0
  37. package/dist/api/sketch-on-plane.js.map +1 -0
  38. package/dist/api/surface/arg-spec.d.ts +8 -0
  39. package/dist/api/surface/arg-spec.d.ts.map +1 -1
  40. package/dist/api/surface/arg-spec.js.map +1 -1
  41. package/dist/api/transform.d.ts +5 -5
  42. package/dist/api/transform.d.ts.map +1 -1
  43. package/dist/api/transform.js +12 -10
  44. package/dist/api/transform.js.map +1 -1
  45. package/dist/api/xml-dom.d.ts +27 -0
  46. package/dist/api/xml-dom.d.ts.map +1 -0
  47. package/dist/api/xml-dom.js +45 -0
  48. package/dist/api/xml-dom.js.map +1 -0
  49. package/dist/boolean/csg-backend.d.ts +6 -6
  50. package/dist/boolean/csg-backend.d.ts.map +1 -1
  51. package/dist/boolean/csg-backend.js +9 -9
  52. package/dist/boolean/csg-backend.js.map +1 -1
  53. package/dist/boolean/csg-core.d.ts +10 -10
  54. package/dist/boolean/csg-core.d.ts.map +1 -1
  55. package/dist/boolean/csg-core.js +24 -24
  56. package/dist/boolean/csg-core.js.map +1 -1
  57. package/dist/boolean/extrude-helpers.d.ts +8 -8
  58. package/dist/boolean/extrude-helpers.d.ts.map +1 -1
  59. package/dist/boolean/extrude-helpers.js +13 -13
  60. package/dist/boolean/extrude-helpers.js.map +1 -1
  61. package/dist/brep/brep-ops.d.ts +24 -10
  62. package/dist/brep/brep-ops.d.ts.map +1 -1
  63. package/dist/brep/brep-ops.js +46 -18
  64. package/dist/brep/brep-ops.js.map +1 -1
  65. package/dist/brep/brep-topology.d.ts.map +1 -1
  66. package/dist/brep/brep-topology.js +3 -1
  67. package/dist/brep/brep-topology.js.map +1 -1
  68. package/dist/brep/export/export-model.d.ts +79 -0
  69. package/dist/brep/export/export-model.d.ts.map +1 -0
  70. package/dist/brep/export/export-model.js +335 -0
  71. package/dist/brep/export/export-model.js.map +1 -0
  72. package/dist/brep/primitives-brep.d.ts.map +1 -1
  73. package/dist/brep/primitives-brep.js +3 -1
  74. package/dist/brep/primitives-brep.js.map +1 -1
  75. package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
  76. package/dist/brepkit-kernel/brepkitKernel.js +4 -2
  77. package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
  78. package/dist/browser-host/csg-worker-protocol.d.ts +3 -3
  79. package/dist/browser-host/csg-worker-protocol.d.ts.map +1 -1
  80. package/dist/browser-host/csg-worker-protocol.js.map +1 -1
  81. package/dist/browser-host/csg-worker.js +3 -3
  82. package/dist/browser-host/csg-worker.js.map +1 -1
  83. package/dist/browser-host/inline-csg-backend.d.ts +3 -3
  84. package/dist/browser-host/inline-csg-backend.d.ts.map +1 -1
  85. package/dist/browser-host/inline-csg-backend.js +3 -3
  86. package/dist/browser-host/inline-csg-backend.js.map +1 -1
  87. package/dist/browser-host/worker-csg-backend.d.ts +3 -3
  88. package/dist/browser-host/worker-csg-backend.d.ts.map +1 -1
  89. package/dist/browser-host/worker-csg-backend.js.map +1 -1
  90. package/dist/cad-runtime/direct-executor.d.ts +4 -0
  91. package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
  92. package/dist/cad-runtime/direct-executor.js +17 -1
  93. package/dist/cad-runtime/direct-executor.js.map +1 -1
  94. package/dist/cad-runtime/ports.d.ts +3 -3
  95. package/dist/cad-runtime/ports.d.ts.map +1 -1
  96. package/dist/cad-runtime/ports.js.map +1 -1
  97. package/dist/cad-runtime/runtime.d.ts +24 -1
  98. package/dist/cad-runtime/runtime.d.ts.map +1 -1
  99. package/dist/cad-runtime/runtime.js +53 -3
  100. package/dist/cad-runtime/runtime.js.map +1 -1
  101. package/dist/define-op.d.ts +22 -0
  102. package/dist/define-op.d.ts.map +1 -1
  103. package/dist/define-op.js +15 -0
  104. package/dist/define-op.js.map +1 -1
  105. package/dist/env-agnostic.d.ts +7 -7
  106. package/dist/env-agnostic.d.ts.map +1 -1
  107. package/dist/env-agnostic.js +3 -3
  108. package/dist/env-agnostic.js.map +1 -1
  109. package/dist/geometry2d/adapt.d.ts +46 -0
  110. package/dist/geometry2d/adapt.d.ts.map +1 -0
  111. package/dist/geometry2d/adapt.js +41 -0
  112. package/dist/geometry2d/adapt.js.map +1 -0
  113. package/dist/geometry2d/bbox2d.d.ts +82 -0
  114. package/dist/geometry2d/bbox2d.d.ts.map +1 -0
  115. package/dist/geometry2d/bbox2d.js +123 -0
  116. package/dist/geometry2d/bbox2d.js.map +1 -0
  117. package/dist/geometry2d/blueprint-sketcher.d.ts +27 -0
  118. package/dist/geometry2d/blueprint-sketcher.d.ts.map +1 -0
  119. package/dist/geometry2d/blueprint-sketcher.js +29 -0
  120. package/dist/geometry2d/blueprint-sketcher.js.map +1 -0
  121. package/dist/geometry2d/blueprint.d.ts +102 -0
  122. package/dist/geometry2d/blueprint.d.ts.map +1 -0
  123. package/dist/geometry2d/blueprint.js +225 -0
  124. package/dist/geometry2d/blueprint.js.map +1 -0
  125. package/dist/geometry2d/blueprints.d.ts +58 -0
  126. package/dist/geometry2d/blueprints.d.ts.map +1 -0
  127. package/dist/geometry2d/blueprints.js +72 -0
  128. package/dist/geometry2d/blueprints.js.map +1 -0
  129. package/dist/geometry2d/bridge/lift-on-plane.d.ts +50 -0
  130. package/dist/geometry2d/bridge/lift-on-plane.d.ts.map +1 -0
  131. package/dist/geometry2d/bridge/lift-on-plane.js +78 -0
  132. package/dist/geometry2d/bridge/lift-on-plane.js.map +1 -0
  133. package/dist/geometry2d/bridge/on-surface.d.ts +98 -0
  134. package/dist/geometry2d/bridge/on-surface.d.ts.map +1 -0
  135. package/dist/geometry2d/bridge/on-surface.js +94 -0
  136. package/dist/geometry2d/bridge/on-surface.js.map +1 -0
  137. package/dist/geometry2d/bridge/plane.d.ts +69 -0
  138. package/dist/geometry2d/bridge/plane.d.ts.map +1 -0
  139. package/dist/geometry2d/bridge/plane.js +96 -0
  140. package/dist/geometry2d/bridge/plane.js.map +1 -0
  141. package/dist/geometry2d/canned-blueprints.d.ts +44 -0
  142. package/dist/geometry2d/canned-blueprints.d.ts.map +1 -0
  143. package/dist/geometry2d/canned-blueprints.js +94 -0
  144. package/dist/geometry2d/canned-blueprints.js.map +1 -0
  145. package/dist/geometry2d/compound-blueprint.d.ts +72 -0
  146. package/dist/geometry2d/compound-blueprint.d.ts.map +1 -0
  147. package/dist/geometry2d/compound-blueprint.js +95 -0
  148. package/dist/geometry2d/compound-blueprint.js.map +1 -0
  149. package/dist/geometry2d/curve2d.d.ts +298 -0
  150. package/dist/geometry2d/curve2d.d.ts.map +1 -0
  151. package/dist/geometry2d/curve2d.js +1110 -0
  152. package/dist/geometry2d/curve2d.js.map +1 -0
  153. package/dist/geometry2d/index.d.ts +22 -0
  154. package/dist/geometry2d/index.d.ts.map +1 -0
  155. package/dist/geometry2d/index.js +21 -0
  156. package/dist/geometry2d/index.js.map +1 -0
  157. package/dist/geometry2d/organise.d.ts +28 -0
  158. package/dist/geometry2d/organise.d.ts.map +1 -0
  159. package/dist/geometry2d/organise.js +108 -0
  160. package/dist/geometry2d/organise.js.map +1 -0
  161. package/dist/geometry2d/pen-sketcher.d.ts +365 -0
  162. package/dist/geometry2d/pen-sketcher.d.ts.map +1 -0
  163. package/dist/geometry2d/pen-sketcher.js +520 -0
  164. package/dist/geometry2d/pen-sketcher.js.map +1 -0
  165. package/dist/geometry2d/point.d.ts +44 -0
  166. package/dist/geometry2d/point.d.ts.map +1 -0
  167. package/dist/geometry2d/point.js +57 -0
  168. package/dist/geometry2d/point.js.map +1 -0
  169. package/dist/geometry2d/svg-ellipse.d.ts +74 -0
  170. package/dist/geometry2d/svg-ellipse.d.ts.map +1 -0
  171. package/dist/geometry2d/svg-ellipse.js +163 -0
  172. package/dist/geometry2d/svg-ellipse.js.map +1 -0
  173. package/dist/lang/code-to-args.d.ts +29 -3
  174. package/dist/lang/code-to-args.d.ts.map +1 -1
  175. package/dist/lang/code-to-args.js +41 -2
  176. package/dist/lang/code-to-args.js.map +1 -1
  177. package/dist/lang/codegen.d.ts +45 -1
  178. package/dist/lang/codegen.d.ts.map +1 -1
  179. package/dist/lang/codegen.js +135 -6
  180. package/dist/lang/codegen.js.map +1 -1
  181. package/dist/lang/host-arg.d.ts +6 -0
  182. package/dist/lang/host-arg.d.ts.map +1 -1
  183. package/dist/lang/host-arg.js.map +1 -1
  184. package/dist/lang/metadata-extractor.d.ts +25 -0
  185. package/dist/lang/metadata-extractor.d.ts.map +1 -1
  186. package/dist/lang/metadata-extractor.js +289 -25
  187. package/dist/lang/metadata-extractor.js.map +1 -1
  188. package/dist/lang/parse-error.d.ts +7 -1
  189. package/dist/lang/parse-error.d.ts.map +1 -1
  190. package/dist/lang/parse-error.js.map +1 -1
  191. package/dist/lang/security-scanner.d.ts +9 -1
  192. package/dist/lang/security-scanner.d.ts.map +1 -1
  193. package/dist/lang/security-scanner.js +38 -1
  194. package/dist/lang/security-scanner.js.map +1 -1
  195. package/dist/lang/symbol-table.generated.d.ts +3 -0
  196. package/dist/lang/symbol-table.generated.d.ts.map +1 -1
  197. package/dist/lang/symbol-table.generated.js +3 -0
  198. package/dist/lang/symbol-table.generated.js.map +1 -1
  199. package/dist/mesh/io.d.ts +62 -9
  200. package/dist/mesh/io.d.ts.map +1 -1
  201. package/dist/mesh/io.js +124 -17
  202. package/dist/mesh/io.js.map +1 -1
  203. package/dist/mesh/threemf-loader.d.ts +15 -0
  204. package/dist/mesh/threemf-loader.d.ts.map +1 -0
  205. package/dist/mesh/threemf-loader.js +163 -0
  206. package/dist/mesh/threemf-loader.js.map +1 -0
  207. package/dist/mesh/transform.d.ts +2 -2
  208. package/dist/mesh/transform.d.ts.map +1 -1
  209. package/dist/mesh/transform.js +3 -3
  210. package/dist/mesh/transform.js.map +1 -1
  211. package/dist/mesh/types.d.ts +2 -2
  212. package/dist/mesh/types.d.ts.map +1 -1
  213. package/dist/mesh/types.js.map +1 -1
  214. package/dist/node-host/cli.d.ts.map +1 -1
  215. package/dist/node-host/cli.js +53 -26
  216. package/dist/node-host/cli.js.map +1 -1
  217. package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
  218. package/dist/occt-kernel/occtKernel.js +4 -2
  219. package/dist/occt-kernel/occtKernel.js.map +1 -1
  220. package/dist/occt-kernel/topologyExt.d.ts.map +1 -1
  221. package/dist/occt-kernel/topologyExt.js +4 -1
  222. package/dist/occt-kernel/topologyExt.js.map +1 -1
  223. package/dist/runtime-state.d.ts +18 -0
  224. package/dist/runtime-state.d.ts.map +1 -1
  225. package/dist/runtime-state.js +23 -0
  226. package/dist/runtime-state.js.map +1 -1
  227. package/dist/sdk.d.ts +1 -1
  228. package/dist/sdk.d.ts.map +1 -1
  229. package/dist/sdk.js +1 -1
  230. package/dist/sdk.js.map +1 -1
  231. package/dist/tolerance.d.ts +38 -0
  232. package/dist/tolerance.d.ts.map +1 -0
  233. package/dist/tolerance.js +40 -0
  234. package/dist/tolerance.js.map +1 -0
  235. package/dist/topology/naming/score.js +3 -3
  236. package/dist/topology/naming/score.js.map +1 -1
  237. package/dist/units.d.ts +248 -0
  238. package/dist/units.d.ts.map +1 -0
  239. package/dist/units.js +397 -0
  240. package/dist/units.js.map +1 -0
  241. package/package.json +19 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane.js","sourceRoot":"","sources":["../../../src/geometry2d/bridge/plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,CAAY;IACjC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAA;IAC7D,MAAM,CAAC,GAAG,CAAS,CAAA;IACnB,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACnC,CAAC;AAiBD,SA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7C,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;AAC/F,CAAC","sourcesContent":["/**\n * Plane frame helpers for 2D→3D placement (pure TS, no kernel, no `api/` import).\n *\n * A {@link Plane} carries an origin plus a right-handed, orthonormal frame\n * `xDir / yDir / zDir` where `zDir` is the plane normal — the same semantic as\n * the kernel `gp_Ax3` frame and the `createPlane` helper in `api/brepjs-compat`.\n * The bridge may **not** import `api/` (plan rule against a cycle), so this\n * module re-derives the framing math self-containedly. Points use the\n * `{ x, y, z }` shape compatible with the BREP engine's neutral `BrepVec3`.\n * @module\n */\n\n/** A 3D point / vector (neutral {x,y,z} shape, kernel-compatible). */\nexport interface Vec3 {\n x: number\n y: number\n z: number\n}\n\n/** User-facing 3D input: `{x,y,z}` object or `[x,y,z]` array (the script form). */\nexport type Vec3Input = Vec3 | readonly [number, number, number]\n\n/**\n * Normalize a raw script- or API-facing 3D input to the canonical `{x,y,z}`.\n * Accepts both the array form (`[1,0,0]`, as produced by `.fai.js` literals)\n * and the object form (`{x,y,z}`, used by the bridge internals).\n * @param v - the input 3D value.\n * @returns the canonical vector.\n */\nexport function toVec3(v: Vec3Input): Vec3 {\n if (Array.isArray(v)) return { x: v[0]!, y: v[1]!, z: v[2]! }\n const o = v as Vec3\n return { x: o.x, y: o.y, z: o.z }\n}\n\n/**\n * A right-handed, orthonormal plane frame: an origin plus `xDir`/`yDir` (in-plane\n * axes) and `zDir` (the normal). 2D `(x, y)` maps to `origin + x*xDir + y*yDir`.\n */\nexport interface Plane {\n /** The plane's anchor point (the 2D origin maps here). */\n readonly origin: Vec3\n /** The in-plane X axis (maps the 2D +X). */\n readonly xDir: Vec3\n /** The in-plane Y axis (maps the 2D +Y). */\n readonly yDir: Vec3\n /** The plane normal (2D +Z after placement). */\n readonly zDir: Vec3\n}\n\nfunction cross(a: Vec3, b: Vec3): Vec3 {\n return { x: a.y * b.z - a.z * b.y, y: a.z * b.x - a.x * b.z, z: a.x * b.y - a.y * b.x }\n}\n\nfunction norm(v: Vec3): number {\n return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z)\n}\n\nfunction normalize(v: Vec3): Vec3 {\n const len = norm(v)\n return len > 1e-14 ? { x: v.x / len, y: v.y / len, z: v.z / len } : { x: 1, y: 0, z: 0 }\n}\n\n/**\n * Build a right-handed plane frame from an origin, a normal, and an optional\n * in-plane X direction. The X direction is auto-derived (least-aligned-axis\n * cross product) when omitted, mirroring the kernel `gp_Ax3` convention.\n * @param origin - the plane origin (2D origin maps here).\n * @param normal - the plane normal (becomes the zDir); must be non-zero.\n * @param xDir - optional explicit in-plane X; auto-derived when omitted.\n * @returns the orthonormal plane frame.\n */\nexport function makePlane(origin: Vec3Input, normal: Vec3Input, xDir?: Vec3Input): Plane {\n const o = toVec3(origin)\n const z = normalize(toVec3(normal))\n let x: Vec3\n if (xDir) {\n x = normalize(toVec3(xDir))\n } else {\n const ax = Math.abs(z.x), ay = Math.abs(z.y), az = Math.abs(z.z)\n const cand: Vec3 =\n ax <= ay && ax <= az ? { x: 1, y: 0, z: 0 } : ay <= az ? { x: 0, y: 1, z: 0 } : { x: 0, y: 0, z: 1 }\n x = normalize(cross(cand, z))\n }\n const y = normalize(cross(z, x))\n return { origin: o, xDir: x, yDir: y, zDir: z }\n}\n\n/** Named CAD planes with their canonical frames (origin defaults to [0,0,0]). */\nconst NAMED_PLANES: Record<string, { xDir: Vec3; zDir: Vec3 }> = {\n XY: { xDir: { x: 1, y: 0, z: 0 }, zDir: { x: 0, y: 0, z: 1 } },\n XZ: { xDir: { x: 1, y: 0, z: 0 }, zDir: { x: 0, y: -1, z: 0 } },\n YZ: { xDir: { x: 0, y: 1, z: 0 }, zDir: { x: 1, y: 0, z: 0 } },\n front: { xDir: { x: 1, y: 0, z: 0 }, zDir: { x: 0, y: 0, z: 1 } },\n back: { xDir: { x: -1, y: 0, z: 0 }, zDir: { x: 0, y: 0, z: -1 } },\n left: { xDir: { x: 0, y: 0, z: 1 }, zDir: { x: -1, y: 0, z: 0 } },\n right: { xDir: { x: 0, y: 0, z: -1 }, zDir: { x: 1, y: 0, z: 0 } },\n top: { xDir: { x: 1, y: 0, z: 0 }, zDir: { x: 0, y: 1, z: 0 } },\n bottom: { xDir: { x: 1, y: 0, z: 0 }, zDir: { x: 0, y: -1, z: 0 } },\n}\n\n/**\n * Resolve a named plane (e.g. `'XY'` / `'XZ'` / `'top'`) to a frame at a given\n * origin. Unknown names throw.\n * @param name - the canonical plane name.\n * @param origin - the plane origin (default [0,0,0]).\n * @returns the plane frame.\n */\nexport function namedPlane(name: string, origin: Vec3Input = { x: 0, y: 0, z: 0 }): Plane {\n const cfg = NAMED_PLANES[name]\n if (!cfg) throw new Error(`unknown plane '${name}' (expected XY | XZ | YZ | front/back/left/right/top/bottom)`)\n return makePlane(toVec3(origin), cfg.zDir, cfg.xDir)\n}\n\n/**\n * Map a 2D point `(x, y)` into 3D on a plane frame:\n * `origin + x*xDir + y*yDir`. This is the per-point lift used by curve lifting.\n * @param plane - the target plane.\n * @param x - the 2D `x` coordinate.\n * @param y - the 2D `y` coordinate.\n * @returns the 3D point on the plane.\n */\nexport function liftPointToPlane(plane: Plane, x: number, y: number): Vec3 {\n const { origin: o, xDir: u, yDir: v } = plane\n return { x: o.x + x * u.x + y * v.x, y: o.y + x * u.y + y * v.y, z: o.z + x * u.z + y * v.z }\n}"]}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * geometry2d — canned 2D shape factories that return `Blueprint`s (C2).
3
+ *
4
+ * Ported from brepjs `2d/blueprints/cannedBlueprints.ts` (Apache-2.0). Built on
5
+ * `BlueprintSketcher`; each result is a closed contour ready for placement.
6
+ *
7
+ * @module
8
+ */
9
+ import { Blueprint } from './blueprint.js';
10
+ /**
11
+ * Create a regular polygon Blueprint inscribed in a circle of the given radius.
12
+ * @param radius - circumscribed circle radius.
13
+ * @param sidesCount - number of sides (3 = triangle, 6 = hexagon).
14
+ * @param sagitta - when non-zero, sides become sagitta arcs (bulge height).
15
+ * @returns a closed `Blueprint` representing the polygon.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const hexagon = polysidesBlueprint(10, 6)
20
+ * const roundedTriangle = polysidesBlueprint(10, 3, 2)
21
+ * ```
22
+ */
23
+ export declare function polysidesBlueprint(radius: number, sidesCount: number, sagitta?: number): Blueprint;
24
+ /**
25
+ * Create an axis-aligned rectangle Blueprint (centered at the origin) with
26
+ * optional rounded corners.
27
+ * @param width - total width.
28
+ * @param height - total height.
29
+ * @param r - corner radius: a number for uniform rounding, or `{ rx, ry }`
30
+ * for elliptical corners. Clamped to half the respective dimension.
31
+ * @returns the closed Blueprint representing the rounded rectangle.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const sharp = roundedRectangleBlueprint(20, 10)
36
+ * const rounded = roundedRectangleBlueprint(20, 10, 3)
37
+ * const elliptical = roundedRectangleBlueprint(20, 10, { rx: 4, ry: 2 })
38
+ * ```
39
+ */
40
+ export declare function roundedRectangleBlueprint(width: number, height: number, r?: number | {
41
+ rx?: number;
42
+ ry?: number;
43
+ }): Blueprint;
44
+ //# sourceMappingURL=canned-blueprints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canned-blueprints.d.ts","sourceRoot":"","sources":["../../src/geometry2d/canned-blueprints.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAWvC;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,SAAS,CAa7F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,CAAC,GAAE,MAAM,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAM,GAC3C,SAAS,CAyBX"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * geometry2d — canned 2D shape factories that return `Blueprint`s (C2).
3
+ *
4
+ * Ported from brepjs `2d/blueprints/cannedBlueprints.ts` (Apache-2.0). Built on
5
+ * `BlueprintSketcher`; each result is a closed contour ready for placement.
6
+ *
7
+ * @module
8
+ */
9
+ import { BlueprintSketcher } from './blueprint-sketcher.js';
10
+ import { Blueprint } from './blueprint.js';
11
+ function lastOrThrow(items) {
12
+ const last = items[items.length - 1];
13
+ if (last === undefined)
14
+ throw new Error('[canned-blueprints] empty curve list');
15
+ return last;
16
+ }
17
+ /**
18
+ * Create a regular polygon Blueprint inscribed in a circle of the given radius.
19
+ * @param radius - circumscribed circle radius.
20
+ * @param sidesCount - number of sides (3 = triangle, 6 = hexagon).
21
+ * @param sagitta - when non-zero, sides become sagitta arcs (bulge height).
22
+ * @returns a closed `Blueprint` representing the polygon.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const hexagon = polysidesBlueprint(10, 6)
27
+ * const roundedTriangle = polysidesBlueprint(10, 3, 2)
28
+ * ```
29
+ */
30
+ export function polysidesBlueprint(radius, sidesCount, sagitta = 0) {
31
+ const points = [...Array(sidesCount).keys()].map((i) => {
32
+ const theta = -((Math.PI * 2) / sidesCount) * i;
33
+ return [radius * Math.sin(theta), radius * Math.cos(theta)];
34
+ });
35
+ const lastPoint = lastOrThrow(points);
36
+ const blueprint = new BlueprintSketcher().movePointerTo([lastPoint[0], lastPoint[1]]);
37
+ if (sagitta) {
38
+ points.forEach(([x, y]) => blueprint.sagittaArcTo([x, y], sagitta));
39
+ }
40
+ else {
41
+ points.forEach(([x, y]) => blueprint.lineTo([x, y]));
42
+ }
43
+ return blueprint.done();
44
+ }
45
+ /**
46
+ * Create an axis-aligned rectangle Blueprint (centered at the origin) with
47
+ * optional rounded corners.
48
+ * @param width - total width.
49
+ * @param height - total height.
50
+ * @param r - corner radius: a number for uniform rounding, or `{ rx, ry }`
51
+ * for elliptical corners. Clamped to half the respective dimension.
52
+ * @returns the closed Blueprint representing the rounded rectangle.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const sharp = roundedRectangleBlueprint(20, 10)
57
+ * const rounded = roundedRectangleBlueprint(20, 10, 3)
58
+ * const elliptical = roundedRectangleBlueprint(20, 10, { rx: 4, ry: 2 })
59
+ * ```
60
+ */
61
+ export function roundedRectangleBlueprint(width, height, r = 0) {
62
+ const { rx: inputRx = 0, ry: inputRy = 0 } = typeof r === 'number' ? { ry: r, rx: r } : r;
63
+ let rx = Math.min(inputRx, width / 2);
64
+ let ry = Math.min(inputRy, height / 2);
65
+ const withRadius = rx && ry;
66
+ if (!withRadius) {
67
+ rx = 0;
68
+ ry = 0;
69
+ }
70
+ const symmetricRadius = rx === ry;
71
+ const sk = new BlueprintSketcher([Math.min(0, -(width / 2 - rx)), -height / 2]);
72
+ const addFillet = (xDist, yDist) => {
73
+ if (!withRadius)
74
+ return;
75
+ if (symmetricRadius)
76
+ sk.tangentArc(xDist, yDist);
77
+ else
78
+ sk.ellipse(xDist, yDist, rx, ry, 0, false, true);
79
+ };
80
+ if (rx < width / 2)
81
+ sk.hLine(width - 2 * rx);
82
+ addFillet(rx, ry);
83
+ if (ry < height / 2)
84
+ sk.vLine(height - 2 * ry);
85
+ addFillet(-rx, ry);
86
+ if (rx < width / 2)
87
+ sk.hLine(-(width - 2 * rx));
88
+ addFillet(-rx, -ry);
89
+ if (ry < height / 2)
90
+ sk.vLine(-(height - 2 * ry));
91
+ addFillet(rx, -ry);
92
+ return new Blueprint(sk.close());
93
+ }
94
+ //# sourceMappingURL=canned-blueprints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canned-blueprints.js","sourceRoot":"","sources":["../../src/geometry2d/canned-blueprints.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAKvC,SAAS,WAAW,CAAI,KAAmB;IACzC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACpC,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IAC/E,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,UAAkB,EAAE,OAAO,GAAG,CAAC;IAChF,MAAM,MAAM,GAAS,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3D,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAC/C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7D,CAAC,CAAC,CAAA;IACF,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACrF,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM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epjs `2d/blueprints/cannedBlueprints.ts` (Apache-2.0). Built on\n * `BlueprintSketcher`; each result is a closed contour ready for placement.\n *\n * @module\n */\n\nimport { BlueprintSketcher } from './blueprint-sketcher'\nimport { Blueprint } from './blueprint'\n\n/** A point type local to this module. */\ntype Pt = readonly [number, number]\n\nfunction lastOrThrow<T>(items: readonly T[]): T {\n const last = items[items.length - 1]\n if (last === undefined) throw new Error('[canned-blueprints] empty curve list')\n return last\n}\n\n/**\n * Create a regular polygon Blueprint inscribed in a circle of the given radius.\n * @param radius - circumscribed circle radius.\n * @param sidesCount - number of sides (3 = triangle, 6 = hexagon).\n * @param sagitta - when non-zero, sides become sagitta arcs (bulge height).\n * @returns a closed `Blueprint` representing the polygon.\n *\n * @example\n * ```ts\n * const hexagon = polysidesBlueprint(10, 6)\n * const roundedTriangle = polysidesBlueprint(10, 3, 2)\n * ```\n */\nexport function polysidesBlueprint(radius: number, sidesCount: number, sagitta = 0): Blueprint {\n const points: Pt[] = [...Array(sidesCount).keys()].map((i) => {\n const theta = -((Math.PI * 2) / sidesCount) * i\n return [radius * Math.sin(theta), radius * Math.cos(theta)]\n })\n const lastPoint = lastOrThrow(points)\n const blueprint = new BlueprintSketcher().movePointerTo([lastPoint[0], lastPoint[1]])\n if (sagitta) {\n points.forEach(([x, y]) => blueprint.sagittaArcTo([x, y], sagitta))\n } else {\n points.forEach(([x, y]) => blueprint.lineTo([x, y]))\n }\n return blueprint.done()\n}\n\n/**\n * Create an axis-aligned rectangle Blueprint (centered at the origin) with\n * optional rounded corners.\n * @param width - total width.\n * @param height - total height.\n * @param r - corner radius: a number for uniform rounding, or `{ rx, ry }`\n * for elliptical corners. Clamped to half the respective dimension.\n * @returns the closed Blueprint representing the rounded rectangle.\n *\n * @example\n * ```ts\n * const sharp = roundedRectangleBlueprint(20, 10)\n * const rounded = roundedRectangleBlueprint(20, 10, 3)\n * const elliptical = roundedRectangleBlueprint(20, 10, { rx: 4, ry: 2 })\n * ```\n */\nexport function roundedRectangleBlueprint(\n width: number,\n height: number,\n r: number | { rx?: number; ry?: number } = 0,\n): Blueprint {\n const { rx: inputRx = 0, ry: inputRy = 0 } = typeof r === 'number' ? { ry: r, rx: r } : r\n let rx = Math.min(inputRx, width / 2)\n let ry = Math.min(inputRy, height / 2)\n const withRadius = rx && ry\n if (!withRadius) {\n rx = 0\n ry = 0\n }\n const symmetricRadius = rx === ry\n const sk = new BlueprintSketcher([Math.min(0, -(width / 2 - rx)), -height / 2])\n const addFillet = (xDist: number, yDist: number): void => {\n if (!withRadius) return\n if (symmetricRadius) sk.tangentArc(xDist, yDist)\n else sk.ellipse(xDist, yDist, rx, ry, 0, false, true)\n }\n if (rx < width / 2) sk.hLine(width - 2 * rx)\n addFillet(rx, ry)\n if (ry < height / 2) sk.vLine(height - 2 * ry)\n addFillet(-rx, ry)\n if (rx < width / 2) sk.hLine(-(width - 2 * rx))\n addFillet(-rx, -ry)\n if (ry < height / 2) sk.vLine(-(height - 2 * ry))\n addFillet(rx, -ry)\n return new Blueprint(sk.close())\n}"]}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * CompoundBlueprint — 2D profile with holes (pure-data port of brepjs, Apache-2.0).
3
+ * `blueprints[0]` is the outer boundary; subsequent entries are holes.
4
+ * @module
5
+ */
6
+ import { Blueprint, type Point2 } from './blueprint.js';
7
+ import { type BBox2d } from './bbox2d.js';
8
+ /**
9
+ * CompoundBlueprint — 2D profile with holes.
10
+ * `blueprints[0]` is the outer boundary; subsequent entries are holes.
11
+ */
12
+ export declare class CompoundBlueprint {
13
+ /** `blueprints[0]` = outer boundary; the rest are holes. */
14
+ readonly blueprints: Blueprint[];
15
+ private _bbox;
16
+ constructor(blueprints: Blueprint[]);
17
+ /**
18
+ * Return a copy of this profile.
19
+ * @returns a new CompoundBlueprint whose boundaries are clones of the originals.
20
+ */
21
+ clone(): CompoundBlueprint;
22
+ /**
23
+ * Bounding box (cached). The box spanning the outer boundary and all holes.
24
+ * @returns a BBox2d enclosing every boundary in this profile.
25
+ */
26
+ get boundingBox(): BBox2d;
27
+ /**
28
+ * Scale this profile about a center point.
29
+ * @param factor - the scale factor to apply.
30
+ * @param center - the scaling center `[x, y]` (defaults to the bounding-box center).
31
+ * @returns a new CompoundBlueprint with every boundary scaled.
32
+ */
33
+ scale(factor: number, center?: Point2): CompoundBlueprint;
34
+ /**
35
+ * Translate this profile by a delta.
36
+ * @param dxOrPoint - the x delta, or a full `[dx, dy]` offset point.
37
+ * @param dy - the y delta (default 0, ignored when `dxOrPoint` is a point).
38
+ * @returns a new CompoundBlueprint with every boundary translated.
39
+ */
40
+ translate(dxOrPoint: number | Point2, dy?: number): CompoundBlueprint;
41
+ /**
42
+ * Rotate this profile about a center point.
43
+ * @param angleDeg - the rotation angle in degrees.
44
+ * @param center - the rotation center `[x, y]` (defaults to the origin).
45
+ * @returns a new CompoundBlueprint with every boundary rotated.
46
+ */
47
+ rotate(angleDeg: number, center?: Point2): CompoundBlueprint;
48
+ /**
49
+ * Mirror this profile.
50
+ * @param centerOrDirection - the mirror center (mode `center`) or the mirror axis direction.
51
+ * @param origin - the axis origin `[x, y]` when mirroring across a plane (defaults to the origin).
52
+ * @param mode - `center` mirrors about a point; `plane` mirrors across an axis.
53
+ * @returns a new CompoundBlueprint with every boundary mirrored.
54
+ */
55
+ mirror(centerOrDirection: Point2, origin?: Point2, mode?: 'center' | 'plane'): CompoundBlueprint;
56
+ /**
57
+ * The starting point of the outer boundary's first curve.
58
+ * @returns the 2D point where this profile begins.
59
+ */
60
+ get firstPoint(): Point2;
61
+ /**
62
+ * The ending point of the outer boundary's last curve.
63
+ * @returns the 2D point where this profile ends.
64
+ */
65
+ get lastPoint(): Point2;
66
+ /**
67
+ * True when the outer boundary closes back on itself.
68
+ * @returns true when the outer boundary's first and last points coincide.
69
+ */
70
+ isClosed(): boolean;
71
+ }
72
+ //# sourceMappingURL=compound-blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound-blueprint.d.ts","sourceRoot":"","sources":["../../src/geometry2d/compound-blueprint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEzE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,CAAA;IAEhC,OAAO,CAAC,KAAK,CAAsB;gBAEvB,UAAU,EAAE,SAAS,EAAE;IAKnC;;;OAGG;IACH,KAAK,IAAI,iBAAiB;IAI1B;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAOxB;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAKzD;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAIrE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAI5D;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,QAAQ,GAAG,OAAkB,GAAG,iBAAiB;IAI1G;;;OAGG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;;OAGG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;OAGG;IACH,QAAQ,IAAI,OAAO;CAGpB"}
@@ -0,0 +1,95 @@
1
+ import { centerOf, createBBox2d, mergeBBox } from './bbox2d.js';
2
+ /**
3
+ * CompoundBlueprint — 2D profile with holes.
4
+ * `blueprints[0]` is the outer boundary; subsequent entries are holes.
5
+ */
6
+ export class CompoundBlueprint {
7
+ /** `blueprints[0]` = outer boundary; the rest are holes. */
8
+ blueprints;
9
+ _bbox = null;
10
+ constructor(blueprints) {
11
+ if (blueprints.length === 0)
12
+ throw new Error('CompoundBlueprint requires at least the outer boundary');
13
+ this.blueprints = blueprints;
14
+ }
15
+ /**
16
+ * Return a copy of this profile.
17
+ * @returns a new CompoundBlueprint whose boundaries are clones of the originals.
18
+ */
19
+ clone() {
20
+ return new CompoundBlueprint(this.blueprints.map((b) => b.clone()));
21
+ }
22
+ /**
23
+ * Bounding box (cached). The box spanning the outer boundary and all holes.
24
+ * @returns a BBox2d enclosing every boundary in this profile.
25
+ */
26
+ get boundingBox() {
27
+ if (!this._bbox) {
28
+ const bb = createBBox2d();
29
+ for (const b of this.blueprints)
30
+ mergeBBox(bb, b.boundingBox);
31
+ this._bbox = bb;
32
+ }
33
+ return this._bbox;
34
+ }
35
+ /**
36
+ * Scale this profile about a center point.
37
+ * @param factor - the scale factor to apply.
38
+ * @param center - the scaling center `[x, y]` (defaults to the bounding-box center).
39
+ * @returns a new CompoundBlueprint with every boundary scaled.
40
+ */
41
+ scale(factor, center) {
42
+ const ctr = center ?? centerOf(this.boundingBox);
43
+ return new CompoundBlueprint(this.blueprints.map((b) => b.scale(factor, ctr)));
44
+ }
45
+ /**
46
+ * Translate this profile by a delta.
47
+ * @param dxOrPoint - the x delta, or a full `[dx, dy]` offset point.
48
+ * @param dy - the y delta (default 0, ignored when `dxOrPoint` is a point).
49
+ * @returns a new CompoundBlueprint with every boundary translated.
50
+ */
51
+ translate(dxOrPoint, dy) {
52
+ return new CompoundBlueprint(this.blueprints.map((b) => b.translate(dxOrPoint, dy ?? 0)));
53
+ }
54
+ /**
55
+ * Rotate this profile about a center point.
56
+ * @param angleDeg - the rotation angle in degrees.
57
+ * @param center - the rotation center `[x, y]` (defaults to the origin).
58
+ * @returns a new CompoundBlueprint with every boundary rotated.
59
+ */
60
+ rotate(angleDeg, center) {
61
+ return new CompoundBlueprint(this.blueprints.map((b) => b.rotate(angleDeg, center)));
62
+ }
63
+ /**
64
+ * Mirror this profile.
65
+ * @param centerOrDirection - the mirror center (mode `center`) or the mirror axis direction.
66
+ * @param origin - the axis origin `[x, y]` when mirroring across a plane (defaults to the origin).
67
+ * @param mode - `center` mirrors about a point; `plane` mirrors across an axis.
68
+ * @returns a new CompoundBlueprint with every boundary mirrored.
69
+ */
70
+ mirror(centerOrDirection, origin, mode = 'center') {
71
+ return new CompoundBlueprint(this.blueprints.map((b) => b.mirror(centerOrDirection, origin, mode)));
72
+ }
73
+ /**
74
+ * The starting point of the outer boundary's first curve.
75
+ * @returns the 2D point where this profile begins.
76
+ */
77
+ get firstPoint() {
78
+ return this.blueprints[0].firstPoint;
79
+ }
80
+ /**
81
+ * The ending point of the outer boundary's last curve.
82
+ * @returns the 2D point where this profile ends.
83
+ */
84
+ get lastPoint() {
85
+ return this.blueprints[0].lastPoint;
86
+ }
87
+ /**
88
+ * True when the outer boundary closes back on itself.
89
+ * @returns true when the outer boundary's first and last points coincide.
90
+ */
91
+ isClosed() {
92
+ return this.blueprints[0].isClosed();
93
+ }
94
+ }
95
+ //# sourceMappingURL=compound-blueprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compound-blueprint.js","sourceRoot":"","sources":["../../src/geometry2d/compound-blueprint.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAe,MAAM,UAAU,CAAA;AAEzE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAC5B,4DAA4D;IACnD,UAAU,CAAa;IAExB,KAAK,GAAkB,IAAI,CAAA;IAEnC,YAAY,UAAuB;QACjC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QACtG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAA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,MAAe,EAAE,OAA2B,QAAQ;QACpF,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACrG,CAAC;IAED;;;OAGG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,UAAU,CAAA;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,SAAS,CAAA;IACtC,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,QAAQ,EAAE,CAAA;IACvC,CAAC;CACF","sourcesContent":["/**\n * CompoundBlueprint — 2D profile with holes (pure-data port of brepjs, Apache-2.0).\n * `blueprints[0]` is the outer boundary; subsequent entries are holes.\n * @module\n */\nimport { Blueprint, type Point2 } from './blueprint'\nimport { centerOf, createBBox2d, mergeBBox, type BBox2d } from './bbox2d'\n\n/**\n * CompoundBlueprint — 2D profile with holes.\n * `blueprints[0]` is the outer boundary; subsequent entries are holes.\n */\nexport class CompoundBlueprint {\n /** `blueprints[0]` = outer boundary; the rest are holes. */\n readonly blueprints: Blueprint[]\n\n private _bbox: BBox2d | null = null\n\n constructor(blueprints: Blueprint[]) {\n if (blueprints.length === 0) throw new Error('CompoundBlueprint requires at least the outer boundary')\n this.blueprints = blueprints\n }\n\n /**\n * Return a copy of this profile.\n * @returns a new CompoundBlueprint whose boundaries are clones of the originals.\n */\n clone(): CompoundBlueprint {\n return new CompoundBlueprint(this.blueprints.map((b) => b.clone()))\n }\n\n /**\n * Bounding box (cached). The box spanning the outer boundary and all holes.\n * @returns a BBox2d enclosing every boundary in this profile.\n */\n get boundingBox(): BBox2d {\n if (!this._bbox) {\n const bb = createBBox2d()\n for (const b of this.blueprints) mergeBBox(bb, b.boundingBox)\n this._bbox = bb\n }\n return this._bbox\n }\n\n /**\n * Scale this profile about a center point.\n * @param factor - the scale factor to apply.\n * @param center - the scaling center `[x, y]` (defaults to the bounding-box center).\n * @returns a new CompoundBlueprint with every boundary scaled.\n */\n scale(factor: number, center?: Point2): CompoundBlueprint {\n const ctr = center ?? centerOf(this.boundingBox)\n return new CompoundBlueprint(this.blueprints.map((b) => b.scale(factor, ctr)))\n }\n\n /**\n * Translate this profile by a delta.\n * @param dxOrPoint - the x delta, or a full `[dx, dy]` offset point.\n * @param dy - the y delta (default 0, ignored when `dxOrPoint` is a point).\n * @returns a new CompoundBlueprint with every boundary translated.\n */\n translate(dxOrPoint: number | Point2, dy?: number): CompoundBlueprint {\n return new CompoundBlueprint(this.blueprints.map((b) => b.translate(dxOrPoint, dy ?? 0)))\n }\n\n /**\n * Rotate this profile about a center point.\n * @param angleDeg - the rotation angle in degrees.\n * @param center - the rotation center `[x, y]` (defaults to the origin).\n * @returns a new CompoundBlueprint with every boundary rotated.\n */\n rotate(angleDeg: number, center?: Point2): CompoundBlueprint {\n return new CompoundBlueprint(this.blueprints.map((b) => b.rotate(angleDeg, center)))\n }\n\n /**\n * Mirror this profile.\n * @param centerOrDirection - the mirror center (mode `center`) or the mirror axis direction.\n * @param origin - the axis origin `[x, y]` when mirroring across a plane (defaults to the origin).\n * @param mode - `center` mirrors about a point; `plane` mirrors across an axis.\n * @returns a new CompoundBlueprint with every boundary mirrored.\n */\n mirror(centerOrDirection: Point2, origin?: Point2, mode: 'center' | 'plane' = 'center'): CompoundBlueprint {\n return new CompoundBlueprint(this.blueprints.map((b) => b.mirror(centerOrDirection, origin, mode)))\n }\n\n /**\n * The starting point of the outer boundary's first curve.\n * @returns the 2D point where this profile begins.\n */\n get firstPoint(): Point2 {\n return this.blueprints[0]!.firstPoint\n }\n\n /**\n * The ending point of the outer boundary's last curve.\n * @returns the 2D point where this profile ends.\n */\n get lastPoint(): Point2 {\n return this.blueprints[0]!.lastPoint\n }\n\n /**\n * True when the outer boundary closes back on itself.\n * @returns true when the outer boundary's first and last points coincide.\n */\n isClosed(): boolean {\n return this.blueprints[0]!.isClosed()\n }\n}"]}
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Pure-TypeScript 2D analytic curve model (faijs port of brepjs).
3
+ *
4
+ * Adapted from brepjs `src/kernel/geometry2d.ts` (Apache-2.0), preserving core
5
+ * algorithms and naming. Differences from brepjs:
6
+ * - discriminant field renamed `__bk2d` → `kind2d` (2026-09-27 decision),
7
+ * bbox discriminant `__bk2d_bbox` → `kind2d_b`.
8
+ * - All curves are plain data objects (no kernel handles, no dispose), per the
9
+ * faijs "2D curves are pure objects" design (docs/plans/2d-sketching: A1/B1).
10
+ *
11
+ * Pure TS, zero WASM, zero external deps. All 2D curves represented as plain
12
+ * objects with a `kind2d` discriminant.
13
+ *
14
+ * License: adapted from brepjs (Apache-2.0). Retained per faijs convention for
15
+ * brepjs-ported files (cf. svg-to-solid.ts).
16
+ *
17
+ * @module
18
+ */
19
+ /** Line: origin + unit direction + length. */
20
+ export interface Line2d {
21
+ readonly kind2d: 'line';
22
+ readonly ox: number;
23
+ readonly oy: number;
24
+ readonly dx: number;
25
+ readonly dy: number;
26
+ readonly len: number;
27
+ }
28
+ /** Full circle. sense=true → CCW. */
29
+ export interface Circle2d {
30
+ readonly kind2d: 'circle';
31
+ readonly cx: number;
32
+ readonly cy: number;
33
+ readonly radius: number;
34
+ readonly sense: boolean;
35
+ }
36
+ /** Ellipse (or arc of one, via trim). */
37
+ export interface Ellipse2d {
38
+ readonly kind2d: 'ellipse';
39
+ readonly cx: number;
40
+ readonly cy: number;
41
+ readonly majorRadius: number;
42
+ readonly minorRadius: number;
43
+ readonly xDirAngle: number;
44
+ readonly sense: boolean;
45
+ }
46
+ /** Bezier curve (De Casteljau). */
47
+ export interface Bezier2d {
48
+ readonly kind2d: 'bezier';
49
+ readonly poles: [number, number][];
50
+ }
51
+ /** B-spline (De Boor). */
52
+ export interface BSpline2d {
53
+ readonly kind2d: 'bspline';
54
+ readonly poles: [number, number][];
55
+ readonly knots: number[];
56
+ readonly multiplicities: number[];
57
+ readonly degree: number;
58
+ readonly isPeriodic: boolean;
59
+ }
60
+ /** Trimmed wrapper over another curve. */
61
+ export interface TrimmedCurve2d {
62
+ readonly kind2d: 'trimmed';
63
+ readonly basis: Curve2dObj;
64
+ readonly tStart: number;
65
+ readonly tEnd: number;
66
+ }
67
+ /**
68
+ * A 2D curve expressed as one of the supported analytic or spline kinds.
69
+ * Discriminated by the `kind2d` field.
70
+ */
71
+ export type Curve2dObj = Line2d | Circle2d | Ellipse2d | Bezier2d | BSpline2d | TrimmedCurve2d;
72
+ /**
73
+ * Mutable 2D bounding box carried by the curve-specific bbox helpers.
74
+ * `kind2d_b` marks the discriminant used to detect this box type.
75
+ */
76
+ export interface CurveBBox2d {
77
+ readonly kind2d_b: true;
78
+ xMin: number;
79
+ yMin: number;
80
+ xMax: number;
81
+ yMax: number;
82
+ }
83
+ /**
84
+ * Evaluate a curve at parameter t to a 2D point.
85
+ * @param c - the curve to evaluate.
86
+ * @param t - the parameter value within the curve's domain.
87
+ * @returns the 2D point `[x, y]` on the curve.
88
+ */
89
+ export declare function evaluateCurve2d(c: Curve2dObj, t: number): [number, number];
90
+ /**
91
+ * Tangent (non-normalized direction derivative) at parameter t.
92
+ * @param c - the curve to differentiate.
93
+ * @param t - the parameter value within the curve's domain.
94
+ * @returns the unnormalized tangent vector `[dx, dy]` at `t`.
95
+ */
96
+ export declare function tangentCurve2d(c: Curve2dObj, t: number): [number, number];
97
+ /**
98
+ * Parameter domain of a curve.
99
+ * @param c - the curve whose domain to read.
100
+ * @returns the inclusive `first` and `last` parameter bounds.
101
+ */
102
+ export declare function curveBounds(c: Curve2dObj): {
103
+ first: number;
104
+ last: number;
105
+ };
106
+ /**
107
+ * OCCT-style type name of a curve.
108
+ * @param c - the curve to name.
109
+ * @returns the uppercase OCCT type name such as `LINE`, `CIRCLE` or `BSPLINE_CURVE`.
110
+ */
111
+ export declare function curveTypeName(c: Curve2dObj): string;
112
+ /**
113
+ * Line segment from (x1,y1) to (x2,y2).
114
+ * @param x1 - the x coordinate of the start point.
115
+ * @param y1 - the y coordinate of the start point.
116
+ * @param x2 - the x coordinate of the end point.
117
+ * @param y2 - the y coordinate of the end point.
118
+ * @returns a Line2d describing the segment.
119
+ */
120
+ export declare function makeLine2d(x1: number, y1: number, x2: number, y2: number): Line2d;
121
+ /**
122
+ * Full circle with the given center, radius and winding sense.
123
+ * @param cx - the x coordinate of the center.
124
+ * @param cy - the y coordinate of the center.
125
+ * @param radius - the circle radius.
126
+ * @param sense - true for counter-clockwise winding (default true).
127
+ * @returns a Circle2d.
128
+ */
129
+ export declare function makeCircle2d(cx: number, cy: number, radius: number, sense?: boolean): Circle2d;
130
+ /**
131
+ * Arc through three points; returns a trimmed circle, or a line if collinear.
132
+ * @param x1 - the x coordinate of the start point.
133
+ * @param y1 - the y coordinate of the start point.
134
+ * @param xm - the x coordinate of the mid point.
135
+ * @param ym - the y coordinate of the mid point.
136
+ * @param x2 - the x coordinate of the end point.
137
+ * @param y2 - the y coordinate of the end point.
138
+ * @returns a Curve2dObj: a trimmed arc circle, or a straight line when the points are collinear.
139
+ */
140
+ export declare function makeArc2dThreePoints(x1: number, y1: number, xm: number, ym: number, x2: number, y2: number): Curve2dObj;
141
+ /**
142
+ * Arc from a start point through a given tangent direction to an end point.
143
+ * @param sx - the x coordinate of the start point.
144
+ * @param sy - the y coordinate of the start point.
145
+ * @param tx - the x component of the tangent direction at the start.
146
+ * @param ty - the y component of the tangent direction at the start.
147
+ * @param ex - the x coordinate of the end point.
148
+ * @param ey - the y coordinate of the end point.
149
+ * @returns a Curve2dObj: a trimmed circle arc, or a line when degenerate.
150
+ */
151
+ export declare function makeArc2dTangent(sx: number, sy: number, tx: number, ty: number, ex: number, ey: number): Curve2dObj;
152
+ /**
153
+ * Ellipse with the given center, radii, major-axis direction and sense.
154
+ * @param cx - the x coordinate of the center.
155
+ * @param cy - the y coordinate of the center.
156
+ * @param majorRadius - the semi-major radius.
157
+ * @param minorRadius - the semi-minor radius.
158
+ * @param xDirX - the x component of the major-axis direction (default 1).
159
+ * @param xDirY - the y component of the major-axis direction (default 0).
160
+ * @param sense - true for counter-clockwise winding (default true).
161
+ * @returns an Ellipse2d.
162
+ */
163
+ export declare function makeEllipse2d(cx: number, cy: number, majorRadius: number, minorRadius: number, xDirX?: number, xDirY?: number, sense?: boolean): Ellipse2d;
164
+ /**
165
+ * Bezier curve from control poles.
166
+ * @param poles - the ordered control points `[x, y]` for the curve.
167
+ * @returns a Bezier2d holding a copy of the poles.
168
+ */
169
+ export declare function makeBezier2d(poles: [number, number][]): Bezier2d;
170
+ /**
171
+ * Translate a curve by an offset.
172
+ * @param c - the curve to translate.
173
+ * @param dx - the x offset.
174
+ * @param dy - the y offset.
175
+ * @returns a new Curve2dObj translated by `(dx, dy)`.
176
+ */
177
+ export declare function translateCurve2d(c: Curve2dObj, dx: number, dy: number): Curve2dObj;
178
+ /**
179
+ * Rotate a curve by an angle about a center point.
180
+ * @param c - the curve to rotate.
181
+ * @param angle - the rotation angle in radians.
182
+ * @param cx - the x coordinate of the rotation center.
183
+ * @param cy - the y coordinate of the rotation center.
184
+ * @returns a new Curve2dObj rotated by `angle` about `(cx, cy)`.
185
+ */
186
+ export declare function rotateCurve2d(c: Curve2dObj, angle: number, cx: number, cy: number): Curve2dObj;
187
+ /**
188
+ * Scale a curve by a factor about a center point.
189
+ * @param c - the curve to scale.
190
+ * @param factor - the scale factor (may be negative to mirror-and-scale).
191
+ * @param cx - the x coordinate of the scaling center.
192
+ * @param cy - the y coordinate of the scaling center.
193
+ * @returns a new Curve2dObj scaled by `factor` about `(cx, cy)`.
194
+ */
195
+ export declare function scaleCurve2d(c: Curve2dObj, factor: number, cx: number, cy: number): Curve2dObj;
196
+ /**
197
+ * Mirror a curve through a center point (a half-turn).
198
+ * @param c - the curve to mirror.
199
+ * @param cx - the x coordinate of the mirror center.
200
+ * @param cy - the y coordinate of the mirror center.
201
+ * @returns a new Curve2dObj rotated 180 degrees about `(cx, cy)`.
202
+ */
203
+ export declare function mirrorAtPoint(c: Curve2dObj, cx: number, cy: number): Curve2dObj;
204
+ /**
205
+ * Mirror a curve across an axis defined by a point and a direction vector.
206
+ * @param c - the curve to mirror.
207
+ * @param ox - the x coordinate of a point on the mirror axis.
208
+ * @param oy - the y coordinate of a point on the mirror axis.
209
+ * @param dx - the x component of the axis direction vector.
210
+ * @param dy - the y component of the axis direction vector.
211
+ * @returns a new Curve2dObj reflected across the given axis.
212
+ */
213
+ export declare function mirrorAcrossAxis(c: Curve2dObj, ox: number, oy: number, dx: number, dy: number): Curve2dObj;
214
+ /**
215
+ * Compute intersection points (and overlapping segments) between two 2D curves.
216
+ * Handles analytic cases (line-line, line-circle, circle-circle) and falls back
217
+ * to numerical sampling + Newton refinement for general curves.
218
+ * @param c1 - the first curve.
219
+ * @param c2 - the second curve.
220
+ * @param tolerance - the geometric tolerance used for candidate filtering.
221
+ * @returns the intersection points and any overlapping curve segments.
222
+ */
223
+ export declare function intersectCurves2dFn(c1: Curve2dObj, c2: Curve2dObj, tolerance: number): {
224
+ points: [number, number][];
225
+ segments: Curve2dObj[];
226
+ };
227
+ /**
228
+ * Serialize a curve (JSON round-trip).
229
+ * @param c - the curve to serialize.
230
+ * @returns the curve as a JSON string.
231
+ */
232
+ export declare function serializeCurve2d(c: Curve2dObj): string;
233
+ /**
234
+ * Deserialize a curve previously produced by {@link serializeCurve2d}.
235
+ * @param data - the JSON string describing the curve.
236
+ * @returns the reconstructed Curve2dObj.
237
+ */
238
+ export declare function deserializeCurve2d(data: string): Curve2dObj;
239
+ /**
240
+ * Create an empty (inverted) curve bounding box.
241
+ * @returns a fresh CurveBBox2d whose mins are +Infinity and maxes are -Infinity.
242
+ */
243
+ export declare function createCurveBBox2d(): CurveBBox2d;
244
+ /**
245
+ * Expand a curve bounding box to include a curve's extent.
246
+ * Uses analytic extremes for lines and circles/arcs and sampling otherwise.
247
+ * @param bbox - the box to expand in place.
248
+ * @param c - the curve whose extent is incorporated.
249
+ * @param _tol - reserved tolerance parameter (unused).
250
+ */
251
+ export declare function addCurveToBBox(bbox: CurveBBox2d, c: Curve2dObj, _tol: number): void;
252
+ /**
253
+ * Parameter on a curve closest to a point.
254
+ *
255
+ * This is the general "point → parameter" primitive used by corner/offset work:
256
+ * it searches the curve's domain for the parameter whose evaluated point is
257
+ * nearest to `(px, py)` and returns it when that nearest distance is within a
258
+ * configurable fraction of the curve's geometric extent. Returns `null` when the
259
+ * point lies too far off the curve (the raw gap-vs-extent guard) so callers can
260
+ * distinguish "on/very near the curve" from "clearly off".
261
+ *
262
+ * @param c - the curve to search (line, arc, ellipse, bezier, bspline, trimmed).
263
+ * @param px - the query point x.
264
+ * @param py - the query point y.
265
+ * @param maxRatio - the maximum acceptable nearest-distance / geometric-extent
266
+ * ratio (default 0.1; raise it to accept points that sit further off the curve).
267
+ * @returns the domain parameter `t`, or `null` when `(px, py)` is off-curve by
268
+ * more than `maxRatio` of the curve's geometric extent.
269
+ */
270
+ export declare function parameterOfPoint(c: Curve2dObj, px: number, py: number, maxRatio?: number): number | null;
271
+ /**
272
+ * Trim a curve to a sub-parameter range given in the basis curve's native domain.
273
+ *
274
+ * The returned `trimmed` curve keeps the full basis; its `t∈[0,1]` domain maps
275
+ * into `[tStart, tEnd]` of the basis (so it is the inverse of `curveBounds` for
276
+ * trimmed curves). Parameters are in the basis's native domain (a line: distance
277
+ * along `[0,len]`; an arc/ellipse: angle `[.., ..]`).
278
+ *
279
+ * @param c - the curve to trim (may itself be already-trimmed; the basis is reused).
280
+ * @param tStart - the basis-domain parameter where the sub-curve starts.
281
+ * @param tEnd - the basis-domain parameter where the sub-curve ends.
282
+ * @returns the trimmed `Curve2dObj`.
283
+ */
284
+ export declare function trimCurve(c: Curve2dObj, tStart: number, tEnd: number): Curve2dObj;
285
+ /**
286
+ * Split a curve at a native-domain parameter into two trimmed sub-curves.
287
+ *
288
+ * This is the splice primitive that D1 boolean-splitting and D3 corner
289
+ * (fillet/chamfer) use: it cuts a single curve at an interior parameter into
290
+ * two `TrimmedCurve2d` sharing the same basis, covering `[first, t]` and
291
+ * `[t, last]`. Returns `null` when `t` is not strictly interior.
292
+ *
293
+ * @param c - the curve to split.
294
+ * @param t - the native-domain split parameter (strictly inside the basis domain).
295
+ * @returns the two sub-curves, or `null` when `t` is outside the interior.
296
+ */
297
+ export declare function splitCurveAt(c: Curve2dObj, t: number): [Curve2dObj, Curve2dObj] | null;
298
+ //# sourceMappingURL=curve2d.d.ts.map