@faicad/faijs 0.29.5 → 0.30.9

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 (582) hide show
  1. package/NOTICE +6 -5
  2. package/dist/api/api-namespace.d.ts +1 -1
  3. package/dist/api/api-namespace.d.ts.map +1 -1
  4. package/dist/api/api-namespace.js +53 -1
  5. package/dist/api/api-namespace.js.map +1 -1
  6. package/dist/api/appearance.d.ts +0 -2
  7. package/dist/api/appearance.d.ts.map +1 -1
  8. package/dist/api/appearance.js +0 -2
  9. package/dist/api/appearance.js.map +1 -1
  10. package/dist/api/assembly/entities.d.ts +1 -1
  11. package/dist/api/assembly/entities.js +1 -1
  12. package/dist/api/assembly/entities.js.map +1 -1
  13. package/dist/api/assembly/index.d.ts +1 -1
  14. package/dist/api/assembly/index.js +1 -1
  15. package/dist/api/assembly/index.js.map +1 -1
  16. package/dist/api/assembly/joints.d.ts +33 -15
  17. package/dist/api/assembly/joints.d.ts.map +1 -1
  18. package/dist/api/assembly/joints.js +31 -13
  19. package/dist/api/assembly/joints.js.map +1 -1
  20. package/dist/api/assembly/preview.d.ts +1 -1
  21. package/dist/api/assembly/preview.js +1 -1
  22. package/dist/api/assembly/preview.js.map +1 -1
  23. package/dist/api/assembly/solve.d.ts +1 -1
  24. package/dist/api/assembly/solve.js +1 -1
  25. package/dist/api/assembly/solve.js.map +1 -1
  26. package/dist/api/assembly/solvers/assembly-tree.d.ts +1 -1
  27. package/dist/api/assembly/solvers/assembly-tree.js +1 -1
  28. package/dist/api/assembly/solvers/assembly-tree.js.map +1 -1
  29. package/dist/api/assembly/solvers/chain-solver.d.ts +2 -2
  30. package/dist/api/assembly/solvers/chain-solver.js.map +1 -1
  31. package/dist/api/assembly/solvers/global-solver.d.ts +1 -2
  32. package/dist/api/assembly/solvers/global-solver.d.ts.map +1 -1
  33. package/dist/api/assembly/solvers/global-solver.js +3 -4
  34. package/dist/api/assembly/solvers/global-solver.js.map +1 -1
  35. package/dist/api/assembly/solvers/joints-kinematics.js +1 -1
  36. package/dist/api/assembly/solvers/joints-kinematics.js.map +1 -1
  37. package/dist/api/assembly/solvers/linalg.d.ts +2 -2
  38. package/dist/api/assembly/solvers/linalg.js +2 -2
  39. package/dist/api/assembly/solvers/linalg.js.map +1 -1
  40. package/dist/api/assembly/solvers/types.d.ts +2 -5
  41. package/dist/api/assembly/solvers/types.d.ts.map +1 -1
  42. package/dist/api/assembly/solvers/types.js +1 -4
  43. package/dist/api/assembly/solvers/types.js.map +1 -1
  44. package/dist/api/boolean.d.ts.map +1 -1
  45. package/dist/api/boolean.js +7 -6
  46. package/dist/api/boolean.js.map +1 -1
  47. package/dist/api/brep-mirror/booleanFns.d.ts +3 -3
  48. package/dist/api/brep-mirror/booleanFns.js +5 -5
  49. package/dist/api/brep-mirror/booleanFns.js.map +1 -1
  50. package/dist/api/brep-mirror/compoundFns.d.ts +1 -1
  51. package/dist/api/brep-mirror/compoundFns.js +4 -4
  52. package/dist/api/brep-mirror/compoundFns.js.map +1 -1
  53. package/dist/api/brep-mirror/healingFns.d.ts +4 -4
  54. package/dist/api/brep-mirror/healingFns.js +4 -4
  55. package/dist/api/brep-mirror/healingFns.js.map +1 -1
  56. package/dist/api/brep-mirror/hullFns.d.ts +2 -2
  57. package/dist/api/brep-mirror/hullFns.js +2 -2
  58. package/dist/api/brep-mirror/hullFns.js.map +1 -1
  59. package/dist/api/brep-mirror/patternFns.d.ts +5 -5
  60. package/dist/api/brep-mirror/patternFns.js +10 -10
  61. package/dist/api/brep-mirror/patternFns.js.map +1 -1
  62. package/dist/api/brep-mirror/primitiveFns.d.ts +4 -4
  63. package/dist/api/brep-mirror/primitiveFns.js +4 -4
  64. package/dist/api/brep-mirror/primitiveFns.js.map +1 -1
  65. package/dist/api/brep-mirror/roofFns.d.ts +3 -3
  66. package/dist/api/brep-mirror/roofFns.js +7 -7
  67. package/dist/api/brep-mirror/roofFns.js.map +1 -1
  68. package/dist/api/brep-mirror/sweepFns.d.ts +7 -7
  69. package/dist/api/brep-mirror/sweepFns.js +14 -14
  70. package/dist/api/brep-mirror/sweepFns.js.map +1 -1
  71. package/dist/api/brep-mirror/threadFns.d.ts +1 -1
  72. package/dist/api/brep-mirror/threadFns.js +1 -1
  73. package/dist/api/brep-mirror/threadFns.js.map +1 -1
  74. package/dist/api/brep-mirror/topologyFns.d.ts +5 -5
  75. package/dist/api/brep-mirror/topologyFns.js +8 -8
  76. package/dist/api/brep-mirror/topologyFns.js.map +1 -1
  77. package/dist/api/brep-operations/booleanFns.d.ts +40 -0
  78. package/dist/api/brep-operations/booleanFns.d.ts.map +1 -0
  79. package/dist/api/brep-operations/booleanFns.js +104 -0
  80. package/dist/api/brep-operations/booleanFns.js.map +1 -0
  81. package/dist/api/brep-operations/brepHelpers.d.ts +55 -0
  82. package/dist/api/brep-operations/brepHelpers.d.ts.map +1 -0
  83. package/dist/api/brep-operations/brepHelpers.js +131 -0
  84. package/dist/api/brep-operations/brepHelpers.js.map +1 -0
  85. package/dist/api/brep-operations/compoundFns.d.ts +46 -0
  86. package/dist/api/brep-operations/compoundFns.d.ts.map +1 -0
  87. package/dist/api/brep-operations/compoundFns.js +299 -0
  88. package/dist/api/brep-operations/compoundFns.js.map +1 -0
  89. package/dist/api/brep-operations/healingFns.d.ts +78 -0
  90. package/dist/api/brep-operations/healingFns.d.ts.map +1 -0
  91. package/dist/api/brep-operations/healingFns.js +294 -0
  92. package/dist/api/brep-operations/healingFns.js.map +1 -0
  93. package/dist/api/brep-operations/hullFns.d.ts +20 -0
  94. package/dist/api/brep-operations/hullFns.d.ts.map +1 -0
  95. package/dist/api/brep-operations/hullFns.js +46 -0
  96. package/dist/api/brep-operations/hullFns.js.map +1 -0
  97. package/dist/api/brep-operations/joinery-brep.d.ts +172 -0
  98. package/dist/api/brep-operations/joinery-brep.d.ts.map +1 -0
  99. package/dist/api/brep-operations/joinery-brep.js +463 -0
  100. package/dist/api/brep-operations/joinery-brep.js.map +1 -0
  101. package/dist/api/brep-operations/patternFns.d.ts +43 -0
  102. package/dist/api/brep-operations/patternFns.d.ts.map +1 -0
  103. package/dist/api/brep-operations/patternFns.js +178 -0
  104. package/dist/api/brep-operations/patternFns.js.map +1 -0
  105. package/dist/api/brep-operations/primitiveFns.d.ts +42 -0
  106. package/dist/api/brep-operations/primitiveFns.d.ts.map +1 -0
  107. package/dist/api/brep-operations/primitiveFns.js +104 -0
  108. package/dist/api/brep-operations/primitiveFns.js.map +1 -0
  109. package/dist/api/brep-operations/roofFns.d.ts +24 -0
  110. package/dist/api/brep-operations/roofFns.d.ts.map +1 -0
  111. package/dist/api/brep-operations/roofFns.js +229 -0
  112. package/dist/api/brep-operations/roofFns.js.map +1 -0
  113. package/dist/api/brep-operations/straightSkeleton.d.ts +36 -0
  114. package/dist/api/brep-operations/straightSkeleton.d.ts.map +1 -0
  115. package/dist/api/brep-operations/straightSkeleton.js +431 -0
  116. package/dist/api/brep-operations/straightSkeleton.js.map +1 -0
  117. package/dist/api/brep-operations/sweepFns.d.ts +60 -0
  118. package/dist/api/brep-operations/sweepFns.d.ts.map +1 -0
  119. package/dist/api/brep-operations/sweepFns.js +323 -0
  120. package/dist/api/brep-operations/sweepFns.js.map +1 -0
  121. package/dist/api/brep-operations/threadFns.d.ts +83 -0
  122. package/dist/api/brep-operations/threadFns.d.ts.map +1 -0
  123. package/dist/api/brep-operations/threadFns.js +138 -0
  124. package/dist/api/brep-operations/threadFns.js.map +1 -0
  125. package/dist/api/brep-operations/topologyFns.d.ts +90 -0
  126. package/dist/api/brep-operations/topologyFns.d.ts.map +1 -0
  127. package/dist/api/brep-operations/topologyFns.js +276 -0
  128. package/dist/api/brep-operations/topologyFns.js.map +1 -0
  129. package/dist/api/brep-topology.d.ts +1 -1
  130. package/dist/api/brep-topology.d.ts.map +1 -1
  131. package/dist/api/brep-topology.js +1 -1
  132. package/dist/api/brep-topology.js.map +1 -1
  133. package/dist/api/brepjs-compat/index.d.ts +1 -1
  134. package/dist/api/brepjs-compat/index.js +3 -3
  135. package/dist/api/brepjs-compat/index.js.map +1 -1
  136. package/dist/api/cadquery-selectors/borrow-bridge.d.ts.map +1 -1
  137. package/dist/api/cadquery-selectors/borrow-bridge.js +3 -4
  138. package/dist/api/cadquery-selectors/borrow-bridge.js.map +1 -1
  139. package/dist/api/curve-sketch/index.d.ts +235 -0
  140. package/dist/api/curve-sketch/index.d.ts.map +1 -0
  141. package/dist/api/curve-sketch/index.js +487 -0
  142. package/dist/api/curve-sketch/index.js.map +1 -0
  143. package/dist/api/engrave.d.ts.map +1 -1
  144. package/dist/api/engrave.js +3 -2
  145. package/dist/api/engrave.js.map +1 -1
  146. package/dist/api/export-brep.d.ts +41 -0
  147. package/dist/api/export-brep.d.ts.map +1 -0
  148. package/dist/api/export-brep.js +58 -0
  149. package/dist/api/export-brep.js.map +1 -0
  150. package/dist/api/export-stl.d.ts +50 -0
  151. package/dist/api/export-stl.d.ts.map +1 -0
  152. package/dist/api/export-stl.js +99 -0
  153. package/dist/api/export-stl.js.map +1 -0
  154. package/dist/api/extrude.d.ts +8 -11
  155. package/dist/api/extrude.d.ts.map +1 -1
  156. package/dist/api/extrude.js +11 -14
  157. package/dist/api/extrude.js.map +1 -1
  158. package/dist/api/fillet-variable.d.ts +2 -2
  159. package/dist/api/fillet-variable.js +2 -2
  160. package/dist/api/fillet-variable.js.map +1 -1
  161. package/dist/api/fillet.d.ts +2 -4
  162. package/dist/api/fillet.d.ts.map +1 -1
  163. package/dist/api/fillet.js +2 -4
  164. package/dist/api/fillet.js.map +1 -1
  165. package/dist/api/generated/2d.d.ts +4 -0
  166. package/dist/api/generated/2d.d.ts.map +1 -1
  167. package/dist/api/generated/2d.js +4 -0
  168. package/dist/api/generated/2d.js.map +1 -1
  169. package/dist/api/generated/core.d.ts +4 -0
  170. package/dist/api/generated/core.d.ts.map +1 -1
  171. package/dist/api/generated/core.js +4 -0
  172. package/dist/api/generated/core.js.map +1 -1
  173. package/dist/api/generated/gear.d.ts +4 -0
  174. package/dist/api/generated/gear.d.ts.map +1 -1
  175. package/dist/api/generated/gear.js +4 -0
  176. package/dist/api/generated/gear.js.map +1 -1
  177. package/dist/api/generated/io.d.ts +4 -0
  178. package/dist/api/generated/io.d.ts.map +1 -1
  179. package/dist/api/generated/io.js +4 -0
  180. package/dist/api/generated/io.js.map +1 -1
  181. package/dist/api/generated/kernel.d.ts +4 -0
  182. package/dist/api/generated/kernel.d.ts.map +1 -1
  183. package/dist/api/generated/kernel.js +4 -0
  184. package/dist/api/generated/kernel.js.map +1 -1
  185. package/dist/api/generated/measurement.d.ts +21 -21
  186. package/dist/api/generated/measurement.d.ts.map +1 -1
  187. package/dist/api/generated/measurement.js +25 -21
  188. package/dist/api/generated/measurement.js.map +1 -1
  189. package/dist/api/generated/ns.d.ts +4 -0
  190. package/dist/api/generated/ns.d.ts.map +1 -1
  191. package/dist/api/generated/ns.js +4 -0
  192. package/dist/api/generated/ns.js.map +1 -1
  193. package/dist/api/generated/operations.d.ts +32 -32
  194. package/dist/api/generated/operations.d.ts.map +1 -1
  195. package/dist/api/generated/operations.js +52 -48
  196. package/dist/api/generated/operations.js.map +1 -1
  197. package/dist/api/generated/projection.d.ts +4 -0
  198. package/dist/api/generated/projection.d.ts.map +1 -1
  199. package/dist/api/generated/projection.js +4 -0
  200. package/dist/api/generated/projection.js.map +1 -1
  201. package/dist/api/generated/query.d.ts +4 -0
  202. package/dist/api/generated/query.d.ts.map +1 -1
  203. package/dist/api/generated/query.js +4 -0
  204. package/dist/api/generated/query.js.map +1 -1
  205. package/dist/api/generated/sketching.d.ts +2 -2
  206. package/dist/api/generated/sketching.d.ts.map +1 -1
  207. package/dist/api/generated/sketching.js +7 -3
  208. package/dist/api/generated/sketching.js.map +1 -1
  209. package/dist/api/generated/text.d.ts +4 -0
  210. package/dist/api/generated/text.d.ts.map +1 -1
  211. package/dist/api/generated/text.js +4 -0
  212. package/dist/api/generated/text.js.map +1 -1
  213. package/dist/api/generated/topology.d.ts +45 -45
  214. package/dist/api/generated/topology.d.ts.map +1 -1
  215. package/dist/api/generated/topology.js +67 -63
  216. package/dist/api/generated/topology.js.map +1 -1
  217. package/dist/api/generated/view.d.ts +4 -0
  218. package/dist/api/generated/view.d.ts.map +1 -1
  219. package/dist/api/generated/view.js +4 -0
  220. package/dist/api/generated/view.js.map +1 -1
  221. package/dist/api/geom-types/constants.d.ts +11 -0
  222. package/dist/api/geom-types/constants.d.ts.map +1 -0
  223. package/dist/api/geom-types/constants.js +11 -0
  224. package/dist/api/geom-types/constants.js.map +1 -0
  225. package/dist/api/geom-types/index.d.ts +21 -0
  226. package/dist/api/geom-types/index.d.ts.map +1 -0
  227. package/dist/api/geom-types/index.js +22 -0
  228. package/dist/api/geom-types/index.js.map +1 -0
  229. package/dist/api/geom-types/planeOps.d.ts +98 -0
  230. package/dist/api/geom-types/planeOps.d.ts.map +1 -0
  231. package/dist/api/geom-types/planeOps.js +170 -0
  232. package/dist/api/geom-types/planeOps.js.map +1 -0
  233. package/dist/api/geom-types/planeTypes.d.ts +24 -0
  234. package/dist/api/geom-types/planeTypes.d.ts.map +1 -0
  235. package/dist/api/geom-types/planeTypes.js +8 -0
  236. package/dist/api/geom-types/planeTypes.js.map +1 -0
  237. package/dist/api/geom-types/types.d.ts +64 -0
  238. package/dist/api/geom-types/types.d.ts.map +1 -0
  239. package/dist/api/geom-types/types.js +48 -0
  240. package/dist/api/geom-types/types.js.map +1 -0
  241. package/dist/api/geom-types/vecOps.d.ts +124 -0
  242. package/dist/api/geom-types/vecOps.d.ts.map +1 -0
  243. package/dist/api/geom-types/vecOps.js +202 -0
  244. package/dist/api/geom-types/vecOps.js.map +1 -0
  245. package/dist/api/geom.d.ts.map +1 -1
  246. package/dist/api/geom.js +6 -5
  247. package/dist/api/geom.js.map +1 -1
  248. package/dist/api/half-space.d.ts +56 -0
  249. package/dist/api/half-space.d.ts.map +1 -0
  250. package/dist/api/half-space.js +82 -0
  251. package/dist/api/half-space.js.map +1 -0
  252. package/dist/api/helix.d.ts +10 -1
  253. package/dist/api/helix.d.ts.map +1 -1
  254. package/dist/api/helix.js +19 -3
  255. package/dist/api/helix.js.map +1 -1
  256. package/dist/api/index.d.ts +15 -6
  257. package/dist/api/index.d.ts.map +1 -1
  258. package/dist/api/index.js +29 -8
  259. package/dist/api/index.js.map +1 -1
  260. package/dist/api/internal/compat-op.d.ts +4 -30
  261. package/dist/api/internal/compat-op.d.ts.map +1 -1
  262. package/dist/api/internal/compat-op.js +10 -42
  263. package/dist/api/internal/compat-op.js.map +1 -1
  264. package/dist/api/internal/compat-projection.d.ts +5 -5
  265. package/dist/api/internal/compat-projection.js +5 -5
  266. package/dist/api/internal/compat-projection.js.map +1 -1
  267. package/dist/api/internal/dual-form-args.d.ts +0 -2
  268. package/dist/api/internal/dual-form-args.d.ts.map +1 -1
  269. package/dist/api/internal/dual-form-args.js +1 -3
  270. package/dist/api/internal/dual-form-args.js.map +1 -1
  271. package/dist/api/internal/l3-bridge.d.ts +5 -37
  272. package/dist/api/internal/l3-bridge.d.ts.map +1 -1
  273. package/dist/api/internal/l3-bridge.js +7 -76
  274. package/dist/api/internal/l3-bridge.js.map +1 -1
  275. package/dist/api/internal/profile-wire.d.ts +1 -1
  276. package/dist/api/internal/profile-wire.js +1 -1
  277. package/dist/api/internal/profile-wire.js.map +1 -1
  278. package/dist/api/internal/result-unwrap.d.ts +4 -6
  279. package/dist/api/internal/result-unwrap.d.ts.map +1 -1
  280. package/dist/api/internal/result-unwrap.js +4 -6
  281. package/dist/api/internal/result-unwrap.js.map +1 -1
  282. package/dist/api/knurl.d.ts.map +1 -1
  283. package/dist/api/knurl.js +5 -3
  284. package/dist/api/knurl.js.map +1 -1
  285. package/dist/api/loft.d.ts +2 -2
  286. package/dist/api/loft.d.ts.map +1 -1
  287. package/dist/api/loft.js +2 -2
  288. package/dist/api/loft.js.map +1 -1
  289. package/dist/api/measurement/index.d.ts +3 -3
  290. package/dist/api/measurement/index.js +3 -3
  291. package/dist/api/measurement/index.js.map +1 -1
  292. package/dist/api/meta.d.ts +0 -2
  293. package/dist/api/meta.d.ts.map +1 -1
  294. package/dist/api/meta.js +0 -2
  295. package/dist/api/meta.js.map +1 -1
  296. package/dist/api/offset2d.d.ts +49 -0
  297. package/dist/api/offset2d.d.ts.map +1 -0
  298. package/dist/api/offset2d.js +86 -0
  299. package/dist/api/offset2d.js.map +1 -0
  300. package/dist/api/pattern.js +3 -3
  301. package/dist/api/pattern.js.map +1 -1
  302. package/dist/api/primitives.d.ts.map +1 -1
  303. package/dist/api/primitives.js +7 -6
  304. package/dist/api/primitives.js.map +1 -1
  305. package/dist/api/replicate.d.ts +2 -2
  306. package/dist/api/replicate.d.ts.map +1 -1
  307. package/dist/api/replicate.js +12 -12
  308. package/dist/api/replicate.js.map +1 -1
  309. package/dist/api/result.d.ts +1 -1
  310. package/dist/api/result.js +1 -1
  311. package/dist/api/result.js.map +1 -1
  312. package/dist/api/revolve.d.ts +2 -2
  313. package/dist/api/revolve.js +3 -3
  314. package/dist/api/revolve.js.map +1 -1
  315. package/dist/api/screw.d.ts +1 -1
  316. package/dist/api/screw.d.ts.map +1 -1
  317. package/dist/api/screw.js +5 -4
  318. package/dist/api/screw.js.map +1 -1
  319. package/dist/api/sdf.d.ts.map +1 -1
  320. package/dist/api/sdf.js +3 -2
  321. package/dist/api/sdf.js.map +1 -1
  322. package/dist/api/shape-type/index.d.ts +141 -0
  323. package/dist/api/shape-type/index.d.ts.map +1 -0
  324. package/dist/api/shape-type/index.js +182 -0
  325. package/dist/api/shape-type/index.js.map +1 -0
  326. package/dist/api/shell.d.ts +2 -2
  327. package/dist/api/shell.js +2 -2
  328. package/dist/api/shell.js.map +1 -1
  329. package/dist/api/solid-from-faces.d.ts +45 -0
  330. package/dist/api/solid-from-faces.d.ts.map +1 -0
  331. package/dist/api/solid-from-faces.js +72 -0
  332. package/dist/api/solid-from-faces.js.map +1 -0
  333. package/dist/api/solid-offset/index.d.ts +67 -0
  334. package/dist/api/solid-offset/index.d.ts.map +1 -0
  335. package/dist/api/solid-offset/index.js +132 -0
  336. package/dist/api/solid-offset/index.js.map +1 -0
  337. package/dist/api/surface/arg-spec.d.ts +35 -33
  338. package/dist/api/surface/arg-spec.d.ts.map +1 -1
  339. package/dist/api/surface/arg-spec.js +222 -224
  340. package/dist/api/surface/arg-spec.js.map +1 -1
  341. package/dist/api/surface-face/index.d.ts +104 -0
  342. package/dist/api/surface-face/index.d.ts.map +1 -0
  343. package/dist/api/surface-face/index.js +217 -0
  344. package/dist/api/surface-face/index.js.map +1 -0
  345. package/dist/api/surface.d.ts +44 -0
  346. package/dist/api/surface.d.ts.map +1 -0
  347. package/dist/api/surface.js +66 -0
  348. package/dist/api/surface.js.map +1 -0
  349. package/dist/api/sweep.d.ts +59 -9
  350. package/dist/api/sweep.d.ts.map +1 -1
  351. package/dist/api/sweep.js +11 -6
  352. package/dist/api/sweep.js.map +1 -1
  353. package/dist/api/thicken.d.ts +1 -1
  354. package/dist/api/thicken.js +1 -1
  355. package/dist/api/thicken.js.map +1 -1
  356. package/dist/api/transform.d.ts +5 -5
  357. package/dist/api/transform.d.ts.map +1 -1
  358. package/dist/api/transform.js +11 -10
  359. package/dist/api/transform.js.map +1 -1
  360. package/dist/api/view/cameraFns.d.ts +1 -1
  361. package/dist/api/view/cameraFns.d.ts.map +1 -1
  362. package/dist/api/view/cameraFns.js +1 -1
  363. package/dist/api/view/cameraFns.js.map +1 -1
  364. package/dist/api/view/index.d.ts +0 -2
  365. package/dist/api/view/index.d.ts.map +1 -1
  366. package/dist/api/view/index.js +0 -2
  367. package/dist/api/view/index.js.map +1 -1
  368. package/dist/api/view/projectionPlanes.d.ts +1 -1
  369. package/dist/api/view/projectionPlanes.d.ts.map +1 -1
  370. package/dist/api/view/projectionPlanes.js.map +1 -1
  371. package/dist/api/view/view-camera.d.ts +7 -9
  372. package/dist/api/view/view-camera.d.ts.map +1 -1
  373. package/dist/api/view/view-camera.js +4 -6
  374. package/dist/api/view/view-camera.js.map +1 -1
  375. package/dist/api/view/view-projection.d.ts +0 -2
  376. package/dist/api/view/view-projection.d.ts.map +1 -1
  377. package/dist/api/view/view-projection.js +0 -2
  378. package/dist/api/view/view-projection.js.map +1 -1
  379. package/dist/api/view/view-sheet.d.ts +0 -2
  380. package/dist/api/view/view-sheet.d.ts.map +1 -1
  381. package/dist/api/view/view-sheet.js +0 -2
  382. package/dist/api/view/view-sheet.js.map +1 -1
  383. package/dist/api/view-export/index.d.ts +97 -0
  384. package/dist/api/view-export/index.d.ts.map +1 -0
  385. package/dist/api/view-export/index.js +118 -0
  386. package/dist/api/view-export/index.js.map +1 -0
  387. package/dist/brep/brep-ops.d.ts +89 -1
  388. package/dist/brep/brep-ops.d.ts.map +1 -1
  389. package/dist/brep/brep-ops.js +176 -10
  390. package/dist/brep/brep-ops.js.map +1 -1
  391. package/dist/brep/brep-topology.d.ts +20 -0
  392. package/dist/brep/brep-topology.d.ts.map +1 -1
  393. package/dist/brep/brep-topology.js +46 -0
  394. package/dist/brep/brep-topology.js.map +1 -1
  395. package/dist/brep/engine/adapters/occt.d.ts +1 -1
  396. package/dist/brep/engine/adapters/occt.js +7 -7
  397. package/dist/brep/engine/adapters/occt.js.map +1 -1
  398. package/dist/brep/engine/primitives.d.ts +2 -3
  399. package/dist/brep/engine/primitives.d.ts.map +1 -1
  400. package/dist/brep/engine/primitives.js +1 -2
  401. package/dist/brep/engine/primitives.js.map +1 -1
  402. package/dist/brep/engine/registry.d.ts +1 -1
  403. package/dist/brep/engine/registry.js +1 -1
  404. package/dist/brep/engine/registry.js.map +1 -1
  405. package/dist/brep/engine/types.d.ts +2 -2
  406. package/dist/brep/engine/types.js.map +1 -1
  407. package/dist/brep/handle-bridge.d.ts +2 -2
  408. package/dist/brep/handle-bridge.js +2 -2
  409. package/dist/brep/handle-bridge.js.map +1 -1
  410. package/dist/brep/index.d.ts +6 -3
  411. package/dist/brep/index.d.ts.map +1 -1
  412. package/dist/brep/index.js +6 -3
  413. package/dist/brep/index.js.map +1 -1
  414. package/dist/brepkit-kernel/brepkitKernel.d.ts +1 -1
  415. package/dist/brepkit-kernel/brepkitKernel.js +2 -2
  416. package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
  417. package/dist/browser.d.ts +2 -2
  418. package/dist/browser.d.ts.map +1 -1
  419. package/dist/browser.js +5 -4
  420. package/dist/browser.js.map +1 -1
  421. package/dist/cad-runtime/admit-compat-lib.d.ts +3 -10
  422. package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
  423. package/dist/cad-runtime/admit-compat-lib.js +3 -9
  424. package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
  425. package/dist/cad-runtime/backend-dispatch.js +12 -3
  426. package/dist/cad-runtime/backend-dispatch.js.map +1 -1
  427. package/dist/cad-runtime/direct-executor.d.ts +6 -3
  428. package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
  429. package/dist/cad-runtime/direct-executor.js +31 -9
  430. package/dist/cad-runtime/direct-executor.js.map +1 -1
  431. package/dist/cad-runtime/interp/env.d.ts +1 -1
  432. package/dist/cad-runtime/interp/env.js.map +1 -1
  433. package/dist/cad-runtime/lib-id.d.ts +0 -2
  434. package/dist/cad-runtime/lib-id.d.ts.map +1 -1
  435. package/dist/cad-runtime/lib-id.js +0 -2
  436. package/dist/cad-runtime/lib-id.js.map +1 -1
  437. package/dist/cad-runtime/live-shapes.d.ts +3 -5
  438. package/dist/cad-runtime/live-shapes.d.ts.map +1 -1
  439. package/dist/cad-runtime/live-shapes.js +8 -10
  440. package/dist/cad-runtime/live-shapes.js.map +1 -1
  441. package/dist/cad-runtime/ports.d.ts +3 -3
  442. package/dist/cad-runtime/ports.js.map +1 -1
  443. package/dist/cad-runtime/runtime.d.ts +21 -7
  444. package/dist/cad-runtime/runtime.d.ts.map +1 -1
  445. package/dist/cad-runtime/runtime.js +45 -6
  446. package/dist/cad-runtime/runtime.js.map +1 -1
  447. package/dist/define-op.d.ts +4 -3
  448. package/dist/define-op.d.ts.map +1 -1
  449. package/dist/define-op.js +2 -2
  450. package/dist/define-op.js.map +1 -1
  451. package/dist/geometry2d/bridge/plane.d.ts +1 -1
  452. package/dist/geometry2d/bridge/plane.js +1 -1
  453. package/dist/geometry2d/bridge/plane.js.map +1 -1
  454. package/dist/geometry2d/curve2d.d.ts +1 -1
  455. package/dist/geometry2d/curve2d.js +1 -1
  456. package/dist/geometry2d/curve2d.js.map +1 -1
  457. package/dist/index.d.ts +1 -1
  458. package/dist/index.d.ts.map +1 -1
  459. package/dist/index.js +10 -4
  460. package/dist/index.js.map +1 -1
  461. package/dist/io/fai-zip/container-read.d.ts +16 -0
  462. package/dist/io/fai-zip/container-read.d.ts.map +1 -1
  463. package/dist/io/fai-zip/container-read.js +22 -0
  464. package/dist/io/fai-zip/container-read.js.map +1 -1
  465. package/dist/io/fai-zip/index.d.ts +1 -1
  466. package/dist/io/fai-zip/index.d.ts.map +1 -1
  467. package/dist/io/fai-zip/index.js +1 -1
  468. package/dist/io/fai-zip/index.js.map +1 -1
  469. package/dist/lang/code-to-args.d.ts.map +1 -1
  470. package/dist/lang/code-to-args.js +10 -1
  471. package/dist/lang/code-to-args.js.map +1 -1
  472. package/dist/lang/determinism-scanner.d.ts.map +1 -1
  473. package/dist/lang/determinism-scanner.js +22 -9
  474. package/dist/lang/determinism-scanner.js.map +1 -1
  475. package/dist/lang/metadata-extractor.d.ts +27 -6
  476. package/dist/lang/metadata-extractor.d.ts.map +1 -1
  477. package/dist/lang/metadata-extractor.js +88 -8
  478. package/dist/lang/metadata-extractor.js.map +1 -1
  479. package/dist/lang/parse-error.d.ts +4 -0
  480. package/dist/lang/parse-error.d.ts.map +1 -1
  481. package/dist/lang/parse-error.js.map +1 -1
  482. package/dist/lang/security-scanner.d.ts +27 -2
  483. package/dist/lang/security-scanner.d.ts.map +1 -1
  484. package/dist/lang/security-scanner.js +29 -2
  485. package/dist/lang/security-scanner.js.map +1 -1
  486. package/dist/lang/source-edit.d.ts +2 -2
  487. package/dist/lang/source-edit.js.map +1 -1
  488. package/dist/lang/symbol-table.generated.d.ts +36 -0
  489. package/dist/lang/symbol-table.generated.d.ts.map +1 -1
  490. package/dist/lang/symbol-table.generated.js +36 -0
  491. package/dist/lang/symbol-table.generated.js.map +1 -1
  492. package/dist/mesh/import-model.d.ts +94 -0
  493. package/dist/mesh/import-model.d.ts.map +1 -0
  494. package/dist/mesh/import-model.js +15 -0
  495. package/dist/mesh/import-model.js.map +1 -0
  496. package/dist/mesh/index.d.ts +19 -58
  497. package/dist/mesh/index.d.ts.map +1 -1
  498. package/dist/mesh/index.js +19 -70
  499. package/dist/mesh/index.js.map +1 -1
  500. package/dist/mesh/io.d.ts +33 -16
  501. package/dist/mesh/io.d.ts.map +1 -1
  502. package/dist/mesh/io.js +144 -39
  503. package/dist/mesh/io.js.map +1 -1
  504. package/dist/mesh/primitives.js +1 -1
  505. package/dist/mesh/primitives.js.map +1 -1
  506. package/dist/mesh/threemf-bambu.d.ts +12 -1
  507. package/dist/mesh/threemf-bambu.d.ts.map +1 -1
  508. package/dist/mesh/threemf-bambu.js +68 -16
  509. package/dist/mesh/threemf-bambu.js.map +1 -1
  510. package/dist/mesh/threemf-loader.d.ts +14 -1
  511. package/dist/mesh/threemf-loader.d.ts.map +1 -1
  512. package/dist/mesh/threemf-loader.js +24 -7
  513. package/dist/mesh/threemf-loader.js.map +1 -1
  514. package/dist/mesh/transform.d.ts +1 -1
  515. package/dist/mesh/transform.js +1 -1
  516. package/dist/mesh/transform.js.map +1 -1
  517. package/dist/mesh/types.d.ts +5 -5
  518. package/dist/mesh/types.d.ts.map +1 -1
  519. package/dist/mesh/types.js.map +1 -1
  520. package/dist/node-host/cli.d.ts +49 -1
  521. package/dist/node-host/cli.d.ts.map +1 -1
  522. package/dist/node-host/cli.js +125 -19
  523. package/dist/node-host/cli.js.map +1 -1
  524. package/dist/node-host/execute-script.d.ts +55 -0
  525. package/dist/node-host/execute-script.d.ts.map +1 -0
  526. package/dist/node-host/execute-script.js +46 -0
  527. package/dist/node-host/execute-script.js.map +1 -0
  528. package/dist/node.d.ts +2 -0
  529. package/dist/node.d.ts.map +1 -1
  530. package/dist/node.js +3 -0
  531. package/dist/node.js.map +1 -1
  532. package/dist/occt-kernel/generated/occtPlatform.generated.d.ts +260 -0
  533. package/dist/occt-kernel/generated/occtPlatform.generated.d.ts.map +1 -0
  534. package/dist/occt-kernel/generated/occtPlatform.generated.js +875 -0
  535. package/dist/occt-kernel/generated/occtPlatform.generated.js.map +1 -0
  536. package/dist/occt-kernel/hullGeometry.d.ts +2 -2
  537. package/dist/occt-kernel/hullGeometry.js +2 -3
  538. package/dist/occt-kernel/hullGeometry.js.map +1 -1
  539. package/dist/occt-kernel/hullOps.d.ts +3 -3
  540. package/dist/occt-kernel/hullOps.js +4 -4
  541. package/dist/occt-kernel/hullOps.js.map +1 -1
  542. package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
  543. package/dist/occt-kernel/occt-primitives.js +31 -4
  544. package/dist/occt-kernel/occt-primitives.js.map +1 -1
  545. package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
  546. package/dist/occt-kernel/occtKernel.js +18 -0
  547. package/dist/occt-kernel/occtKernel.js.map +1 -1
  548. package/dist/occt-scan/recognize.d.ts +58 -0
  549. package/dist/occt-scan/recognize.d.ts.map +1 -0
  550. package/dist/occt-scan/recognize.js +216 -0
  551. package/dist/occt-scan/recognize.js.map +1 -0
  552. package/dist/primitives/brep-primitives.js +7 -7
  553. package/dist/primitives/brep-primitives.js.map +1 -1
  554. package/dist/result/bug.d.ts +1 -1
  555. package/dist/result/bug.js +1 -1
  556. package/dist/result/bug.js.map +1 -1
  557. package/dist/result/errors.d.ts +2 -2
  558. package/dist/result/errors.d.ts.map +1 -1
  559. package/dist/result/errors.js +1 -1
  560. package/dist/result/errors.js.map +1 -1
  561. package/dist/result/vec3.d.ts +1 -1
  562. package/dist/result/vec3.js +1 -1
  563. package/dist/result/vec3.js.map +1 -1
  564. package/dist/runtime-state.d.ts +16 -0
  565. package/dist/runtime-state.d.ts.map +1 -1
  566. package/dist/runtime-state.js +27 -0
  567. package/dist/runtime-state.js.map +1 -1
  568. package/dist/script-globals.d.ts +24 -0
  569. package/dist/script-globals.d.ts.map +1 -0
  570. package/dist/script-globals.js +24 -0
  571. package/dist/script-globals.js.map +1 -0
  572. package/dist/shape.d.ts +24 -0
  573. package/dist/shape.d.ts.map +1 -1
  574. package/dist/shape.js +40 -0
  575. package/dist/shape.js.map +1 -1
  576. package/dist/topology/naming/lineage.d.ts +3 -2
  577. package/dist/topology/naming/lineage.d.ts.map +1 -1
  578. package/dist/topology/naming/lineage.js.map +1 -1
  579. package/dist/weapp.d.ts +1 -1
  580. package/dist/weapp.js +1 -1
  581. package/dist/weapp.js.map +1 -1
  582. package/package.json +8 -10
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Self-hosted compat-op implementations — topology transform family
3
+ * (core-decouple Phase 3, §5.4).
4
+ *
5
+ * @platform occt
6
+ *
7
+ * Each export is a "brep-shaped" implementation consumed by the generated
8
+ * compat-op projection (defineOp + D11 arg normalization). Inputs are the
9
+ * normalized positional arguments of the op's params table; shapes arrive as
10
+ * faijs Shapes (or raw handles) and results are returned as BREP handles
11
+ * (wrapped by `wrapBrepOne` → `fromHandle`).
12
+ *
13
+ * Semantics mirror the early brepjs fns (`topology/transformFns.ts`,
14
+ * `topology/shapeFns.ts`) with the brepjs object model (castResultShape,
15
+ * metadata propagation, evolution tracking) dropped: occt-wasm handles only.
16
+ */
17
+ import type { BrepHandle } from '../../brep/engine/types.js';
18
+ import { type Result } from '../../result/result.js';
19
+ /**
20
+ * Apply a 4×4 affine matrix (OpenSCAD `multmatrix` equivalent).
21
+ *
22
+ * The brepjs fn splits orthogonal (evolution-tracked) and non-orthogonal
23
+ * (`gp_GTrsf`) paths; `applyMatrix` carries identity naming and needs no face
24
+ * evolution, so the core path just needs the *right kernel path for the matrix
25
+ * class* — that dispatch (and its two traps) lives in `applyAffineBrep`:
26
+ *
27
+ * GOTCHA (2026-09-25): occt-wasm's `located`/`generalTransform` return
28
+ * TopLoc/GTrsf-referencing handles whose STEP export crashes ("memory access
29
+ * out of bounds") — the affine `transform` (BRepBuilderAPI_Transform,
30
+ * deep-copy) is the STEP-safe one.
31
+ *
32
+ * GOTCHA (2026-10-07, openscad example023 parity): routing a rigid rotation to
33
+ * `generalTransform` silently corrupts the *tessellation* of an
34
+ * already-meshed shape (top cap z 5 → 10, exact bbox unaffected). A rotation
35
+ * printed to 7 decimals (`0.8660254`) used to be misclassified as
36
+ * "non-similar" by an absolute 1e-9 tolerance and sent down that path.
37
+ * Two independent fixes came out of it: (1) the classification now uses a
38
+ * *relative* tolerance (`isSimilarityAffine`, engine-neutral); (2) occt's
39
+ * residual GTrsf tessellation defect is absorbed in the occt **adapter**
40
+ * (`occt-kernel/occt-primitives.ts#generalTransform`, copy-then-transform —
41
+ * brepkit's GTrsf already clones internally, so it never had the defect).
42
+ *
43
+ * @param args - Resolved arguments (shape, matrix).
44
+ * @returns The transformed shape as a `BrepHandle`.
45
+ */
46
+ export declare function applyMatrixBrep(...args: unknown[]): Result<BrepHandle>;
47
+ /**
48
+ * Deep-copy a shape (`kernel.copyShape`).
49
+ *
50
+ * @param args - Resolved arguments (shape).
51
+ * @returns The cloned shape as a `BrepHandle`.
52
+ */
53
+ export declare function cloneBrep(...args: unknown[]): Result<BrepHandle>;
54
+ /**
55
+ * Placement-only rigid move (translate/rotate) via the kernel's cheap location
56
+ * re-tag. Ops apply first-to-last (rotate then translate).
57
+ *
58
+ * @param args - Resolved arguments (shape, placement).
59
+ * @returns The relocated shape as a `BrepHandle`.
60
+ */
61
+ export declare function locateBrep(...args: unknown[]): Result<BrepHandle>;
62
+ /**
63
+ * Mirror across a plane defined by `options.at` (origin) and `options.normal`.
64
+ *
65
+ * @param args - Resolved arguments (shape, mirror options).
66
+ * @returns The mirrored shape as a `BrepHandle`.
67
+ */
68
+ export declare function mirrorBrep(...args: unknown[]): Result<BrepHandle>;
69
+ /**
70
+ * Rotate the shape around an axis (brepjs topology/api.js#rotate + transformFns.ts#rotate).
71
+ *
72
+ * @param args - Resolved arguments (shape, angle in degrees, axis options).
73
+ * @returns The rotated shape as a `BrepHandle`.
74
+ */
75
+ export declare function rotateBrep(...args: unknown[]): Result<BrepHandle>;
76
+ /**
77
+ * Shell — hollow the shape by removing faces (brepjs topology/api.js#shell + modifierFns.ts#shell).
78
+ *
79
+ * @param args - Resolved arguments (shape, faces, thickness, options).
80
+ * @returns The shelled (hollowed) shape as a `BrepHandle`.
81
+ */
82
+ export declare function shellBrep(...args: unknown[]): Result<BrepHandle>;
83
+ /**
84
+ * Offset all faces of the shape (brepjs topology/api.js#offset + modifierFns.ts#offset).
85
+ *
86
+ * @param args - Resolved arguments (shape, distance, options).
87
+ * @returns The offset shape as a `BrepHandle`.
88
+ */
89
+ export declare function offsetBrep(...args: unknown[]): Result<BrepHandle>;
90
+ //# sourceMappingURL=topologyFns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topologyFns.d.ts","sourceRoot":"","sources":["../../../src/api/brep-operations/topologyFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAqD1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CA8BtE;AAQD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAchE;AAmBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAoBjE;AAQD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAiBjE;AAQD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAmCjE;AAOD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAmBhE;AAOD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAejE"}
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Self-hosted compat-op implementations — topology transform family
3
+ * (core-decouple Phase 3, §5.4).
4
+ *
5
+ * @platform occt
6
+ *
7
+ * Each export is a "brep-shaped" implementation consumed by the generated
8
+ * compat-op projection (defineOp + D11 arg normalization). Inputs are the
9
+ * normalized positional arguments of the op's params table; shapes arrive as
10
+ * faijs Shapes (or raw handles) and results are returned as BREP handles
11
+ * (wrapped by `wrapBrepOne` → `fromHandle`).
12
+ *
13
+ * Semantics mirror the early brepjs fns (`topology/transformFns.ts`,
14
+ * `topology/shapeFns.ts`) with the brepjs object model (castResultShape,
15
+ * metadata propagation, evolution tracking) dropped: occt-wasm handles only.
16
+ */
17
+ import { getBrepApi } from '../../brep/handle-bridge.js';
18
+ import { ok, err } from '../../result/result.js';
19
+ import { kernelError, validationError } from '../../result/errors.js';
20
+ import { resolveArgs } from '../internal/dual-form-args.js';
21
+ import { brepHandleOf, composeAffine, IDENTITY_3X4, rotationMatrix, translationMatrix } from './brepHelpers.js';
22
+ import { applyAffineBrep } from '../../brep/brep-ops.js';
23
+ import { getOcctKernel } from '../../occt-kernel/occtKernel.js';
24
+ const VALIDATION_FAILED = 'VALIDATION_FAILED';
25
+ function parseMatrixInput(input) {
26
+ if ('linear' in input) {
27
+ return ok({ linear: input.linear, translation: input.translation });
28
+ }
29
+ const [r0, r1, r2, r3] = input;
30
+ const TOL = 1e-10;
31
+ if (Math.abs(r3[0]) > TOL || Math.abs(r3[1]) > TOL || Math.abs(r3[2]) > TOL || Math.abs(r3[3] - 1) > TOL) {
32
+ return err(validationError(VALIDATION_FAILED, `applyMatrix: invalid bottom row [${String(r3[0])}, ${String(r3[1])}, ${String(r3[2])}, ${String(r3[3])}]. Must be [0, 0, 0, 1] for an affine transform.`));
33
+ }
34
+ return ok({
35
+ linear: [r0[0], r0[1], r0[2], r1[0], r1[1], r1[2], r2[0], r2[1], r2[2]],
36
+ translation: [r0[3], r1[3], r2[3]],
37
+ });
38
+ }
39
+ function det3x3(m) {
40
+ return (m[0] * (m[4] * m[8] - m[5] * m[7]) -
41
+ m[1] * (m[3] * m[8] - m[5] * m[6]) +
42
+ m[2] * (m[3] * m[7] - m[4] * m[6]));
43
+ }
44
+ // ---------------------------------------------------------------------------
45
+ // applyMatrix
46
+ // ---------------------------------------------------------------------------
47
+ const APPLY_MATRIX_PARAMS = { name: 'applyMatrix', params: ['shape', 'matrix'], formClass: 'A' };
48
+ /**
49
+ * Apply a 4×4 affine matrix (OpenSCAD `multmatrix` equivalent).
50
+ *
51
+ * The brepjs fn splits orthogonal (evolution-tracked) and non-orthogonal
52
+ * (`gp_GTrsf`) paths; `applyMatrix` carries identity naming and needs no face
53
+ * evolution, so the core path just needs the *right kernel path for the matrix
54
+ * class* — that dispatch (and its two traps) lives in `applyAffineBrep`:
55
+ *
56
+ * GOTCHA (2026-09-25): occt-wasm's `located`/`generalTransform` return
57
+ * TopLoc/GTrsf-referencing handles whose STEP export crashes ("memory access
58
+ * out of bounds") — the affine `transform` (BRepBuilderAPI_Transform,
59
+ * deep-copy) is the STEP-safe one.
60
+ *
61
+ * GOTCHA (2026-10-07, openscad example023 parity): routing a rigid rotation to
62
+ * `generalTransform` silently corrupts the *tessellation* of an
63
+ * already-meshed shape (top cap z 5 → 10, exact bbox unaffected). A rotation
64
+ * printed to 7 decimals (`0.8660254`) used to be misclassified as
65
+ * "non-similar" by an absolute 1e-9 tolerance and sent down that path.
66
+ * Two independent fixes came out of it: (1) the classification now uses a
67
+ * *relative* tolerance (`isSimilarityAffine`, engine-neutral); (2) occt's
68
+ * residual GTrsf tessellation defect is absorbed in the occt **adapter**
69
+ * (`occt-kernel/occt-primitives.ts#generalTransform`, copy-then-transform —
70
+ * brepkit's GTrsf already clones internally, so it never had the defect).
71
+ *
72
+ * @param args - Resolved arguments (shape, matrix).
73
+ * @returns The transformed shape as a `BrepHandle`.
74
+ */
75
+ export function applyMatrixBrep(...args) {
76
+ const [shape, matrix] = resolveArgs(args, APPLY_MATRIX_PARAMS);
77
+ const parsed = parseMatrixInput(matrix);
78
+ if (!parsed.ok)
79
+ return parsed;
80
+ const { linear, translation } = parsed.value;
81
+ if (Math.abs(det3x3(linear)) < 1e-12) {
82
+ return err(validationError(VALIDATION_FAILED, 'applyMatrix: singular matrix (determinant ≈0). Cannot apply a non-invertible transform.'));
83
+ }
84
+ const kernel = getBrepApi();
85
+ try {
86
+ const m12 = [
87
+ linear[0], linear[1], linear[2], translation[0],
88
+ linear[3], linear[4], linear[5], translation[1],
89
+ linear[6], linear[7], linear[8], translation[2],
90
+ ];
91
+ return ok(applyAffineBrep(kernel, brepHandleOf(shape), m12));
92
+ }
93
+ catch (e) {
94
+ return err(kernelError('APPLY_MATRIX_FAILED', `applyMatrix: kernel transform failed: ${e instanceof Error ? e.message : String(e)}`, e));
95
+ }
96
+ }
97
+ // ---------------------------------------------------------------------------
98
+ // clone
99
+ // ---------------------------------------------------------------------------
100
+ const CLONE_PARAMS = { name: 'clone', params: ['shape'], formClass: 'A' };
101
+ /**
102
+ * Deep-copy a shape (`kernel.copyShape`).
103
+ *
104
+ * @param args - Resolved arguments (shape).
105
+ * @returns The cloned shape as a `BrepHandle`.
106
+ */
107
+ export function cloneBrep(...args) {
108
+ const [shape] = resolveArgs(args, CLONE_PARAMS);
109
+ const kernel = getBrepApi();
110
+ try {
111
+ return ok(kernel.copyShape(brepHandleOf(shape)));
112
+ }
113
+ catch (e) {
114
+ return err(kernelError('CLONE_FAILED', `clone: kernel copy failed: ${e instanceof Error ? e.message : String(e)}`, e));
115
+ }
116
+ }
117
+ // ---------------------------------------------------------------------------
118
+ // locate
119
+ // ---------------------------------------------------------------------------
120
+ const LOCATE_PARAMS = { name: 'locate', params: ['shape', 'placement'], formClass: 'A' };
121
+ function opToMatrix(op) {
122
+ if (op.type === 'translate')
123
+ return translationMatrix(op.v);
124
+ const axis = op.axis ?? [0, 0, 1];
125
+ const center = op.center ?? [0, 0, 0];
126
+ return rotationMatrix(axis, center, op.angle);
127
+ }
128
+ /**
129
+ * Placement-only rigid move (translate/rotate) via the kernel's cheap location
130
+ * re-tag. Ops apply first-to-last (rotate then translate).
131
+ *
132
+ * @param args - Resolved arguments (shape, placement).
133
+ * @returns The relocated shape as a `BrepHandle`.
134
+ */
135
+ export function locateBrep(...args) {
136
+ const [shape, placement] = resolveArgs(args, LOCATE_PARAMS);
137
+ const ops = placement !== null && typeof placement === 'object' && 'type' in placement
138
+ ? [placement]
139
+ : placement;
140
+ const kernel = getBrepApi();
141
+ try {
142
+ let acc = [...IDENTITY_3X4];
143
+ for (const op of ops)
144
+ acc = composeAffine(acc, opToMatrix(op));
145
+ return ok(kernel.locate(brepHandleOf(shape), acc));
146
+ }
147
+ catch (e) {
148
+ return err(kernelError('LOCATE_FAILED', `locate: kernel locate failed: ${e instanceof Error ? e.message : String(e)}`, e));
149
+ }
150
+ }
151
+ // ---------------------------------------------------------------------------
152
+ // mirror
153
+ // ---------------------------------------------------------------------------
154
+ const MIRROR_PARAMS = { name: 'mirror', params: ['shape', 'options'], formClass: 'A' };
155
+ /**
156
+ * Mirror across a plane defined by `options.at` (origin) and `options.normal`.
157
+ *
158
+ * @param args - Resolved arguments (shape, mirror options).
159
+ * @returns The mirrored shape as a `BrepHandle`.
160
+ */
161
+ export function mirrorBrep(...args) {
162
+ const [shape, options] = resolveArgs(args, MIRROR_PARAMS);
163
+ const opts = (options ?? {});
164
+ const normal = opts.normal ?? [1, 0, 0];
165
+ const at = opts.at ?? [0, 0, 0];
166
+ const kernel = getBrepApi();
167
+ try {
168
+ return ok(kernel.mirror(brepHandleOf(shape), { x: at[0], y: at[1], z: at[2] }, { x: normal[0], y: normal[1], z: normal[2] }));
169
+ }
170
+ catch (e) {
171
+ return err(kernelError('MIRROR_FAILED', `mirror: kernel mirror failed: ${e instanceof Error ? e.message : String(e)}`, e));
172
+ }
173
+ }
174
+ // ---------------------------------------------------------------------------
175
+ // rotate — 绕轴旋转(brepjs topology/api.js#rotate + transformFns.ts#rotate)// ---------------------------------------------------------------------------
176
+ const ROTATE_PARAMS = { name: 'rotate', params: ['shape', 'angle', 'options'], formClass: 'A' };
177
+ /**
178
+ * Rotate the shape around an axis (brepjs topology/api.js#rotate + transformFns.ts#rotate).
179
+ *
180
+ * @param args - Resolved arguments (shape, angle in degrees, axis options).
181
+ * @returns The rotated shape as a `BrepHandle`.
182
+ */
183
+ export function rotateBrep(...args) {
184
+ const [shape, angle, options] = resolveArgs(args, ROTATE_PARAMS);
185
+ const s = brepHandleOf(shape);
186
+ const { at = [0, 0, 0], axis = [0, 0, 1] } = (options ?? {});
187
+ try {
188
+ // GOTCHA (2026-09-25): occt-wasm's native `rotate` returns a handle whose
189
+ // STEP export crashes ("memory access out of bounds") — same family as
190
+ // located/generalTransform. Rotation is affine, so build the Rodrigues
191
+ // matrix and go through the STEP-safe `transform` (BRepBuilderAPI_Transform).
192
+ // 2026-09-26: switched from getOcctKernel().transform to the L1 getBrepApi().transform
193
+ // so the op is engine-neutral (brepkit transform = cloneAndTransform deep-copy,
194
+ // same STEP-safe semantics) — see brepkit-batchA-fix.
195
+ const [ax, ay, az] = axis;
196
+ const alen = Math.hypot(ax, ay, az);
197
+ if (alen < 1e-12) {
198
+ return err(validationError('INVALID_AXIS', `rotate: axis must be non-zero, got [${ax}, ${ay}, ${az}]`));
199
+ }
200
+ const nx = ax / alen, ny = ay / alen, nz = az / alen;
201
+ const theta = (Number(angle) * Math.PI) / 180;
202
+ const c = Math.cos(theta), sTheta = Math.sin(theta), t = 1 - c;
203
+ // R = cI + sK + t·(n⊗n) (Rodrigues)
204
+ const r00 = t * nx * nx + c, r01 = t * nx * ny - nz * sTheta, r02 = t * nx * nz + ny * sTheta;
205
+ const r10 = t * nx * ny + nz * sTheta, r11 = t * ny * ny + c, r12 = t * ny * nz - nx * sTheta;
206
+ const r20 = t * nx * nz - ny * sTheta, r21 = t * ny * nz + nx * sTheta, r22 = t * nz * nz + c;
207
+ const [px, py, pz] = at;
208
+ // Pivot-preserving translation: p' = R·(p − at) + at ⇒ tx = at − R·at
209
+ const tx = px - (r00 * px + r01 * py + r02 * pz);
210
+ const ty = py - (r10 * px + r11 * py + r12 * pz);
211
+ const tz = pz - (r20 * px + r21 * py + r22 * pz);
212
+ const m12 = [r00, r01, r02, tx, r10, r11, r12, ty, r20, r21, r22, tz];
213
+ return ok(getBrepApi().transform(s, m12));
214
+ }
215
+ catch (e) {
216
+ const raw = e instanceof Error ? e.message : String(e);
217
+ return err(kernelError('ROTATE_FAILED', `Rotate operation failed: ${raw}`, e));
218
+ }
219
+ }
220
+ // ---------------------------------------------------------------------------
221
+ // shell — 去面掏空(brepjs topology/api.js#shell + modifierFns.ts#shell)// ---------------------------------------------------------------------------
222
+ const SHELL_PARAMS = { name: 'shell', params: ['shape', 'faces', 'thickness', 'options'], formClass: 'A' };
223
+ /**
224
+ * Shell — hollow the shape by removing faces (brepjs topology/api.js#shell + modifierFns.ts#shell).
225
+ *
226
+ * @param args - Resolved arguments (shape, faces, thickness, options).
227
+ * @returns The shelled (hollowed) shape as a `BrepHandle`.
228
+ */
229
+ export function shellBrep(...args) {
230
+ const [shape, faces, thickness, options] = resolveArgs(args, SHELL_PARAMS);
231
+ const kernel = getBrepApi();
232
+ const s = brepHandleOf(shape);
233
+ const t = Number(thickness);
234
+ if (t <= 0) {
235
+ return err(validationError('INVALID_THICKNESS', 'Shell thickness must be positive'));
236
+ }
237
+ if (!Array.isArray(faces) || faces.length === 0) {
238
+ return err(validationError('NO_FACES', 'At least one face must be specified for shell'));
239
+ }
240
+ const faceHandles = faces.map((f) => brepHandleOf(f));
241
+ const tolerance = (options ?? {}).tolerance ?? 1e-3;
242
+ try {
243
+ return ok(kernel.shell(s, faceHandles, t, tolerance));
244
+ }
245
+ catch (e) {
246
+ const raw = e instanceof Error ? e.message : String(e);
247
+ return err(kernelError('SHELL_FAILED', `Shell operation failed: ${raw}`, e));
248
+ }
249
+ }
250
+ // ---------------------------------------------------------------------------
251
+ // offset — 全表面偏移(brepjs topology/api.js#offset + modifierFns.ts#offset)// ---------------------------------------------------------------------------
252
+ const OFFSET_PARAMS = { name: 'offset', params: ['shape', 'distance', 'options'], formClass: 'A' };
253
+ /**
254
+ * Offset all faces of the shape (brepjs topology/api.js#offset + modifierFns.ts#offset).
255
+ *
256
+ * @param args - Resolved arguments (shape, distance, options).
257
+ * @returns The offset shape as a `BrepHandle`.
258
+ */
259
+ export function offsetBrep(...args) {
260
+ const [shape, distance, options] = resolveArgs(args, OFFSET_PARAMS);
261
+ const s = brepHandleOf(shape);
262
+ const d = Number(distance);
263
+ if (Math.abs(d) < 1e-10) {
264
+ return err(validationError('ZERO_OFFSET', 'Offset distance cannot be zero'));
265
+ }
266
+ const tolerance = (options ?? {}).tolerance ?? 1e-6;
267
+ try {
268
+ const h = getOcctKernel().offset(s, d, tolerance);
269
+ return ok(h);
270
+ }
271
+ catch (e) {
272
+ const raw = e instanceof Error ? e.message : String(e);
273
+ return err(kernelError('OFFSET_FAILED', `Offset operation failed: ${raw}`, e));
274
+ }
275
+ }
276
+ //# sourceMappingURL=topologyFns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topologyFns.js","sourceRoot":"","sources":["../../../src/api/brep-operations/topologyFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OA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A;IAC1B,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,gCAAgC,CAAC,CAAC,CAAA;IAC9E,CAAC;IACD,MAAM,SAAS,GAAI,CAAC,OAAO,IAAI,EAAE,CAA4B,CAAC,SAAS,IAAI,IAAI,CAAA;IAC/E,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,aAAa,EAAE,CAAC,MAAM,CAAC,CAAU,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;QAC1D,OAAO,EAAE,CAAC,CAA0B,CAAC,CAAA;IACvC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACtD,OAAO,GAAG,CAAC,WAAW,CAAC,eAAe,EAAE,4BAA4B,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAChF,CAAC;AACH,CAAC","sourcesContent":["/**\n * Self-hosted compat-op implementations — topology transform family\n * (core-decouple Phase 3, §5.4).\n *\n * @platform occt\n *\n * Each export is a \"brep-shaped\" implementation consumed by the generated\n * compat-op projection (defineOp + D11 arg normalization). Inputs are the\n * normalized positional arguments of the op's params table; shapes arrive as\n * faijs Shapes (or raw handles) and results are returned as BREP handles\n * (wrapped by `wrapBrepOne` → `fromHandle`).\n *\n * Semantics mirror the early brepjs fns (`topology/transformFns.ts`,\n * `topology/shapeFns.ts`) with the brepjs object model (castResultShape,\n * metadata propagation, evolution tracking) dropped: occt-wasm handles only.\n */\n\nimport type { BrepHandle } from '../../brep/engine/types'\nimport { getBrepApi } from '../../brep/handle-bridge'\nimport { ok, err, type Result } from '../../result/result'\nimport { kernelError, validationError } from '../../result/errors'\nimport type { FormClass } from '../internal/dual-form-args'\nimport { resolveArgs } from '../internal/dual-form-args'\nimport type { MatrixInput, Vec3 } from '../geom-types/types'\nimport { brepHandleOf, composeAffine, IDENTITY_3X4, rotationMatrix, translationMatrix } from './brepHelpers'\nimport { applyAffineBrep } from '../../brep/brep-ops'\nimport { getOcctKernel } from '../../occt-kernel/occtKernel'\n\nconst VALIDATION_FAILED = 'VALIDATION_FAILED'\n\n// ---------------------------------------------------------------------------\n// Matrix input parsing (brepjs `parseMatrixInput` / `det3x3`)\n// ---------------------------------------------------------------------------\n\ntype Linear3x3 = readonly [number, number, number, number, number, number, number, number, number]\n\nfunction parseMatrixInput(\n input: MatrixInput,\n): Result<{ linear: Linear3x3; translation: readonly [number, number, number] }> {\n if ('linear' in input) {\n return ok({ linear: input.linear, translation: input.translation })\n }\n const [r0, r1, r2, r3] = input\n const TOL = 1e-10\n if (Math.abs(r3[0]) > TOL || Math.abs(r3[1]) > TOL || Math.abs(r3[2]) > TOL || Math.abs(r3[3] - 1) > TOL) {\n return err(\n validationError(\n VALIDATION_FAILED,\n `applyMatrix: invalid bottom row [${String(r3[0])}, ${String(r3[1])}, ${String(r3[2])}, ${String(r3[3])}]. Must be [0, 0, 0, 1] for an affine transform.`,\n ),\n )\n }\n return ok({\n linear: [r0[0], r0[1], r0[2], r1[0], r1[1], r1[2], r2[0], r2[1], r2[2]],\n translation: [r0[3], r1[3], r2[3]],\n })\n}\n\nfunction det3x3(m: Linear3x3): number {\n return (\n m[0] * (m[4] * m[8] - m[5] * m[7]) -\n m[1] * (m[3] * m[8] - m[5] * m[6]) +\n m[2] * (m[3] * m[7] - m[4] * m[6])\n )\n}\n\n// ---------------------------------------------------------------------------\n// applyMatrix\n// ---------------------------------------------------------------------------\n\nconst APPLY_MATRIX_PARAMS = { name: 'applyMatrix', params: ['shape', 'matrix'], formClass: 'A' as FormClass }\n\n/**\n * Apply a 4×4 affine matrix (OpenSCAD `multmatrix` equivalent).\n *\n * The brepjs fn splits orthogonal (evolution-tracked) and non-orthogonal\n * (`gp_GTrsf`) paths; `applyMatrix` carries identity naming and needs no face\n * evolution, so the core path just needs the *right kernel path for the matrix\n * class* — that dispatch (and its two traps) lives in `applyAffineBrep`:\n *\n * GOTCHA (2026-09-25): occt-wasm's `located`/`generalTransform` return\n * TopLoc/GTrsf-referencing handles whose STEP export crashes (\"memory access\n * out of bounds\") — the affine `transform` (BRepBuilderAPI_Transform,\n * deep-copy) is the STEP-safe one.\n *\n * GOTCHA (2026-10-07, openscad example023 parity): routing a rigid rotation to\n * `generalTransform` silently corrupts the *tessellation* of an\n * already-meshed shape (top cap z 5 → 10, exact bbox unaffected). A rotation\n * printed to 7 decimals (`0.8660254`) used to be misclassified as\n * \"non-similar\" by an absolute 1e-9 tolerance and sent down that path.\n * Two independent fixes came out of it: (1) the classification now uses a\n * *relative* tolerance (`isSimilarityAffine`, engine-neutral); (2) occt's\n * residual GTrsf tessellation defect is absorbed in the occt **adapter**\n * (`occt-kernel/occt-primitives.ts#generalTransform`, copy-then-transform —\n * brepkit's GTrsf already clones internally, so it never had the defect).\n *\n * @param args - Resolved arguments (shape, matrix).\n * @returns The transformed shape as a `BrepHandle`.\n */\nexport function applyMatrixBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, matrix] = resolveArgs(args, APPLY_MATRIX_PARAMS)\n const parsed = parseMatrixInput(matrix as MatrixInput)\n if (!parsed.ok) return parsed\n const { linear, translation } = parsed.value\n if (Math.abs(det3x3(linear)) < 1e-12) {\n return err(\n validationError(\n VALIDATION_FAILED,\n 'applyMatrix: singular matrix (determinant ≈0). Cannot apply a non-invertible transform.',\n ),\n )\n }\n const kernel = getBrepApi()\n try {\n const m12 = [\n linear[0], linear[1], linear[2], translation[0],\n linear[3], linear[4], linear[5], translation[1],\n linear[6], linear[7], linear[8], translation[2],\n ]\n return ok(applyAffineBrep(kernel, brepHandleOf(shape), m12))\n } catch (e) {\n return err(\n kernelError(\n 'APPLY_MATRIX_FAILED',\n `applyMatrix: kernel transform failed: ${e instanceof Error ? e.message : String(e)}`,\n e,\n ),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// clone\n// ---------------------------------------------------------------------------\n\nconst CLONE_PARAMS = { name: 'clone', params: ['shape'], formClass: 'A' as FormClass }\n\n/**\n * Deep-copy a shape (`kernel.copyShape`).\n *\n * @param args - Resolved arguments (shape).\n * @returns The cloned shape as a `BrepHandle`.\n */\nexport function cloneBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape] = resolveArgs(args, CLONE_PARAMS)\n const kernel = getBrepApi()\n try {\n return ok(kernel.copyShape(brepHandleOf(shape)))\n } catch (e) {\n return err(\n kernelError(\n 'CLONE_FAILED',\n `clone: kernel copy failed: ${e instanceof Error ? e.message : String(e)}`,\n e,\n ),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// locate\n// ---------------------------------------------------------------------------\n\nconst LOCATE_PARAMS = { name: 'locate', params: ['shape', 'placement'], formClass: 'A' as FormClass }\n\ntype TransformOp =\n | { readonly type: 'translate'; readonly v: Vec3 }\n | { readonly type: 'rotate'; readonly angle: number; readonly axis?: Vec3; readonly center?: Vec3 }\n\nfunction opToMatrix(op: TransformOp): number[] {\n if (op.type === 'translate') return translationMatrix(op.v)\n const axis = op.axis ?? [0, 0, 1]\n const center = op.center ?? [0, 0, 0]\n return rotationMatrix(axis as Vec3, center as Vec3, op.angle)\n}\n\n/**\n * Placement-only rigid move (translate/rotate) via the kernel's cheap location\n * re-tag. Ops apply first-to-last (rotate then translate).\n *\n * @param args - Resolved arguments (shape, placement).\n * @returns The relocated shape as a `BrepHandle`.\n */\nexport function locateBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, placement] = resolveArgs(args, LOCATE_PARAMS)\n const ops: readonly TransformOp[] =\n placement !== null && typeof placement === 'object' && 'type' in (placement as object)\n ? [placement as TransformOp]\n : (placement as readonly TransformOp[])\n const kernel = getBrepApi()\n try {\n let acc: number[] = [...IDENTITY_3X4]\n for (const op of ops) acc = composeAffine(acc, opToMatrix(op))\n return ok(kernel.locate(brepHandleOf(shape), acc))\n } catch (e) {\n return err(\n kernelError(\n 'LOCATE_FAILED',\n `locate: kernel locate failed: ${e instanceof Error ? e.message : String(e)}`,\n e,\n ),\n )\n }\n}\n\n// ---------------------------------------------------------------------------\n// mirror\n// ---------------------------------------------------------------------------\n\nconst MIRROR_PARAMS = { name: 'mirror', params: ['shape', 'options'], formClass: 'A' as FormClass }\n\n/**\n * Mirror across a plane defined by `options.at` (origin) and `options.normal`.\n *\n * @param args - Resolved arguments (shape, mirror options).\n * @returns The mirrored shape as a `BrepHandle`.\n */\nexport function mirrorBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, options] = resolveArgs(args, MIRROR_PARAMS)\n const opts = (options ?? {}) as { normal?: Vec3; at?: Vec3 }\n const normal = opts.normal ?? [1, 0, 0]\n const at = opts.at ?? [0, 0, 0]\n const kernel = getBrepApi()\n try {\n return ok(kernel.mirror(brepHandleOf(shape), { x: at[0], y: at[1], z: at[2] }, { x: normal[0], y: normal[1], z: normal[2] }))\n } catch (e) {\n return err(\n kernelError(\n 'MIRROR_FAILED',\n `mirror: kernel mirror failed: ${e instanceof Error ? e.message : String(e)}`,\n e,\n ),\n )\n }\n}\n\n\n// ---------------------------------------------------------------------------\n// rotate — 绕轴旋转(brepjs topology/api.js#rotate + transformFns.ts#rotate)// ---------------------------------------------------------------------------\n\nconst ROTATE_PARAMS = { name: 'rotate', params: ['shape', 'angle', 'options'], formClass: 'A' as FormClass }\n\n/**\n * Rotate the shape around an axis (brepjs topology/api.js#rotate + transformFns.ts#rotate).\n *\n * @param args - Resolved arguments (shape, angle in degrees, axis options).\n * @returns The rotated shape as a `BrepHandle`.\n */\nexport function rotateBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, angle, options] = resolveArgs(args, ROTATE_PARAMS)\n const s = brepHandleOf(shape)\n const { at = [0, 0, 0], axis = [0, 0, 1] } = (options ?? {}) as { at?: Vec3; axis?: Vec3 }\n try {\n // GOTCHA (2026-09-25): occt-wasm's native `rotate` returns a handle whose\n // STEP export crashes (\"memory access out of bounds\") — same family as\n // located/generalTransform. Rotation is affine, so build the Rodrigues\n // matrix and go through the STEP-safe `transform` (BRepBuilderAPI_Transform).\n // 2026-09-26: switched from getOcctKernel().transform to the L1 getBrepApi().transform\n // so the op is engine-neutral (brepkit transform = cloneAndTransform deep-copy,\n // same STEP-safe semantics) — see brepkit-batchA-fix.\n const [ax, ay, az] = axis as readonly [number, number, number]\n const alen = Math.hypot(ax, ay, az)\n if (alen < 1e-12) {\n return err(validationError('INVALID_AXIS', `rotate: axis must be non-zero, got [${ax}, ${ay}, ${az}]`))\n }\n const nx = ax / alen, ny = ay / alen, nz = az / alen\n const theta = (Number(angle) * Math.PI) / 180\n const c = Math.cos(theta), sTheta = Math.sin(theta), t = 1 - c\n // R = cI + sK + t·(n⊗n) (Rodrigues)\n const r00 = t * nx * nx + c, r01 = t * nx * ny - nz * sTheta, r02 = t * nx * nz + ny * sTheta\n const r10 = t * nx * ny + nz * sTheta, r11 = t * ny * ny + c, r12 = t * ny * nz - nx * sTheta\n const r20 = t * nx * nz - ny * sTheta, r21 = t * ny * nz + nx * sTheta, r22 = t * nz * nz + c\n const [px, py, pz] = at as readonly [number, number, number]\n // Pivot-preserving translation: p' = R·(p − at) + at ⇒ tx = at − R·at\n const tx = px - (r00 * px + r01 * py + r02 * pz)\n const ty = py - (r10 * px + r11 * py + r12 * pz)\n const tz = pz - (r20 * px + r21 * py + r22 * pz)\n const m12 = [r00, r01, r02, tx, r10, r11, r12, ty, r20, r21, r22, tz]\n return ok(getBrepApi().transform(s, m12))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('ROTATE_FAILED', `Rotate operation failed: ${raw}`, e))\n }\n}\n\n// ---------------------------------------------------------------------------\n// shell — 去面掏空(brepjs topology/api.js#shell + modifierFns.ts#shell)// ---------------------------------------------------------------------------\n\nconst SHELL_PARAMS = { name: 'shell', params: ['shape', 'faces', 'thickness', 'options'], formClass: 'A' as FormClass }\n\n/**\n * Shell — hollow the shape by removing faces (brepjs topology/api.js#shell + modifierFns.ts#shell).\n *\n * @param args - Resolved arguments (shape, faces, thickness, options).\n * @returns The shelled (hollowed) shape as a `BrepHandle`.\n */\nexport function shellBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, faces, thickness, options] = resolveArgs(args, SHELL_PARAMS)\n const kernel = getBrepApi()\n const s = brepHandleOf(shape)\n const t = Number(thickness)\n if (t <= 0) {\n return err(validationError('INVALID_THICKNESS', 'Shell thickness must be positive'))\n }\n if (!Array.isArray(faces) || faces.length === 0) {\n return err(validationError('NO_FACES', 'At least one face must be specified for shell'))\n }\n const faceHandles = (faces as unknown[]).map((f) => brepHandleOf(f))\n const tolerance = ((options ?? {}) as { tolerance?: number }).tolerance ?? 1e-3\n try {\n return ok(kernel.shell(s, faceHandles, t, tolerance))\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('SHELL_FAILED', `Shell operation failed: ${raw}`, e))\n }\n}\n\n// ---------------------------------------------------------------------------\n// offset — 全表面偏移(brepjs topology/api.js#offset + modifierFns.ts#offset)// ---------------------------------------------------------------------------\n\nconst OFFSET_PARAMS = { name: 'offset', params: ['shape', 'distance', 'options'], formClass: 'A' as FormClass }\n\n/**\n * Offset all faces of the shape (brepjs topology/api.js#offset + modifierFns.ts#offset).\n *\n * @param args - Resolved arguments (shape, distance, options).\n * @returns The offset shape as a `BrepHandle`.\n */\nexport function offsetBrep(...args: unknown[]): Result<BrepHandle> {\n const [shape, distance, options] = resolveArgs(args, OFFSET_PARAMS)\n const s = brepHandleOf(shape)\n const d = Number(distance)\n if (Math.abs(d) < 1e-10) {\n return err(validationError('ZERO_OFFSET', 'Offset distance cannot be zero'))\n }\n const tolerance = ((options ?? {}) as { tolerance?: number }).tolerance ?? 1e-6\n try {\n const h = getOcctKernel().offset(s as never, d, tolerance)\n return ok(h as unknown as BrepHandle)\n } catch (e) {\n const raw = e instanceof Error ? e.message : String(e)\n return err(kernelError('OFFSET_FAILED', `Offset operation failed: ${raw}`, e))\n }\n}\n"]}
@@ -13,7 +13,7 @@
13
13
  * 不复刻 brepjs 符号名 / 法文枚举 / 包装句柄形态。
14
14
  */
15
15
  import type { Shape } from '../mesh/types.js';
16
- import type { Vec3 } from './brepjs-compat/types.js';
16
+ import type { Vec3 } from './geom-types/types.js';
17
17
  import type { CurveShape, SolidShape } from '../shape.js';
18
18
  import { type Result } from '../result/result.js';
19
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"brep-topology.d.ts","sourceRoot":"","sources":["../../src/api/brep-topology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAyBvD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAEnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,EAAE,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,CAM/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAE1D;AAMD;;;;;GAKG;AACH,wBA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import { getBrepApi } from '../brep/handle-bridge.js';
16
16
  import { getOcctKernel } from '../occt-kernel/occtKernel.js';
17
17
  import { fromBrep, fromBrepCurve } from '../shape.js';
18
- import { brepHandleOf } from './brep-mirror/brepHelpers.js';
18
+ import { brepHandleOf } from './brep-operations/brepHelpers.js';
19
19
  import { ok, err } from '../result/result.js';
20
20
  import { kernelError, validationError } from '../result/errors.js';
21
21
  /** An empty mesh payload for shapes that only carry a BREP handle. */
@@ -1 +1 @@
1
- {"version":3,"file":"brep-topology.js","sourceRoot":"","sources":["../../src/api/brep-topology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAGzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAe,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAE/D,sEAAsE;AACtE,MAAM,UAAU,GAAU,EAAE,SAAS,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;AAEzF,mFAAmF;AACnF,MAAM,SAAS,GAAG,CAAC,CAAa,EAAc,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;AAExF,iFAAiF;AACjF,MAAM,SAAS,GAAG,CAAC,CAAa,EAAc,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;AAEnF,yDAAyD;AACzD,MAAM,EAAE,GAAG,CAAC,CAAO,EAAuC,EAAE,CAAC,CAAC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AAC,CAAA;IACnG,CAAC;IACD,MAAM,KAAK,GAAiB,EAAE,CAAA;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC1B,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC5B,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED,8EAA8E;AAC9E,6DAA6D;AAC7D,4DAA4D;AAC5D,8EAA8E","sourcesContent":["/**\n * brep-topology — faijs BREP 拓扑查询 / 构造面(core-decouple wrapup §2.2)\n *\n * @platform occt — `outerWire` / `normalAt`(带点路径)走 occt 原生面\n * `getOcctKernel()`(occt-only 能力,未进 L1 中立契约);其余经 L1\n * `BrepEngineApi`。sheetmetal 钣金库改写的消费面(原 §5.8)。\n *\n * faijs 风格(wrapup §0.1 判据):全部同步;`Shape` 进、`Shape` 家族\n * (CurveShape/SolidShape)出——子形状可直接再喂回 faijs op(建模链\n * `face(...)` → `extrude(...)` 零适配);曲面类型为内核中立串\n * ('plane'/'cylinder'/…);错误用 faijs 第一方 `Result` + `BrepErrorCode`。\n * **不提供 brepjs 兼容面**(裁决 9:brepjs 兼容层不由本 monorepo 提供),\n * 不复刻 brepjs 符号名 / 法文枚举 / 包装句柄形态。\n */\n\nimport { getBrepApi } from '../brep/handle-bridge'\nimport type { BrepHandle } from '../brep/engine/types'\nimport { getOcctKernel } from '../occt-kernel/occtKernel'\nimport type { Shape } from '../mesh/types'\nimport type { Vec3 } from './brepjs-compat/types'\nimport { fromBrep, fromBrepCurve } from '../shape'\nimport type { CurveShape, SolidShape } from '../shape'\nimport { brepHandleOf } from './brep-mirror/brepHelpers'\nimport { ok, err, type Result } from '../result/result'\nimport { kernelError, validationError } from '../result/errors'\n\n/** An empty mesh payload for shapes that only carry a BREP handle. */\nconst EMPTY_MESH: Shape = { positions: new Float32Array(0), indices: new Uint32Array(0) }\n\n/** Wrap an engine handle as a faijs curve shape (edge / wire, no mesh payload). */\nconst wrapCurve = (h: BrepHandle): CurveShape => fromBrepCurve(EMPTY_MESH, { solid: h })\n\n/** Wrap an engine handle as a faijs solid shape (face etc., no mesh payload). */\nconst wrapSolid = (h: BrepHandle): SolidShape => fromBrep(EMPTY_MESH, { solid: h })\n\n/** Convert an array Vec3 to the engine's object Vec3. */\nconst v3 = (v: Vec3): { x: number; y: number; z: number } => ({ x: v[0], y: v[1], z: v[2] })\n\n/** Convert an engine object Vec3 to an array Vec3. */\nconst v3a = (v: { x: number; y: number; z: number }): Vec3 => [v.x, v.y, v.z]\n\n/** Extract the BREP handle from a faijs Shape (建模链产物,brepOf 提句柄). */\nconst asHandle = (shape: Shape): BrepHandle => brepHandleOf(shape)\n\n// ---------------------------------------------------------------------------\n// 拓扑查询(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Get all edges of a shape as faijs curve shapes.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the edge curve shapes of the shape.\n */\nexport function getEdges(shape: Shape): CurveShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'edge').map(wrapCurve)\n}\n\n/**\n * Get all faces of a shape as faijs solid shapes.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the face shapes of the shape.\n */\nexport function getFaces(shape: Shape): SolidShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'face').map(wrapSolid)\n}\n\n/**\n * Get all solids of a shape as faijs solid shapes.\n *\n * Booleans (`cut`/`fuse`) and some sweeps return a compound wrapping the\n * solid(s); use this to unwrap them without reaching into the kernel.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the solid shapes of the shape.\n */\nexport function getSolids(shape: Shape): SolidShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'solid').map(wrapSolid)\n}\n\n/**\n * Check whether a shape is a solid.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns true when the shape is a solid.\n */\nexport function isSolid(shape: Shape): boolean {\n return getBrepApi().isSolid(asHandle(shape))\n}\n\n/**\n * Axis-aligned bounding box of a shape from the BREP kernel.\n *\n * 说明:`cad.boundingBox` 只读 mesh 载荷(positions),brep 产物(空载荷)\n * 会得空盒;本出口直连引擎包围盒,供 sheetmetal 侧组合 `Bounds3D`。\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the bounding box min/max corner points.\n */\nexport function bounds3D(shape: Shape): { min: Vec3; max: Vec3 } {\n const b = getBrepApi().getBoundingBox(asHandle(shape))\n return {\n min: [b.xmin, b.ymin, b.zmin],\n max: [b.xmax, b.ymax, b.zmax],\n }\n}\n\n/**\n * Get the geometric surface type of a face (kernel neutral string).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @returns ok with the surface type ('plane' / 'cylinder' / 'sphere' / …).\n */\nexport function getSurfaceType(face: Shape): Result<string> {\n return ok(getBrepApi().surfaceType(asHandle(face)))\n}\n\n// ---------------------------------------------------------------------------\n// 曲线 / 曲面求值(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Get the start point of an edge or wire curve.\n *\n * @param shape - an edge/wire faijs Shape.\n * @returns the curve start point.\n */\nexport function curveStartPoint(shape: Shape): Vec3 {\n const h = asHandle(shape)\n const { first } = getBrepApi().curveParameters(h)\n return v3a(getBrepApi().curvePointAtParam(h, first))\n}\n\n/**\n * Get the end point of an edge or wire curve.\n *\n * @param shape - an edge/wire faijs Shape.\n * @returns the curve end point.\n */\nexport function curveEndPoint(shape: Shape): Vec3 {\n const h = asHandle(shape)\n const { last } = getBrepApi().curveParameters(h)\n return v3a(getBrepApi().curvePointAtParam(h, last))\n}\n\n/**\n * Get the center of mass of a face.\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @returns the face center point.\n */\nexport function faceCenter(face: Shape): Vec3 {\n return v3a(getBrepApi().surfaceCenterOfMass(asHandle(face)))\n}\n\n/**\n * Get the surface normal at a point (or at the UV-center when no point given).\n *\n * When a 3D point is given, it is projected to UV coordinates via the occt\n * native `uvFromPoint` (occt-only; falls back to UV origin when the projection\n * fails).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @param locationPoint - optional 3D point on the face.\n * @returns the surface normal at the location.\n */\nexport function normalAt(face: Shape, locationPoint?: Vec3): Vec3 {\n const h = asHandle(face)\n let u: number\n let v: number\n if (locationPoint === undefined) {\n const bounds = getBrepApi().uvBounds(h)\n u = 0.5 * (bounds.uMin + bounds.uMax)\n v = 0.5 * (bounds.vMin + bounds.vMax)\n } else {\n const uv = getOcctKernel().uvFromPoint(h as never, v3(locationPoint) as never)\n if (uv === undefined || uv === null || typeof uv.u !== 'number') {\n return v3a(getBrepApi().surfaceNormal(h, 0, 0))\n }\n u = uv.u\n v = uv.v\n }\n return v3a(getBrepApi().surfaceNormal(h, u, v))\n}\n\n/**\n * Get a point on a face surface at normalized UV coordinates (0-1 range).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @param u - normalized U parameter (0-1).\n * @param v - normalized V parameter (0-1).\n * @returns the surface point.\n */\nexport function pointOnSurface(face: Shape, u: number, v: number): Vec3 {\n const h = asHandle(face)\n const bounds = getBrepApi().uvBounds(h)\n const absU = u * (bounds.uMax - bounds.uMin) + bounds.uMin\n const absV = v * (bounds.vMax - bounds.vMin) + bounds.vMin\n return v3a(getBrepApi().pointOnSurface(h, absU, absV))\n}\n\n/**\n * Get the edges shared by two faces.\n *\n * @param a - first faijs face Shape.\n * @param b - second faijs face Shape.\n * @returns the shared edge curve shapes.\n */\nexport function sharedEdges(a: Shape, b: Shape): CurveShape[] {\n return getBrepApi().sharedEdges(asHandle(a), asHandle(b)).map(wrapCurve)\n}\n\n/**\n * Get the outer wire of a face (occt native `BRepTools::OuterWire`).\n *\n * @param face - a faijs face Shape.\n * @returns the outer wire curve shape.\n */\nexport function outerWire(face: Shape): CurveShape {\n return wrapCurve(getOcctKernel().outerWire(asHandle(face) as never) as unknown as BrepHandle)\n}\n\n// ---------------------------------------------------------------------------\n// 构造(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Create a line edge between two points.\n *\n * @param from - start point.\n * @param to - end point.\n * @returns the edge curve shape.\n */\nexport function line(from: Vec3, to: Vec3): CurveShape {\n return wrapCurve(getBrepApi().makeLineEdge(v3(from), v3(to)))\n}\n\n/**\n * Check whether a wire is closed (forms a loop).\n *\n * @param wire - a faijs wire Shape.\n * @returns true when the wire is closed.\n */\nexport function isClosedWire(wire: Shape): boolean {\n return getBrepApi().curveIsClosed(asHandle(wire))\n}\n\n/**\n * Assemble edges into a connected wire, open or closed (no closure check).\n *\n * Sheetmetal form cuts (louver U-cuts) are deliberately OPEN paths in the\n * developed plane — the fabricator leaves the hinge side uncut — so the\n * topology face must be able to produce a non-closed wire. {@link wireLoop}\n * adds the closure contract on top of this primitive.\n *\n * @param edges - ordered edge curve shapes to assemble.\n * @returns ok with the assembled wire shape, or WIRE_BUILD_FAILED.\n */\nexport function assembleWire(edges: Shape[]): Result<CurveShape> {\n let w: BrepHandle\n try {\n w = getBrepApi().makeWire(edges.map(asHandle))\n } catch (e) {\n return err(\n kernelError(\n 'WIRE_BUILD_FAILED',\n `Failed to build the wire: ${e instanceof Error ? e.message : 'unknown error'}`,\n e\n )\n )\n }\n return ok(wrapCurve(w))\n}\n\n/**\n * Assemble edges into a connected wire, requiring the result to be closed.\n *\n * @param edges - ordered edge curve shapes to assemble.\n * @returns ok with the closed wire shape, or WIRE_BUILD_FAILED /\n * WIRE_NOT_CLOSED.\n */\nexport function wireLoop(edges: Shape[]): Result<CurveShape> {\n let w: BrepHandle\n try {\n w = getBrepApi().makeWire(edges.map(asHandle))\n } catch (e) {\n return err(\n kernelError(\n 'WIRE_BUILD_FAILED',\n `Failed to build the wire: ${e instanceof Error ? e.message : 'unknown error'}`,\n e\n )\n )\n }\n if (!getBrepApi().curveIsClosed(w)) {\n return err(\n validationError(\n 'WIRE_NOT_CLOSED',\n 'Assembled wire is not closed: start and end points do not coincide'\n )\n )\n }\n return ok(wrapCurve(w))\n}\n\n/**\n * Check whether a wire is planar (all edges lie in a common plane).\n *\n * Strategy: try planar face construction; if it succeeds, verify the surface\n * type. A failure to build the face means the wire is not planar.\n *\n * @param wire - a faijs wire Shape.\n * @returns true when the wire is planar.\n */\nexport function isPlanarWire(wire: Shape): boolean {\n try {\n const f = getBrepApi().makeFace(asHandle(wire))\n const type = getBrepApi().surfaceType(f)\n try {\n getBrepApi().dispose(f)\n } catch {\n /* best-effort cleanup */\n }\n return type === 'plane'\n } catch {\n return false\n }\n}\n\n/**\n * Create a planar face from a closed wire, optionally with holes.\n *\n * The result is a faijs solid Shape carrying the face BREP handle, ready for\n * the modeling chain (`extrude` etc.).\n *\n * @param w - a closed planar wire Shape.\n * @param holes - optional hole wire Shapes.\n * @returns ok with the face shape, or FACE_BUILD_FAILED / FACE_NOT_PLANAR.\n */\nexport function face(w: Shape, holes?: Shape[]): Result<SolidShape> {\n let f: BrepHandle\n try {\n f = getBrepApi().makeFace(asHandle(w))\n if (holes !== undefined && holes.length > 0) {\n f = getBrepApi().addHolesInFace(f, holes.map(asHandle))\n }\n } catch (e) {\n return err(\n kernelError('FACE_BUILD_FAILED', 'Failed to build the face. Your wire might be non planar.', e)\n )\n }\n if (getBrepApi().surfaceType(f) !== 'plane') {\n return err(\n validationError('FACE_NOT_PLANAR', 'makeFace produced a non-planar face — wire may not be truly planar')\n )\n }\n return ok(wrapSolid(f))\n}\n\n/**\n * Create a polygonal face from three or more coplanar points.\n *\n * @param points - three or more coplanar points.\n * @returns ok with the face shape, or POLYGON_MIN_POINTS / wire / face errors.\n */\nexport function polygon(points: Vec3[]): Result<SolidShape> {\n if (points.length < 3) {\n return err(validationError('POLYGON_MIN_POINTS', 'You need at least 3 points to make a polygon'))\n }\n const edges: CurveShape[] = []\n for (let i = 0; i < points.length; i++) {\n const p1 = points[i]\n const p2 = points[(i + 1) % points.length]\n edges.push(line(p1, p2))\n }\n const wire = wireLoop(edges)\n if (!wire.ok) return wire\n return face(wire.value)\n}\n\n// ---------------------------------------------------------------------------\n// 测量(faijs 既有:api/generated/measurement.ts 的 measureVolume /\n// measureArea / measureLength 已在 api/index.ts 平铺;本面不重复导出)\n// ---------------------------------------------------------------------------\n"]}
1
+ {"version":3,"file":"brep-topology.js","sourceRoot":"","sources":["../../src/api/brep-topology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAGzD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,GAAG,EAAe,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAE/D,sEAAsE;AACtE,MAAM,UAAU,GAAU,EAAE,SAAS,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;AAEzF,mFAAmF;AACnF,MAAM,SAAS,GAAG,CAAC,CAAa,EAAc,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;AAExF,iFAAiF;AACjF,MAAM,SAAS,GAAG,CAAC,CAAa,EAAc,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,E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C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC,eAAe,CAAC,oBAAoB,EAAE,8CAA8C,CAAC,CAAC,CAAA;IACnG,CAAC;IACD,MAAM,KAAK,GAAiB,EAAE,CAAA;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;QAC1C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC1B,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC5B,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED,8EAA8E;AAC9E,6DAA6D;AAC7D,4DAA4D;AAC5D,8EAA8E","sourcesContent":["/**\n * brep-topology — faijs BREP 拓扑查询 / 构造面(core-decouple wrapup §2.2)\n *\n * @platform occt — `outerWire` / `normalAt`(带点路径)走 occt 原生面\n * `getOcctKernel()`(occt-only 能力,未进 L1 中立契约);其余经 L1\n * `BrepEngineApi`。sheetmetal 钣金库改写的消费面(原 §5.8)。\n *\n * faijs 风格(wrapup §0.1 判据):全部同步;`Shape` 进、`Shape` 家族\n * (CurveShape/SolidShape)出——子形状可直接再喂回 faijs op(建模链\n * `face(...)` → `extrude(...)` 零适配);曲面类型为内核中立串\n * ('plane'/'cylinder'/…);错误用 faijs 第一方 `Result` + `BrepErrorCode`。\n * **不提供 brepjs 兼容面**(裁决 9:brepjs 兼容层不由本 monorepo 提供),\n * 不复刻 brepjs 符号名 / 法文枚举 / 包装句柄形态。\n */\n\nimport { getBrepApi } from '../brep/handle-bridge'\nimport type { BrepHandle } from '../brep/engine/types'\nimport { getOcctKernel } from '../occt-kernel/occtKernel'\nimport type { Shape } from '../mesh/types'\nimport type { Vec3 } from './geom-types/types'\nimport { fromBrep, fromBrepCurve } from '../shape'\nimport type { CurveShape, SolidShape } from '../shape'\nimport { brepHandleOf } from './brep-operations/brepHelpers'\nimport { ok, err, type Result } from '../result/result'\nimport { kernelError, validationError } from '../result/errors'\n\n/** An empty mesh payload for shapes that only carry a BREP handle. */\nconst EMPTY_MESH: Shape = { positions: new Float32Array(0), indices: new Uint32Array(0) }\n\n/** Wrap an engine handle as a faijs curve shape (edge / wire, no mesh payload). */\nconst wrapCurve = (h: BrepHandle): CurveShape => fromBrepCurve(EMPTY_MESH, { solid: h })\n\n/** Wrap an engine handle as a faijs solid shape (face etc., no mesh payload). */\nconst wrapSolid = (h: BrepHandle): SolidShape => fromBrep(EMPTY_MESH, { solid: h })\n\n/** Convert an array Vec3 to the engine's object Vec3. */\nconst v3 = (v: Vec3): { x: number; y: number; z: number } => ({ x: v[0], y: v[1], z: v[2] })\n\n/** Convert an engine object Vec3 to an array Vec3. */\nconst v3a = (v: { x: number; y: number; z: number }): Vec3 => [v.x, v.y, v.z]\n\n/** Extract the BREP handle from a faijs Shape (建模链产物,brepOf 提句柄). */\nconst asHandle = (shape: Shape): BrepHandle => brepHandleOf(shape)\n\n// ---------------------------------------------------------------------------\n// 拓扑查询(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Get all edges of a shape as faijs curve shapes.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the edge curve shapes of the shape.\n */\nexport function getEdges(shape: Shape): CurveShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'edge').map(wrapCurve)\n}\n\n/**\n * Get all faces of a shape as faijs solid shapes.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the face shapes of the shape.\n */\nexport function getFaces(shape: Shape): SolidShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'face').map(wrapSolid)\n}\n\n/**\n * Get all solids of a shape as faijs solid shapes.\n *\n * Booleans (`cut`/`fuse`) and some sweeps return a compound wrapping the\n * solid(s); use this to unwrap them without reaching into the kernel.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the solid shapes of the shape.\n */\nexport function getSolids(shape: Shape): SolidShape[] {\n return getBrepApi().getSubShapes(asHandle(shape), 'solid').map(wrapSolid)\n}\n\n/**\n * Check whether a shape is a solid.\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns true when the shape is a solid.\n */\nexport function isSolid(shape: Shape): boolean {\n return getBrepApi().isSolid(asHandle(shape))\n}\n\n/**\n * Axis-aligned bounding box of a shape from the BREP kernel.\n *\n * 说明:`cad.boundingBox` 只读 mesh 载荷(positions),brep 产物(空载荷)\n * 会得空盒;本出口直连引擎包围盒,供 sheetmetal 侧组合 `Bounds3D`。\n *\n * @param shape - a faijs Shape on the BREP chain.\n * @returns the bounding box min/max corner points.\n */\nexport function bounds3D(shape: Shape): { min: Vec3; max: Vec3 } {\n const b = getBrepApi().getBoundingBox(asHandle(shape))\n return {\n min: [b.xmin, b.ymin, b.zmin],\n max: [b.xmax, b.ymax, b.zmax],\n }\n}\n\n/**\n * Get the geometric surface type of a face (kernel neutral string).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @returns ok with the surface type ('plane' / 'cylinder' / 'sphere' / …).\n */\nexport function getSurfaceType(face: Shape): Result<string> {\n return ok(getBrepApi().surfaceType(asHandle(face)))\n}\n\n// ---------------------------------------------------------------------------\n// 曲线 / 曲面求值(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Get the start point of an edge or wire curve.\n *\n * @param shape - an edge/wire faijs Shape.\n * @returns the curve start point.\n */\nexport function curveStartPoint(shape: Shape): Vec3 {\n const h = asHandle(shape)\n const { first } = getBrepApi().curveParameters(h)\n return v3a(getBrepApi().curvePointAtParam(h, first))\n}\n\n/**\n * Get the end point of an edge or wire curve.\n *\n * @param shape - an edge/wire faijs Shape.\n * @returns the curve end point.\n */\nexport function curveEndPoint(shape: Shape): Vec3 {\n const h = asHandle(shape)\n const { last } = getBrepApi().curveParameters(h)\n return v3a(getBrepApi().curvePointAtParam(h, last))\n}\n\n/**\n * Get the center of mass of a face.\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @returns the face center point.\n */\nexport function faceCenter(face: Shape): Vec3 {\n return v3a(getBrepApi().surfaceCenterOfMass(asHandle(face)))\n}\n\n/**\n * Get the surface normal at a point (or at the UV-center when no point given).\n *\n * When a 3D point is given, it is projected to UV coordinates via the occt\n * native `uvFromPoint` (occt-only; falls back to UV origin when the projection\n * fails).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @param locationPoint - optional 3D point on the face.\n * @returns the surface normal at the location.\n */\nexport function normalAt(face: Shape, locationPoint?: Vec3): Vec3 {\n const h = asHandle(face)\n let u: number\n let v: number\n if (locationPoint === undefined) {\n const bounds = getBrepApi().uvBounds(h)\n u = 0.5 * (bounds.uMin + bounds.uMax)\n v = 0.5 * (bounds.vMin + bounds.vMax)\n } else {\n const uv = getOcctKernel().uvFromPoint(h as never, v3(locationPoint) as never)\n if (uv === undefined || uv === null || typeof uv.u !== 'number') {\n return v3a(getBrepApi().surfaceNormal(h, 0, 0))\n }\n u = uv.u\n v = uv.v\n }\n return v3a(getBrepApi().surfaceNormal(h, u, v))\n}\n\n/**\n * Get a point on a face surface at normalized UV coordinates (0-1 range).\n *\n * @param face - a faijs face Shape (from `getFaces`).\n * @param u - normalized U parameter (0-1).\n * @param v - normalized V parameter (0-1).\n * @returns the surface point.\n */\nexport function pointOnSurface(face: Shape, u: number, v: number): Vec3 {\n const h = asHandle(face)\n const bounds = getBrepApi().uvBounds(h)\n const absU = u * (bounds.uMax - bounds.uMin) + bounds.uMin\n const absV = v * (bounds.vMax - bounds.vMin) + bounds.vMin\n return v3a(getBrepApi().pointOnSurface(h, absU, absV))\n}\n\n/**\n * Get the edges shared by two faces.\n *\n * @param a - first faijs face Shape.\n * @param b - second faijs face Shape.\n * @returns the shared edge curve shapes.\n */\nexport function sharedEdges(a: Shape, b: Shape): CurveShape[] {\n return getBrepApi().sharedEdges(asHandle(a), asHandle(b)).map(wrapCurve)\n}\n\n/**\n * Get the outer wire of a face (occt native `BRepTools::OuterWire`).\n *\n * @param face - a faijs face Shape.\n * @returns the outer wire curve shape.\n */\nexport function outerWire(face: Shape): CurveShape {\n return wrapCurve(getOcctKernel().outerWire(asHandle(face) as never) as unknown as BrepHandle)\n}\n\n// ---------------------------------------------------------------------------\n// 构造(同步)\n// ---------------------------------------------------------------------------\n\n/**\n * Create a line edge between two points.\n *\n * @param from - start point.\n * @param to - end point.\n * @returns the edge curve shape.\n */\nexport function line(from: Vec3, to: Vec3): CurveShape {\n return wrapCurve(getBrepApi().makeLineEdge(v3(from), v3(to)))\n}\n\n/**\n * Check whether a wire is closed (forms a loop).\n *\n * @param wire - a faijs wire Shape.\n * @returns true when the wire is closed.\n */\nexport function isClosedWire(wire: Shape): boolean {\n return getBrepApi().curveIsClosed(asHandle(wire))\n}\n\n/**\n * Assemble edges into a connected wire, open or closed (no closure check).\n *\n * Sheetmetal form cuts (louver U-cuts) are deliberately OPEN paths in the\n * developed plane — the fabricator leaves the hinge side uncut — so the\n * topology face must be able to produce a non-closed wire. {@link wireLoop}\n * adds the closure contract on top of this primitive.\n *\n * @param edges - ordered edge curve shapes to assemble.\n * @returns ok with the assembled wire shape, or WIRE_BUILD_FAILED.\n */\nexport function assembleWire(edges: Shape[]): Result<CurveShape> {\n let w: BrepHandle\n try {\n w = getBrepApi().makeWire(edges.map(asHandle))\n } catch (e) {\n return err(\n kernelError(\n 'WIRE_BUILD_FAILED',\n `Failed to build the wire: ${e instanceof Error ? e.message : 'unknown error'}`,\n e\n )\n )\n }\n return ok(wrapCurve(w))\n}\n\n/**\n * Assemble edges into a connected wire, requiring the result to be closed.\n *\n * @param edges - ordered edge curve shapes to assemble.\n * @returns ok with the closed wire shape, or WIRE_BUILD_FAILED /\n * WIRE_NOT_CLOSED.\n */\nexport function wireLoop(edges: Shape[]): Result<CurveShape> {\n let w: BrepHandle\n try {\n w = getBrepApi().makeWire(edges.map(asHandle))\n } catch (e) {\n return err(\n kernelError(\n 'WIRE_BUILD_FAILED',\n `Failed to build the wire: ${e instanceof Error ? e.message : 'unknown error'}`,\n e\n )\n )\n }\n if (!getBrepApi().curveIsClosed(w)) {\n return err(\n validationError(\n 'WIRE_NOT_CLOSED',\n 'Assembled wire is not closed: start and end points do not coincide'\n )\n )\n }\n return ok(wrapCurve(w))\n}\n\n/**\n * Check whether a wire is planar (all edges lie in a common plane).\n *\n * Strategy: try planar face construction; if it succeeds, verify the surface\n * type. A failure to build the face means the wire is not planar.\n *\n * @param wire - a faijs wire Shape.\n * @returns true when the wire is planar.\n */\nexport function isPlanarWire(wire: Shape): boolean {\n try {\n const f = getBrepApi().makeFace(asHandle(wire))\n const type = getBrepApi().surfaceType(f)\n try {\n getBrepApi().dispose(f)\n } catch {\n /* best-effort cleanup */\n }\n return type === 'plane'\n } catch {\n return false\n }\n}\n\n/**\n * Create a planar face from a closed wire, optionally with holes.\n *\n * The result is a faijs solid Shape carrying the face BREP handle, ready for\n * the modeling chain (`extrude` etc.).\n *\n * @param w - a closed planar wire Shape.\n * @param holes - optional hole wire Shapes.\n * @returns ok with the face shape, or FACE_BUILD_FAILED / FACE_NOT_PLANAR.\n */\nexport function face(w: Shape, holes?: Shape[]): Result<SolidShape> {\n let f: BrepHandle\n try {\n f = getBrepApi().makeFace(asHandle(w))\n if (holes !== undefined && holes.length > 0) {\n f = getBrepApi().addHolesInFace(f, holes.map(asHandle))\n }\n } catch (e) {\n return err(\n kernelError('FACE_BUILD_FAILED', 'Failed to build the face. Your wire might be non planar.', e)\n )\n }\n if (getBrepApi().surfaceType(f) !== 'plane') {\n return err(\n validationError('FACE_NOT_PLANAR', 'makeFace produced a non-planar face — wire may not be truly planar')\n )\n }\n return ok(wrapSolid(f))\n}\n\n/**\n * Create a polygonal face from three or more coplanar points.\n *\n * @param points - three or more coplanar points.\n * @returns ok with the face shape, or POLYGON_MIN_POINTS / wire / face errors.\n */\nexport function polygon(points: Vec3[]): Result<SolidShape> {\n if (points.length < 3) {\n return err(validationError('POLYGON_MIN_POINTS', 'You need at least 3 points to make a polygon'))\n }\n const edges: CurveShape[] = []\n for (let i = 0; i < points.length; i++) {\n const p1 = points[i]\n const p2 = points[(i + 1) % points.length]\n edges.push(line(p1, p2))\n }\n const wire = wireLoop(edges)\n if (!wire.ok) return wire\n return face(wire.value)\n}\n\n// ---------------------------------------------------------------------------\n// 测量(faijs 既有:api/generated/measurement.ts 的 measureVolume /\n// measureArea / measureLength 已在 api/index.ts 平铺;本面不重复导出)\n// ---------------------------------------------------------------------------\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BREP-TS compatibility surface (P21) — 2026-09-25 core-decouple rewrite.
3
3
  *
4
- * The vendored BREP TS tree (packages/brepjs) is deleted (裁决 9). Every
4
+ * The old BREP TS tree (packages/brepjs) is deleted (裁决 9). Every
5
5
  * op projection (primitives / booleans / evolutions / topology queries /
6
6
  * sketching DSL / raw 2D-morph ports) is gone with it — those symbols have no
7
7
  * receiver (裁决 1). What remains in this module is the ④ group only: the pure
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BREP-TS compatibility surface (P21) — 2026-09-25 core-decouple rewrite.
3
3
  *
4
- * The vendored BREP TS tree (packages/brepjs) is deleted (裁决 9). Every
4
+ * The old BREP TS tree (packages/brepjs) is deleted (裁决 9). Every
5
5
  * op projection (primitives / booleans / evolutions / topology queries /
6
6
  * sketching DSL / raw 2D-morph ports) is gone with it — those symbols have no
7
7
  * receiver (裁决 1). What remains in this module is the ④ group only: the pure
@@ -11,8 +11,8 @@
11
11
  */
12
12
  // ─────────────────────────────────────────────────────────────────────────────
13
13
  // ④ combinators / pure helpers / types(2026-09-25 core-decouple:op 投影面
14
- // ① ② ③ ⑤ 已随 vendored 树删除;④ 全部为 core 内联实现,保留为本文件的
15
- // 唯一内容。vendored 句柄类型(Vertex/Edge/…/Shape3D/ValidSolid)随裁决 9 删除)
14
+ // ① ② ③ ⑤ 已随旧子包删除;④ 全部为 core 内联实现,保留为本文件的
15
+ // 唯一内容。旧句柄类型(Vertex/Edge/…/Shape3D/ValidSolid)随裁决 9 删除)
16
16
  // ─────────────────────────────────────────────────────────────────────────────
17
17
  export { ok, err, isOk, isErr, unwrap, unwrapOr, map, andThen, } from '../../result/result.js';
18
18
  export { vecAdd, vecSub, vecScale, vecDot, vecCross, vecLength, vecNormalize, } from './vecOps.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/brepjs-compat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,uEAAuE;AACvE,kDAAkD;AAClD,gEAAgE;AAChE,gFAAgF;AAEhF,OAAO,EACL,EAAE,EACF,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGlE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA","sourcesContent":["/**\n * BREP-TS compatibility surface (P21) — 2026-09-25 core-decouple rewrite.\n *\n * The vendored BREP TS tree (packages/brepjs) is deleted (裁决 9). Every\n * op projection (primitives / booleans / evolutions / topology queries /\n * sketching DSL / raw 2D-morph ports) is gone with it — those symbols have no\n * receiver (裁决 1). What remains in this module is the ④ group only: the pure\n * combinators / types inlined into core (§5.2) — Result, vectors, planes,\n * errors, constants — which stay flat-exported from the core facade for\n * library authors (import { ok, vecAdd } from '@faicad/faijs').\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ④ combinators / pure helpers / types(2026-09-25 core-decouple:op 投影面\n// ① ② ③ ⑤ 已随 vendored 树删除;④ 全部为 core 内联实现,保留为本文件的\n// 唯一内容。vendored 句柄类型(Vertex/Edge/…/Shape3D/ValidSolid)随裁决 9 删除)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport {\n ok,\n err,\n isOk,\n isErr,\n unwrap,\n unwrapOr,\n map,\n andThen,\n} from '../../result/result'\nexport type { Result, Ok, Err } from '../../result/result'\n\nexport {\n vecAdd,\n vecSub,\n vecScale,\n vecDot,\n vecCross,\n vecLength,\n vecNormalize,\n} from './vecOps'\n\nexport {\n createPlane,\n createNamedPlane,\n resolvePlane,\n} from './planeOps'\n\nexport { kernelError, validationError } from '../../result/errors'\nexport type { BrepError } from '../../result/errors'\n\nexport { DEG2RAD, RAD2DEG } from './constants'\n\nexport type { Plane, PlaneName, PlaneInput } from './planeTypes'\n\nexport type { Vec3, PointInput } from './types'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/brepjs-compat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,uEAAuE;AACvE,0CAA0C;AAC1C,wDAAwD;AACxD,gFAAgF;AAEhF,OAAO,EACL,EAAE,EACF,GAAG,EACH,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGlE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA","sourcesContent":["/**\n * BREP-TS compatibility surface (P21) — 2026-09-25 core-decouple rewrite.\n *\n * The old BREP TS tree (packages/brepjs) is deleted (裁决 9). Every\n * op projection (primitives / booleans / evolutions / topology queries /\n * sketching DSL / raw 2D-morph ports) is gone with it — those symbols have no\n * receiver (裁决 1). What remains in this module is the ④ group only: the pure\n * combinators / types inlined into core (§5.2) — Result, vectors, planes,\n * errors, constants — which stay flat-exported from the core facade for\n * library authors (import { ok, vecAdd } from '@faicad/faijs').\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// ④ combinators / pure helpers / types(2026-09-25 core-decouple:op 投影面\n// ① ② ③ ⑤ 已随旧子包删除;④ 全部为 core 内联实现,保留为本文件的\n// 唯一内容。旧句柄类型(Vertex/Edge/…/Shape3D/ValidSolid)随裁决 9 删除)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport {\n ok,\n err,\n isOk,\n isErr,\n unwrap,\n unwrapOr,\n map,\n andThen,\n} from '../../result/result'\nexport type { Result, Ok, Err } from '../../result/result'\n\nexport {\n vecAdd,\n vecSub,\n vecScale,\n vecDot,\n vecCross,\n vecLength,\n vecNormalize,\n} from './vecOps'\n\nexport {\n createPlane,\n createNamedPlane,\n resolvePlane,\n} from './planeOps'\n\nexport { kernelError, validationError } from '../../result/errors'\nexport type { BrepError } from '../../result/errors'\n\nexport { DEG2RAD, RAD2DEG } from './constants'\n\nexport type { Plane, PlaneName, PlaneInput } from './planeTypes'\n\nexport type { Vec3, PointInput } from './types'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"borrow-bridge.d.ts","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/borrow-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAuB7C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAgB7C"}
1
+ {"version":3,"file":"borrow-bridge.d.ts","sourceRoot":"","sources":["../../../src/api/cadquery-selectors/borrow-bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAsB7C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAgB7C"}