brepjs 18.6.0 → 18.14.3

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 (656) hide show
  1. package/README.md +6 -0
  2. package/dist/{sketching/sketcher2d.d.ts → 2d/blueprints/baseSketcher2d.d.ts} +4 -91
  3. package/dist/2d/blueprints/blueprint.d.ts +0 -1
  4. package/dist/2d/blueprints/blueprintApproximations.d.ts +0 -1
  5. package/dist/2d/blueprints/blueprintCustomCorners.d.ts +0 -1
  6. package/dist/2d/blueprints/blueprintFns.d.ts +0 -1
  7. package/dist/2d/blueprints/blueprintOffset.d.ts +0 -1
  8. package/dist/2d/blueprints/blueprintSketcher.d.ts +29 -0
  9. package/dist/2d/blueprints/blueprints.d.ts +0 -1
  10. package/dist/2d/blueprints/boolean2D.d.ts +0 -1
  11. package/dist/2d/blueprints/booleanHelpers.d.ts +0 -1
  12. package/dist/2d/blueprints/booleanOperations.d.ts +0 -1
  13. package/dist/2d/blueprints/cannedBlueprints.d.ts +0 -1
  14. package/dist/2d/blueprints/compoundBlueprint.d.ts +0 -1
  15. package/dist/{sketching → 2d/blueprints}/ellipseUtils.d.ts +19 -2
  16. package/dist/{sketching/sketcherlib.d.ts → 2d/blueprints/genericSketcher.d.ts} +1 -20
  17. package/dist/2d/blueprints/index.d.ts +0 -1
  18. package/dist/2d/blueprints/intersectionSegments.d.ts +0 -1
  19. package/dist/2d/blueprints/lib.d.ts +0 -1
  20. package/dist/2d/blueprints/segmentAssembly.d.ts +0 -1
  21. package/dist/2d/blueprints/svg.d.ts +0 -1
  22. package/dist/2d/curve2dGeometryFns.d.ts +0 -1
  23. package/dist/2d/curves.d.ts +0 -1
  24. package/dist/2d/lib/approximations.d.ts +0 -1
  25. package/dist/2d/lib/boundingBox2d.d.ts +0 -1
  26. package/dist/2d/lib/curve2D.d.ts +0 -1
  27. package/dist/2d/lib/curve2dFns.d.ts +0 -1
  28. package/dist/2d/lib/customCorners.d.ts +0 -1
  29. package/dist/2d/lib/definitions.d.ts +0 -1
  30. package/dist/2d/lib/index.d.ts +0 -1
  31. package/dist/2d/lib/intersections.d.ts +0 -1
  32. package/dist/2d/lib/makeCurves.d.ts +0 -1
  33. package/dist/2d/lib/offset.d.ts +0 -1
  34. package/dist/2d/lib/precision.d.ts +0 -1
  35. package/dist/2d/lib/stitching.d.ts +0 -1
  36. package/dist/2d/lib/svgPath.d.ts +0 -1
  37. package/dist/2d/lib/utils.d.ts +0 -1
  38. package/dist/2d/lib/vectorOperations.d.ts +0 -1
  39. package/dist/2d.cjs +20 -19
  40. package/dist/2d.d.ts +0 -1
  41. package/dist/2d.js +7 -6
  42. package/dist/{blueprint-CscZ0-wr.cjs → blueprint-B8ogGJiQ.cjs} +16 -15
  43. package/dist/{blueprint-BCoJbaQN.js → blueprint-Dv45Evnu.js} +16 -15
  44. package/dist/{blueprintFns-DQP4KQHE.cjs → blueprintFns-BK3FYYjO.cjs} +4 -4
  45. package/dist/{blueprintFns-BZlx6BjG.js → blueprintFns-a9C2g8_E.js} +3 -3
  46. package/dist/{boolean2D-k1AJmCMp.cjs → blueprintSketcher-Bei866Bt.cjs} +65 -1383
  47. package/dist/{boolean2D-JvgjbESt.js → blueprintSketcher-xDsl9GXO.js} +70 -1316
  48. package/dist/boolean2D-DGuiEJHA.cjs +902 -0
  49. package/dist/boolean2D-Z7P0c012.js +855 -0
  50. package/dist/{booleanFns-D13Pb-NO.js → booleanFns-CRa80qMX.js} +9 -9
  51. package/dist/{booleanFns-DQW4lt7H.cjs → booleanFns-qmgMQyDl.cjs} +12 -12
  52. package/dist/brepjs.cjs +772 -112
  53. package/dist/brepjs.js +692 -42
  54. package/dist/cameraFns-1y1NyACI.cjs +315 -0
  55. package/dist/cameraFns-CUzI5RKS.js +274 -0
  56. package/dist/core/constants.d.ts +0 -1
  57. package/dist/core/curve2dHandle.d.ts +0 -1
  58. package/dist/core/dimensionTypes.d.ts +0 -1
  59. package/dist/core/disposal.d.ts +0 -1
  60. package/dist/core/errors.d.ts +0 -1
  61. package/dist/core/kernelBoundary.d.ts +0 -1
  62. package/dist/core/kernelCall.d.ts +0 -1
  63. package/dist/core/kernelErrorTranslation.d.ts +0 -1
  64. package/dist/core/planeOps.d.ts +0 -1
  65. package/dist/core/planeTypes.d.ts +0 -1
  66. package/dist/core/result.d.ts +0 -1
  67. package/dist/core/shapeTypeCache.d.ts +0 -1
  68. package/dist/core/shapeTypes.d.ts +0 -1
  69. package/dist/core/typeDiscriminants.d.ts +0 -1
  70. package/dist/core/types.d.ts +0 -1
  71. package/dist/core/validityTypes.d.ts +0 -1
  72. package/dist/core/vecOps.d.ts +0 -1
  73. package/dist/core.cjs +6 -6
  74. package/dist/core.d.ts +0 -1
  75. package/dist/core.js +6 -6
  76. package/dist/{cornerFinder-5BYE2cbd.cjs → cornerFinder-CC8EBRCR.cjs} +3 -3
  77. package/dist/{cornerFinder-Zg7pf2s0.js → cornerFinder-Dix2ghke.js} +3 -3
  78. package/dist/{curveFns-DhqUp0EI.js → curveFns-B4tWuinR.js} +2 -2
  79. package/dist/{curveFns-DrT54cm8.cjs → curveFns-CD20-4fM.cjs} +2 -2
  80. package/dist/{drawFns-lUXjhTYL.js → drawFns-BsarLfUN.js} +163 -769
  81. package/dist/{drawFns-DmP2o1oF.cjs → drawFns-LlOZoFyp.cjs} +203 -985
  82. package/dist/{errors-DboJwVCf.js → errors-0fYW_YnO.js} +2 -1
  83. package/dist/{errors-CXRNVCec.cjs → errors-Dv6pfNct.cjs} +2 -1
  84. package/dist/{extrudeFns-B9bVCt3C.js → extrudeFns-7pE8dIWz.js} +3 -3
  85. package/dist/{extrudeFns-BtblHdaJ.cjs → extrudeFns-DD36mWKv.cjs} +3 -3
  86. package/dist/faceFns-BFWz17_E.js +218 -0
  87. package/dist/faceFns-DP7i60yJ.cjs +343 -0
  88. package/dist/gear/gearFns.d.ts +129 -0
  89. package/dist/gear/gearMath.d.ts +88 -0
  90. package/dist/gear/gearProfile.d.ts +16 -0
  91. package/dist/gear/index.d.ts +3 -0
  92. package/dist/{helpers-BpXNcxuJ.cjs → helpers-Cyj6gaqy.cjs} +14 -13
  93. package/dist/{helpers-S_Ht6gwX.js → helpers-vV2ONZwD.js} +9 -8
  94. package/dist/{historyFns-B01hrkcJ.js → historyFns-DGb61ETW.js} +6 -6
  95. package/dist/{historyFns-RHO-QvEZ.cjs → historyFns-DfyrPjnK.cjs} +6 -6
  96. package/dist/{importFns-CG49lyTm.cjs → importFns-C-p0vl_h.cjs} +11 -19
  97. package/dist/{importFns-C0tUyeiW.js → importFns-Ci-L2iB3.js} +11 -19
  98. package/dist/index.d.ts +16 -8
  99. package/dist/io/dxfExportFns.d.ts +0 -1
  100. package/dist/io/dxfImportFns.d.ts +0 -1
  101. package/dist/io/gltfExportFns.d.ts +0 -1
  102. package/dist/io/gltfImportFns.d.ts +0 -1
  103. package/dist/io/importFns.d.ts +0 -1
  104. package/dist/io/ioUtils.d.ts +0 -1
  105. package/dist/io/objExportFns.d.ts +0 -1
  106. package/dist/io/objImportFns.d.ts +0 -1
  107. package/dist/io/stepConfigFns.d.ts +0 -1
  108. package/dist/io/svgImportFns.d.ts +0 -1
  109. package/dist/io/threemfExportFns.d.ts +0 -1
  110. package/dist/io/threemfImportFns.d.ts +0 -1
  111. package/dist/io.cjs +2 -2
  112. package/dist/io.d.ts +0 -1
  113. package/dist/io.js +2 -2
  114. package/dist/kernel/brepkit/booleanOps.d.ts +23 -1
  115. package/dist/kernel/brepkit/brepkitAdapter.d.ts +21 -408
  116. package/dist/kernel/brepkit/brepkitWasmTypes.d.ts +0 -1
  117. package/dist/kernel/brepkit/constructionOps.d.ts +51 -1
  118. package/dist/kernel/brepkit/evolutionOps.d.ts +34 -3
  119. package/dist/kernel/brepkit/geometryOps.d.ts +63 -2
  120. package/dist/kernel/brepkit/helpers.d.ts +6 -1
  121. package/dist/kernel/brepkit/internalOps.d.ts +0 -1
  122. package/dist/kernel/brepkit/ioOps.d.ts +47 -9
  123. package/dist/kernel/brepkit/kernel2dOps.d.ts +113 -1
  124. package/dist/kernel/brepkit/measureOps.d.ts +39 -1
  125. package/dist/kernel/brepkit/meshOps.d.ts +7 -1
  126. package/dist/kernel/brepkit/modifierOps.d.ts +15 -1
  127. package/dist/kernel/brepkit/repairOps.d.ts +14 -1
  128. package/dist/kernel/brepkit/sketchOps.d.ts +3 -1
  129. package/dist/kernel/brepkit/sweepOps.d.ts +37 -1
  130. package/dist/kernel/brepkit/topologyOps.d.ts +16 -1
  131. package/dist/kernel/brepkit/transformOps.d.ts +18 -1
  132. package/dist/kernel/geometry2d.d.ts +0 -1
  133. package/dist/kernel/index.d.ts +0 -1
  134. package/dist/kernel/interfaces/booleanOps.d.ts +0 -1
  135. package/dist/kernel/interfaces/builderOps.d.ts +0 -1
  136. package/dist/kernel/interfaces/core.d.ts +0 -1
  137. package/dist/kernel/interfaces/curveOps.d.ts +0 -1
  138. package/dist/kernel/interfaces/evolutionOps.d.ts +0 -1
  139. package/dist/kernel/interfaces/index.d.ts +0 -1
  140. package/dist/kernel/interfaces/ioOps.d.ts +0 -1
  141. package/dist/kernel/interfaces/measureOps.d.ts +0 -1
  142. package/dist/kernel/interfaces/meshOps.d.ts +0 -1
  143. package/dist/kernel/interfaces/modifierOps.d.ts +0 -1
  144. package/dist/kernel/interfaces/primitiveOps.d.ts +0 -1
  145. package/dist/kernel/interfaces/repairOps.d.ts +0 -1
  146. package/dist/kernel/interfaces/surfaceOps.d.ts +0 -1
  147. package/dist/kernel/interfaces/sweepOps.d.ts +0 -1
  148. package/dist/kernel/interfaces/topologyOps.d.ts +0 -1
  149. package/dist/kernel/interfaces/transformOps.d.ts +0 -1
  150. package/dist/kernel/kernel2dTypes.d.ts +0 -1
  151. package/dist/kernel/occt/advancedOps.d.ts +126 -24
  152. package/dist/kernel/occt/booleanBatchOps.d.ts +0 -1
  153. package/dist/kernel/occt/booleanOps.d.ts +11 -1
  154. package/dist/kernel/occt/booleanPipelineOps.d.ts +10 -1
  155. package/dist/kernel/occt/constructorOps.d.ts +14 -1
  156. package/dist/kernel/occt/curveOps.d.ts +13 -1
  157. package/dist/kernel/occt/defaultAdapter.d.ts +10 -441
  158. package/dist/kernel/occt/evolutionOps.d.ts +0 -1
  159. package/dist/kernel/occt/extendedConstructorOps.d.ts +31 -1
  160. package/dist/kernel/occt/geometryQueryOps.d.ts +40 -1
  161. package/dist/kernel/occt/healingOps.d.ts +6 -1
  162. package/dist/kernel/occt/historyOps.d.ts +17 -1
  163. package/dist/kernel/occt/hullOps.d.ts +14 -1
  164. package/dist/kernel/occt/ioOps.d.ts +9 -1
  165. package/dist/kernel/occt/kernel2dOps.d.ts +113 -1
  166. package/dist/kernel/occt/measureOps.d.ts +19 -1
  167. package/dist/kernel/occt/meshOps.d.ts +5 -1
  168. package/dist/kernel/occt/modifierOps.d.ts +24 -1
  169. package/dist/kernel/occt/nurbsQueryOps.d.ts +5 -1
  170. package/dist/kernel/occt/sweepOps.d.ts +23 -1
  171. package/dist/kernel/occt/topologyOps.d.ts +10 -1
  172. package/dist/kernel/occt/transformOps.d.ts +14 -4
  173. package/dist/kernel/occt/wasmTypes/externals.d.ts +0 -1
  174. package/dist/kernel/occt/wasmTypes/index.d.ts +0 -1
  175. package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts +0 -1
  176. package/dist/kernel/occtWasm/adapterShims.d.ts +4 -0
  177. package/dist/kernel/occtWasm/booleanOps.d.ts +11 -0
  178. package/dist/kernel/occtWasm/constructionOps.d.ts +36 -0
  179. package/dist/kernel/occtWasm/curveOps.d.ts +23 -0
  180. package/dist/kernel/occtWasm/evolutionOps.d.ts +17 -0
  181. package/dist/kernel/occtWasm/helpers.d.ts +31 -0
  182. package/dist/kernel/occtWasm/hullOps.d.ts +12 -0
  183. package/dist/kernel/occtWasm/ioOps.d.ts +52 -0
  184. package/dist/kernel/occtWasm/kernel2dOps.d.ts +90 -0
  185. package/dist/kernel/occtWasm/measureOps.d.ts +31 -0
  186. package/dist/kernel/occtWasm/meshOps.d.ts +6 -0
  187. package/dist/kernel/occtWasm/modifierOps.d.ts +14 -0
  188. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  189. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +30 -31
  190. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  191. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +0 -1
  192. package/dist/kernel/occtWasm/primitiveOps.d.ts +10 -0
  193. package/dist/kernel/occtWasm/repairOps.d.ts +10 -0
  194. package/dist/kernel/occtWasm/surfaceOps.d.ts +28 -0
  195. package/dist/kernel/occtWasm/sweepOps.d.ts +38 -0
  196. package/dist/kernel/occtWasm/topologyOps.d.ts +14 -0
  197. package/dist/kernel/occtWasm/transformOps.d.ts +27 -0
  198. package/dist/kernel/perfStats.d.ts +0 -1
  199. package/dist/kernel/solverAdapter.d.ts +0 -1
  200. package/dist/kernel/types.d.ts +0 -1
  201. package/dist/{measureFns-C751QGI1.cjs → measureFns-6ifSQfJt.cjs} +6 -5
  202. package/dist/{measureFns-B8C85hbT.js → measureFns-Io2nHE1k.js} +4 -3
  203. package/dist/measurement/interferenceFns.d.ts +0 -1
  204. package/dist/measurement/measureCache.d.ts +0 -1
  205. package/dist/measurement/measureFns.d.ts +0 -1
  206. package/dist/measurement/measureTypes.d.ts +0 -1
  207. package/dist/measurement.cjs +1 -1
  208. package/dist/measurement.d.ts +0 -1
  209. package/dist/measurement.js +1 -1
  210. package/dist/{meshFns-Cdhtbrhm.cjs → meshFns-BCRVZgPi.cjs} +3 -3
  211. package/dist/{meshFns-BgvsA-xA.js → meshFns-DSdkRFWq.js} +3 -3
  212. package/dist/ns/booleans.d.ts +0 -1
  213. package/dist/ns/construction.d.ts +0 -1
  214. package/dist/ns/ioNs.d.ts +0 -1
  215. package/dist/ns/measurement.d.ts +0 -1
  216. package/dist/ns/modifiers.d.ts +0 -1
  217. package/dist/ns/patterns.d.ts +0 -1
  218. package/dist/ns/primitives.d.ts +0 -1
  219. package/dist/ns/query.d.ts +0 -1
  220. package/dist/ns/transforms.d.ts +0 -1
  221. package/dist/occtWasmAdapter--TZGP9DX.js +4606 -0
  222. package/dist/occtWasmAdapter-C2VW-uYg.cjs +4719 -0
  223. package/dist/operations/api.d.ts +0 -1
  224. package/dist/operations/assemblyFns.d.ts +0 -1
  225. package/dist/operations/compoundOpsFns.d.ts +0 -1
  226. package/dist/operations/convexHullFns.d.ts +0 -1
  227. package/dist/operations/exporterFns.d.ts +0 -1
  228. package/dist/operations/exporterUtils.d.ts +0 -1
  229. package/dist/operations/exporters.d.ts +0 -1
  230. package/dist/operations/extrudeFns.d.ts +0 -1
  231. package/dist/operations/extrudeUtils.d.ts +0 -1
  232. package/dist/operations/guidedSweepFns.d.ts +0 -1
  233. package/dist/operations/historyFns.d.ts +0 -1
  234. package/dist/operations/loftFns.d.ts +0 -1
  235. package/dist/operations/mateFns.d.ts +0 -1
  236. package/dist/operations/multiSweepFns.d.ts +0 -1
  237. package/dist/operations/patternFns.d.ts +0 -1
  238. package/dist/operations/roofFns.d.ts +0 -1
  239. package/dist/operations/straightSkeleton.d.ts +0 -1
  240. package/dist/operations/sweepFns.d.ts +0 -1
  241. package/dist/operations.cjs +2 -2
  242. package/dist/operations.d.ts +0 -1
  243. package/dist/operations.js +2 -2
  244. package/dist/{planeOps-sTrM3dcQ.js → planeOps-4i2qEraD.js} +4 -4
  245. package/dist/{planeOps-BJOIbn4K.cjs → planeOps-CH4ruLuj.cjs} +4 -4
  246. package/dist/{primitiveFns-BLxaJ40A.cjs → primitiveFns-BH-JQPzh.cjs} +20 -19
  247. package/dist/{primitiveFns-fR9sWOEb.js → primitiveFns-C1p92ZcD.js} +8 -7
  248. package/dist/projection/cameraFns.d.ts +0 -1
  249. package/dist/projection/makeProjectedEdges.d.ts +0 -1
  250. package/dist/projection/projectionPlanes.d.ts +0 -1
  251. package/dist/projection.cjs +9 -0
  252. package/dist/projection.d.ts +11 -0
  253. package/dist/projection.js +2 -0
  254. package/dist/query/cornerFinder.d.ts +0 -1
  255. package/dist/query/directionUtils.d.ts +0 -1
  256. package/dist/query/edgeFinder.d.ts +0 -1
  257. package/dist/query/faceFinder.d.ts +0 -1
  258. package/dist/query/finderCore.d.ts +0 -1
  259. package/dist/query/finderFns.d.ts +0 -1
  260. package/dist/query/helpers.d.ts +0 -1
  261. package/dist/query/shapeDistanceFilter.d.ts +0 -1
  262. package/dist/query/shapeFinders.d.ts +0 -1
  263. package/dist/query/vertexFinder.d.ts +0 -1
  264. package/dist/query/wireFinder.d.ts +0 -1
  265. package/dist/query.cjs +2 -2
  266. package/dist/query.d.ts +0 -1
  267. package/dist/query.js +2 -2
  268. package/dist/result.cjs +1 -1
  269. package/dist/result.d.ts +0 -1
  270. package/dist/result.js +1 -1
  271. package/dist/{shapeFns-183zCtMc.cjs → shapeFns-B7x82K11.cjs} +17 -17
  272. package/dist/{shapeFns-2X3VOi1a.js → shapeFns-BhZ9weSI.js} +4 -4
  273. package/dist/shapeRef.cjs +1 -1
  274. package/dist/shapeRef.d.ts +0 -1
  275. package/dist/shapeRef.js +1 -1
  276. package/dist/{shapeRefFns-CU1Jwq9C.js → shapeRefFns-B9PsEqWf.js} +6 -4
  277. package/dist/{shapeRefFns-CFyv5cdW.cjs → shapeRefFns-wDY88A8u.cjs} +8 -6
  278. package/dist/{shapeTypes-C0MDggKf.cjs → shapeTypes-BTt_LLbk.cjs} +6922 -7884
  279. package/dist/{shapeTypes-CN0GUoHr.js → shapeTypes-C--1jaT1.js} +6900 -7862
  280. package/dist/sketching/cannedSketches.d.ts +0 -1
  281. package/dist/sketching/compoundSketch.d.ts +8 -7
  282. package/dist/sketching/draw3d.d.ts +1 -2
  283. package/dist/sketching/drawFns.d.ts +4 -3
  284. package/dist/sketching/{draw.d.ts → drawing.d.ts} +2 -127
  285. package/dist/sketching/drawingFactories.d.ts +94 -0
  286. package/dist/sketching/drawingPen.d.ts +34 -0
  287. package/dist/sketching/faceSketcher.d.ts +52 -0
  288. package/dist/sketching/shortcuts.d.ts +0 -1
  289. package/dist/sketching/sketch.d.ts +64 -10
  290. package/dist/sketching/sketchFns.d.ts +42 -95
  291. package/dist/sketching/sketcher.d.ts +2 -3
  292. package/dist/sketching/sketches.d.ts +5 -6
  293. package/dist/sketching.cjs +19 -18
  294. package/dist/sketching.d.ts +8 -5
  295. package/dist/sketching.js +3 -2
  296. package/dist/{solidBuilders-DACzFqvX.cjs → solidBuilders-CX_197Xm.cjs} +3 -3
  297. package/dist/{solidBuilders-BuS5ByIl.js → solidBuilders-Xs7VDMGD.js} +3 -3
  298. package/dist/{surfaceBuilders-CbH4FIW5.cjs → surfaceBuilders-CYeTNW33.cjs} +25 -3
  299. package/dist/{surfaceBuilders-BVH2SL-z.js → surfaceBuilders-CinmHCbZ.js} +20 -4
  300. package/dist/text/fontRegistry.d.ts +22 -0
  301. package/dist/text/sketchText.d.ts +30 -0
  302. package/dist/text/textBlueprints.d.ts +0 -91
  303. package/dist/text/textMetrics.d.ts +39 -0
  304. package/dist/text.cjs +9 -0
  305. package/dist/text.d.ts +12 -0
  306. package/dist/text.js +3 -0
  307. package/dist/textBlueprints-Do6xNsLt.js +643 -0
  308. package/dist/textBlueprints-oWhiABaY.cjs +800 -0
  309. package/dist/textMetrics-BjJ8sn_e.js +69 -0
  310. package/dist/textMetrics-CUvtglQE.cjs +86 -0
  311. package/dist/topology/adjacencyFns.d.ts +0 -1
  312. package/dist/topology/api.d.ts +0 -1
  313. package/dist/topology/apiTypes.d.ts +0 -1
  314. package/dist/topology/booleanDiagnosticFns.d.ts +0 -1
  315. package/dist/topology/booleanFns.d.ts +0 -1
  316. package/dist/topology/cast.d.ts +0 -1
  317. package/dist/topology/chamferAngleFns.d.ts +0 -1
  318. package/dist/topology/compoundOpsFns.d.ts +0 -1
  319. package/dist/topology/curveBuilders.d.ts +12 -1
  320. package/dist/topology/curveFns.d.ts +0 -1
  321. package/dist/topology/evolutionFns.d.ts +0 -1
  322. package/dist/topology/faceFns.d.ts +0 -1
  323. package/dist/topology/healingFns.d.ts +0 -1
  324. package/dist/topology/hullFns.d.ts +0 -1
  325. package/dist/topology/index.d.ts +0 -1
  326. package/dist/topology/meshCache.d.ts +0 -1
  327. package/dist/topology/meshFns.d.ts +0 -1
  328. package/dist/topology/metadata/colorFns.d.ts +0 -1
  329. package/dist/topology/metadata/faceTagFns.d.ts +0 -1
  330. package/dist/topology/metadata/metadataPropagation.d.ts +0 -1
  331. package/dist/topology/metadata/originTrackingFns.d.ts +0 -1
  332. package/dist/topology/minkowskiFns.d.ts +0 -1
  333. package/dist/topology/modifierFns.d.ts +0 -1
  334. package/dist/topology/nurbsFns.d.ts +0 -1
  335. package/dist/topology/polyhedronFns.d.ts +0 -1
  336. package/dist/topology/positionFns.d.ts +0 -1
  337. package/dist/topology/primitiveFns.d.ts +0 -1
  338. package/dist/topology/shapeBooleans.d.ts +0 -1
  339. package/dist/topology/shapeFns.d.ts +0 -1
  340. package/dist/topology/shapeHelpers.d.ts +0 -1
  341. package/dist/topology/shapeModifiers.d.ts +0 -1
  342. package/dist/topology/shapeRef/index.d.ts +0 -1
  343. package/dist/topology/shapeRef/scoring.d.ts +0 -1
  344. package/dist/topology/shapeRef/shapeRefFns.d.ts +0 -1
  345. package/dist/topology/shapeRef/shapeRefTypes.d.ts +0 -1
  346. package/dist/topology/shapeUtils.d.ts +0 -1
  347. package/dist/topology/solidBuilders.d.ts +0 -1
  348. package/dist/topology/surfaceBuilders.d.ts +0 -1
  349. package/dist/topology/surfaceFns.d.ts +0 -1
  350. package/dist/topology/threeHelpers.d.ts +0 -1
  351. package/dist/topology/topologyQueryFns.d.ts +0 -1
  352. package/dist/topology/transformFns.d.ts +0 -1
  353. package/dist/topology/wrapperFns.d.ts +0 -1
  354. package/dist/topology.cjs +18 -17
  355. package/dist/topology.d.ts +0 -1
  356. package/dist/topology.js +7 -6
  357. package/dist/{faceFns-22idS-ht.cjs → topologyQueryFns-BU0qdNJP.cjs} +2 -342
  358. package/dist/{faceFns-NbWd8-iR.js → topologyQueryFns-Dhf85ZBK.js} +3 -217
  359. package/dist/utils/arrayAccess.d.ts +0 -1
  360. package/dist/utils/bug.d.ts +0 -1
  361. package/dist/utils/ioFilename.d.ts +0 -1
  362. package/dist/utils/precisionRound.d.ts +0 -1
  363. package/dist/utils/range.d.ts +0 -1
  364. package/dist/utils/uuid.d.ts +0 -1
  365. package/dist/utils/vec2d.d.ts +0 -1
  366. package/dist/utils/vec3.d.ts +8 -1
  367. package/dist/utils/zip.d.ts +0 -1
  368. package/dist/vec3-BRj3eI54.js +25 -0
  369. package/dist/vec3-S4Oh59IX.cjs +36 -0
  370. package/dist/vectors.cjs +4 -4
  371. package/dist/vectors.d.ts +0 -1
  372. package/dist/vectors.js +4 -4
  373. package/dist/worker/index.d.ts +0 -1
  374. package/dist/worker/protocol.d.ts +0 -1
  375. package/dist/worker/taskQueue.d.ts +0 -1
  376. package/dist/worker/workerClient.d.ts +0 -1
  377. package/dist/worker/workerHandler.d.ts +0 -1
  378. package/dist/worker.cjs +1 -1
  379. package/dist/worker.d.ts +0 -1
  380. package/dist/worker.js +1 -1
  381. package/package.json +35 -14
  382. package/dist/2d/blueprints/blueprint.d.ts.map +0 -1
  383. package/dist/2d/blueprints/blueprintApproximations.d.ts.map +0 -1
  384. package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +0 -1
  385. package/dist/2d/blueprints/blueprintFns.d.ts.map +0 -1
  386. package/dist/2d/blueprints/blueprintOffset.d.ts.map +0 -1
  387. package/dist/2d/blueprints/blueprints.d.ts.map +0 -1
  388. package/dist/2d/blueprints/boolean2D.d.ts.map +0 -1
  389. package/dist/2d/blueprints/booleanHelpers.d.ts.map +0 -1
  390. package/dist/2d/blueprints/booleanOperations.d.ts.map +0 -1
  391. package/dist/2d/blueprints/cannedBlueprints.d.ts.map +0 -1
  392. package/dist/2d/blueprints/compoundBlueprint.d.ts.map +0 -1
  393. package/dist/2d/blueprints/index.d.ts.map +0 -1
  394. package/dist/2d/blueprints/intersectionSegments.d.ts.map +0 -1
  395. package/dist/2d/blueprints/lib.d.ts.map +0 -1
  396. package/dist/2d/blueprints/segmentAssembly.d.ts.map +0 -1
  397. package/dist/2d/blueprints/svg.d.ts.map +0 -1
  398. package/dist/2d/curve2dGeometryFns.d.ts.map +0 -1
  399. package/dist/2d/curves.d.ts.map +0 -1
  400. package/dist/2d/lib/approximations.d.ts.map +0 -1
  401. package/dist/2d/lib/boundingBox2d.d.ts.map +0 -1
  402. package/dist/2d/lib/curve2D.d.ts.map +0 -1
  403. package/dist/2d/lib/curve2dFns.d.ts.map +0 -1
  404. package/dist/2d/lib/customCorners.d.ts.map +0 -1
  405. package/dist/2d/lib/definitions.d.ts.map +0 -1
  406. package/dist/2d/lib/index.d.ts.map +0 -1
  407. package/dist/2d/lib/intersections.d.ts.map +0 -1
  408. package/dist/2d/lib/makeCurves.d.ts.map +0 -1
  409. package/dist/2d/lib/offset.d.ts.map +0 -1
  410. package/dist/2d/lib/precision.d.ts.map +0 -1
  411. package/dist/2d/lib/stitching.d.ts.map +0 -1
  412. package/dist/2d/lib/svgPath.d.ts.map +0 -1
  413. package/dist/2d/lib/utils.d.ts.map +0 -1
  414. package/dist/2d/lib/vectorOperations.d.ts.map +0 -1
  415. package/dist/2d.d.ts.map +0 -1
  416. package/dist/core/constants.d.ts.map +0 -1
  417. package/dist/core/curve2dHandle.d.ts.map +0 -1
  418. package/dist/core/dimensionTypes.d.ts.map +0 -1
  419. package/dist/core/disposal.d.ts.map +0 -1
  420. package/dist/core/errors.d.ts.map +0 -1
  421. package/dist/core/kernelBoundary.d.ts.map +0 -1
  422. package/dist/core/kernelCall.d.ts.map +0 -1
  423. package/dist/core/kernelErrorTranslation.d.ts.map +0 -1
  424. package/dist/core/planeOps.d.ts.map +0 -1
  425. package/dist/core/planeTypes.d.ts.map +0 -1
  426. package/dist/core/result.d.ts.map +0 -1
  427. package/dist/core/shapeTypeCache.d.ts.map +0 -1
  428. package/dist/core/shapeTypes.d.ts.map +0 -1
  429. package/dist/core/typeDiscriminants.d.ts.map +0 -1
  430. package/dist/core/types.d.ts.map +0 -1
  431. package/dist/core/validityTypes.d.ts.map +0 -1
  432. package/dist/core/vecOps.d.ts.map +0 -1
  433. package/dist/core.d.ts.map +0 -1
  434. package/dist/index.d.ts.map +0 -1
  435. package/dist/io/dxfExportFns.d.ts.map +0 -1
  436. package/dist/io/dxfImportFns.d.ts.map +0 -1
  437. package/dist/io/gltfExportFns.d.ts.map +0 -1
  438. package/dist/io/gltfImportFns.d.ts.map +0 -1
  439. package/dist/io/importFns.d.ts.map +0 -1
  440. package/dist/io/ioUtils.d.ts.map +0 -1
  441. package/dist/io/objExportFns.d.ts.map +0 -1
  442. package/dist/io/objImportFns.d.ts.map +0 -1
  443. package/dist/io/stepConfigFns.d.ts.map +0 -1
  444. package/dist/io/svgImportFns.d.ts.map +0 -1
  445. package/dist/io/threemfExportFns.d.ts.map +0 -1
  446. package/dist/io/threemfImportFns.d.ts.map +0 -1
  447. package/dist/io.d.ts.map +0 -1
  448. package/dist/kernel/brepkit/booleanOps.d.ts.map +0 -1
  449. package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +0 -1
  450. package/dist/kernel/brepkit/brepkitWasmTypes.d.ts.map +0 -1
  451. package/dist/kernel/brepkit/constructionOps.d.ts.map +0 -1
  452. package/dist/kernel/brepkit/evolutionOps.d.ts.map +0 -1
  453. package/dist/kernel/brepkit/geometryOps.d.ts.map +0 -1
  454. package/dist/kernel/brepkit/helpers.d.ts.map +0 -1
  455. package/dist/kernel/brepkit/internalOps.d.ts.map +0 -1
  456. package/dist/kernel/brepkit/ioOps.d.ts.map +0 -1
  457. package/dist/kernel/brepkit/kernel2dOps.d.ts.map +0 -1
  458. package/dist/kernel/brepkit/measureOps.d.ts.map +0 -1
  459. package/dist/kernel/brepkit/meshOps.d.ts.map +0 -1
  460. package/dist/kernel/brepkit/modifierOps.d.ts.map +0 -1
  461. package/dist/kernel/brepkit/repairOps.d.ts.map +0 -1
  462. package/dist/kernel/brepkit/sketchOps.d.ts.map +0 -1
  463. package/dist/kernel/brepkit/sweepOps.d.ts.map +0 -1
  464. package/dist/kernel/brepkit/topologyOps.d.ts.map +0 -1
  465. package/dist/kernel/brepkit/transformOps.d.ts.map +0 -1
  466. package/dist/kernel/geometry2d.d.ts.map +0 -1
  467. package/dist/kernel/index.d.ts.map +0 -1
  468. package/dist/kernel/interfaces/booleanOps.d.ts.map +0 -1
  469. package/dist/kernel/interfaces/builderOps.d.ts.map +0 -1
  470. package/dist/kernel/interfaces/core.d.ts.map +0 -1
  471. package/dist/kernel/interfaces/curveOps.d.ts.map +0 -1
  472. package/dist/kernel/interfaces/evolutionOps.d.ts.map +0 -1
  473. package/dist/kernel/interfaces/index.d.ts.map +0 -1
  474. package/dist/kernel/interfaces/ioOps.d.ts.map +0 -1
  475. package/dist/kernel/interfaces/measureOps.d.ts.map +0 -1
  476. package/dist/kernel/interfaces/meshOps.d.ts.map +0 -1
  477. package/dist/kernel/interfaces/modifierOps.d.ts.map +0 -1
  478. package/dist/kernel/interfaces/primitiveOps.d.ts.map +0 -1
  479. package/dist/kernel/interfaces/repairOps.d.ts.map +0 -1
  480. package/dist/kernel/interfaces/surfaceOps.d.ts.map +0 -1
  481. package/dist/kernel/interfaces/sweepOps.d.ts.map +0 -1
  482. package/dist/kernel/interfaces/topologyOps.d.ts.map +0 -1
  483. package/dist/kernel/interfaces/transformOps.d.ts.map +0 -1
  484. package/dist/kernel/kernel2dTypes.d.ts.map +0 -1
  485. package/dist/kernel/occt/advancedOps.d.ts.map +0 -1
  486. package/dist/kernel/occt/booleanBatchOps.d.ts.map +0 -1
  487. package/dist/kernel/occt/booleanOps.d.ts.map +0 -1
  488. package/dist/kernel/occt/booleanPipelineOps.d.ts.map +0 -1
  489. package/dist/kernel/occt/constructorOps.d.ts.map +0 -1
  490. package/dist/kernel/occt/curveOps.d.ts.map +0 -1
  491. package/dist/kernel/occt/defaultAdapter.d.ts.map +0 -1
  492. package/dist/kernel/occt/evolutionOps.d.ts.map +0 -1
  493. package/dist/kernel/occt/extendedConstructorOps.d.ts.map +0 -1
  494. package/dist/kernel/occt/geometryQueryOps.d.ts.map +0 -1
  495. package/dist/kernel/occt/healingOps.d.ts.map +0 -1
  496. package/dist/kernel/occt/historyOps.d.ts.map +0 -1
  497. package/dist/kernel/occt/hullOps.d.ts.map +0 -1
  498. package/dist/kernel/occt/ioOps.d.ts.map +0 -1
  499. package/dist/kernel/occt/kernel2dOps.d.ts.map +0 -1
  500. package/dist/kernel/occt/measureOps.d.ts.map +0 -1
  501. package/dist/kernel/occt/meshOps.d.ts.map +0 -1
  502. package/dist/kernel/occt/modifierOps.d.ts.map +0 -1
  503. package/dist/kernel/occt/nurbsQueryOps.d.ts.map +0 -1
  504. package/dist/kernel/occt/sweepOps.d.ts.map +0 -1
  505. package/dist/kernel/occt/topologyOps.d.ts.map +0 -1
  506. package/dist/kernel/occt/transformOps.d.ts.map +0 -1
  507. package/dist/kernel/occt/wasmTypes/externals.d.ts.map +0 -1
  508. package/dist/kernel/occt/wasmTypes/index.d.ts.map +0 -1
  509. package/dist/kernel/occt/wasmTypes/occtBuilders.d.ts.map +0 -1
  510. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts.map +0 -1
  511. package/dist/kernel/occtWasm/occtWasmTypes.d.ts.map +0 -1
  512. package/dist/kernel/perfStats.d.ts.map +0 -1
  513. package/dist/kernel/solverAdapter.d.ts.map +0 -1
  514. package/dist/kernel/types.d.ts.map +0 -1
  515. package/dist/measurement/interferenceFns.d.ts.map +0 -1
  516. package/dist/measurement/measureCache.d.ts.map +0 -1
  517. package/dist/measurement/measureFns.d.ts.map +0 -1
  518. package/dist/measurement/measureTypes.d.ts.map +0 -1
  519. package/dist/measurement.d.ts.map +0 -1
  520. package/dist/ns/booleans.d.ts.map +0 -1
  521. package/dist/ns/construction.d.ts.map +0 -1
  522. package/dist/ns/ioNs.d.ts.map +0 -1
  523. package/dist/ns/measurement.d.ts.map +0 -1
  524. package/dist/ns/modifiers.d.ts.map +0 -1
  525. package/dist/ns/patterns.d.ts.map +0 -1
  526. package/dist/ns/primitives.d.ts.map +0 -1
  527. package/dist/ns/query.d.ts.map +0 -1
  528. package/dist/ns/transforms.d.ts.map +0 -1
  529. package/dist/occtWasmAdapter-CuZRRioz.cjs +0 -3947
  530. package/dist/occtWasmAdapter-DIhUXubY.js +0 -3834
  531. package/dist/operations/api.d.ts.map +0 -1
  532. package/dist/operations/assemblyFns.d.ts.map +0 -1
  533. package/dist/operations/compoundOpsFns.d.ts.map +0 -1
  534. package/dist/operations/convexHullFns.d.ts.map +0 -1
  535. package/dist/operations/exporterFns.d.ts.map +0 -1
  536. package/dist/operations/exporterUtils.d.ts.map +0 -1
  537. package/dist/operations/exporters.d.ts.map +0 -1
  538. package/dist/operations/extrudeFns.d.ts.map +0 -1
  539. package/dist/operations/extrudeUtils.d.ts.map +0 -1
  540. package/dist/operations/guidedSweepFns.d.ts.map +0 -1
  541. package/dist/operations/historyFns.d.ts.map +0 -1
  542. package/dist/operations/loftFns.d.ts.map +0 -1
  543. package/dist/operations/mateFns.d.ts.map +0 -1
  544. package/dist/operations/multiSweepFns.d.ts.map +0 -1
  545. package/dist/operations/patternFns.d.ts.map +0 -1
  546. package/dist/operations/roofFns.d.ts.map +0 -1
  547. package/dist/operations/straightSkeleton.d.ts.map +0 -1
  548. package/dist/operations/sweepFns.d.ts.map +0 -1
  549. package/dist/operations.d.ts.map +0 -1
  550. package/dist/projection/cameraFns.d.ts.map +0 -1
  551. package/dist/projection/makeProjectedEdges.d.ts.map +0 -1
  552. package/dist/projection/projectionPlanes.d.ts.map +0 -1
  553. package/dist/query/cornerFinder.d.ts.map +0 -1
  554. package/dist/query/directionUtils.d.ts.map +0 -1
  555. package/dist/query/edgeFinder.d.ts.map +0 -1
  556. package/dist/query/faceFinder.d.ts.map +0 -1
  557. package/dist/query/finderCore.d.ts.map +0 -1
  558. package/dist/query/finderFns.d.ts.map +0 -1
  559. package/dist/query/helpers.d.ts.map +0 -1
  560. package/dist/query/shapeDistanceFilter.d.ts.map +0 -1
  561. package/dist/query/shapeFinders.d.ts.map +0 -1
  562. package/dist/query/vertexFinder.d.ts.map +0 -1
  563. package/dist/query/wireFinder.d.ts.map +0 -1
  564. package/dist/query.d.ts.map +0 -1
  565. package/dist/quick.d.ts.map +0 -1
  566. package/dist/result.d.ts.map +0 -1
  567. package/dist/shapeRef.d.ts.map +0 -1
  568. package/dist/sketching/cannedSketches.d.ts.map +0 -1
  569. package/dist/sketching/compoundSketch.d.ts.map +0 -1
  570. package/dist/sketching/draw.d.ts.map +0 -1
  571. package/dist/sketching/draw3d.d.ts.map +0 -1
  572. package/dist/sketching/drawFns.d.ts.map +0 -1
  573. package/dist/sketching/ellipseUtils.d.ts.map +0 -1
  574. package/dist/sketching/shortcuts.d.ts.map +0 -1
  575. package/dist/sketching/sketch.d.ts.map +0 -1
  576. package/dist/sketching/sketchFns.d.ts.map +0 -1
  577. package/dist/sketching/sketchLib.d.ts +0 -47
  578. package/dist/sketching/sketchLib.d.ts.map +0 -1
  579. package/dist/sketching/sketchUtils.d.ts +0 -8
  580. package/dist/sketching/sketchUtils.d.ts.map +0 -1
  581. package/dist/sketching/sketcher.d.ts.map +0 -1
  582. package/dist/sketching/sketcher2d.d.ts.map +0 -1
  583. package/dist/sketching/sketcherlib.d.ts.map +0 -1
  584. package/dist/sketching/sketches.d.ts.map +0 -1
  585. package/dist/sketching.d.ts.map +0 -1
  586. package/dist/text/textBlueprints.d.ts.map +0 -1
  587. package/dist/topology/adjacencyFns.d.ts.map +0 -1
  588. package/dist/topology/api.d.ts.map +0 -1
  589. package/dist/topology/apiTypes.d.ts.map +0 -1
  590. package/dist/topology/booleanDiagnosticFns.d.ts.map +0 -1
  591. package/dist/topology/booleanFns.d.ts.map +0 -1
  592. package/dist/topology/cast.d.ts.map +0 -1
  593. package/dist/topology/chamferAngleFns.d.ts.map +0 -1
  594. package/dist/topology/compoundOpsFns.d.ts.map +0 -1
  595. package/dist/topology/curveBuilders.d.ts.map +0 -1
  596. package/dist/topology/curveFns.d.ts.map +0 -1
  597. package/dist/topology/evolutionFns.d.ts.map +0 -1
  598. package/dist/topology/faceFns.d.ts.map +0 -1
  599. package/dist/topology/healingFns.d.ts.map +0 -1
  600. package/dist/topology/hullFns.d.ts.map +0 -1
  601. package/dist/topology/index.d.ts.map +0 -1
  602. package/dist/topology/meshCache.d.ts.map +0 -1
  603. package/dist/topology/meshFns.d.ts.map +0 -1
  604. package/dist/topology/metadata/colorFns.d.ts.map +0 -1
  605. package/dist/topology/metadata/faceTagFns.d.ts.map +0 -1
  606. package/dist/topology/metadata/metadataPropagation.d.ts.map +0 -1
  607. package/dist/topology/metadata/originTrackingFns.d.ts.map +0 -1
  608. package/dist/topology/minkowskiFns.d.ts.map +0 -1
  609. package/dist/topology/modifierFns.d.ts.map +0 -1
  610. package/dist/topology/nurbsFns.d.ts.map +0 -1
  611. package/dist/topology/polyhedronFns.d.ts.map +0 -1
  612. package/dist/topology/positionFns.d.ts.map +0 -1
  613. package/dist/topology/primitiveFns.d.ts.map +0 -1
  614. package/dist/topology/shapeBooleans.d.ts.map +0 -1
  615. package/dist/topology/shapeFns.d.ts.map +0 -1
  616. package/dist/topology/shapeHelpers.d.ts.map +0 -1
  617. package/dist/topology/shapeModifiers.d.ts.map +0 -1
  618. package/dist/topology/shapeRef/index.d.ts.map +0 -1
  619. package/dist/topology/shapeRef/scoring.d.ts.map +0 -1
  620. package/dist/topology/shapeRef/shapeRefFns.d.ts.map +0 -1
  621. package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +0 -1
  622. package/dist/topology/shapeUtils.d.ts.map +0 -1
  623. package/dist/topology/solidBuilders.d.ts.map +0 -1
  624. package/dist/topology/surfaceBuilders.d.ts.map +0 -1
  625. package/dist/topology/surfaceFns.d.ts.map +0 -1
  626. package/dist/topology/threeHelpers.d.ts.map +0 -1
  627. package/dist/topology/topologyQueryFns.d.ts.map +0 -1
  628. package/dist/topology/transformFns.d.ts.map +0 -1
  629. package/dist/topology/wrapperFns.d.ts.map +0 -1
  630. package/dist/topology.d.ts.map +0 -1
  631. package/dist/utils/arrayAccess.d.ts.map +0 -1
  632. package/dist/utils/bug.d.ts.map +0 -1
  633. package/dist/utils/ioFilename.d.ts.map +0 -1
  634. package/dist/utils/precisionRound.d.ts.map +0 -1
  635. package/dist/utils/range.d.ts.map +0 -1
  636. package/dist/utils/uuid.d.ts.map +0 -1
  637. package/dist/utils/vec2d.d.ts.map +0 -1
  638. package/dist/utils/vec3.d.ts.map +0 -1
  639. package/dist/utils/zip.d.ts.map +0 -1
  640. package/dist/vectors.d.ts.map +0 -1
  641. package/dist/worker/index.d.ts.map +0 -1
  642. package/dist/worker/protocol.d.ts.map +0 -1
  643. package/dist/worker/taskQueue.d.ts.map +0 -1
  644. package/dist/worker/workerClient.d.ts.map +0 -1
  645. package/dist/worker/workerHandler.d.ts.map +0 -1
  646. package/dist/worker.d.ts.map +0 -1
  647. /package/dist/{arrayAccess-DsnQpdSD.cjs → arrayAccess-7pTWqkJu.cjs} +0 -0
  648. /package/dist/{arrayAccess-tCIbjLs5.js → arrayAccess-C5IWcxs9.js} +0 -0
  649. /package/dist/{constants-csSEYddm.js → constants-Ci5CA3aZ.js} +0 -0
  650. /package/dist/{constants-BNP_xnBN.cjs → constants-DTorLmes.cjs} +0 -0
  651. /package/dist/{types--GD-LVc6.js → types-BIdk_GJY.js} +0 -0
  652. /package/dist/{types-gLi9wL0N.cjs → types-CDkxah-M.cjs} +0 -0
  653. /package/dist/{vecOps-CODplJp3.cjs → vecOps-D7xplSx8.cjs} +0 -0
  654. /package/dist/{vecOps-B-PCHgyB.js → vecOps-DVROrqTV.js} +0 -0
  655. /package/dist/{workerHandler-C-3cFcsQ.cjs → workerHandler-C7seK7H-.cjs} +0 -0
  656. /package/dist/{workerHandler-Dm0_0F8Z.js → workerHandler-DaulgMax.js} +0 -0
@@ -1,16 +1,10 @@
1
- import { R as DisposalScope, X as getKernel, Y as _usingCtx, Z as getKernel2D, a as createEdge, h as isShape3D, o as createFace, t as castShape, u as createWire } from "./shapeTypes-CN0GUoHr.js";
2
- import { A as ok, R as unwrap, T as isOk, b as err, d as validationError, h as bug, i as kernelError, l as typeCastError, n as computationError, s as safeIndex } from "./errors-DboJwVCf.js";
3
- import { N as downcast, c as normalAt, p as uvBounds, u as pointOnSurface } from "./faceFns-NbWd8-iR.js";
4
- import { r as RAD2DEG, t as DEG2RAD } from "./constants-csSEYddm.js";
5
- import { r as toVec3 } from "./types--GD-LVc6.js";
6
- import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-B-PCHgyB.js";
7
- import { n as createPlane } from "./planeOps-sTrM3dcQ.js";
8
- import { c as curveStartPoint, l as curveTangentAt, r as curveIsClosed } from "./curveFns-DhqUp0EI.js";
9
- import { r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-tCIbjLs5.js";
10
- import { _ as zip, i as makeNewFaceWithinFace, r as makeFace, s as assembleWire } from "./surfaceBuilders-BVH2SL-z.js";
11
- import { _ as samePoint$1, b as subtract2d, d as cartesianToPolar, f as crossProduct2d, g as rotate2d, h as polarToCartesian, l as add2d, m as polarAngle2d, o as normalize2d, p as distance2d, s as PRECISION_INTERSECTION, v as scalarMultiply2d } from "./helpers-S_Ht6gwX.js";
12
- import { _ as Curve2D, b as removeDuplicatePoints, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, x as isPoint2D, y as BoundingBox2d } from "./blueprint-BCoJbaQN.js";
13
- import { c as sweep, i as complexExtrude, l as twistExtrude, r as revolve, t as extrude } from "./extrudeFns-B9bVCt3C.js";
1
+ import { X as getKernel, Z as getKernel2D } from "./shapeTypes-C--1jaT1.js";
2
+ import { n as wasmIndex } from "./vec3-BRj3eI54.js";
3
+ import { A as ok, R as unwrap, T as isOk, b as err, h as bug, n as computationError, s as safeIndex } from "./errors-0fYW_YnO.js";
4
+ import { r as RAD2DEG, t as DEG2RAD } from "./constants-Ci5CA3aZ.js";
5
+ import { t as firstOrThrow } from "./arrayAccess-C5IWcxs9.js";
6
+ import { _ as samePoint, b as subtract2d, d as cartesianToPolar, f as crossProduct2d, g as rotate2d, h as polarToCartesian, l as add2d, m as polarAngle2d, o as normalize2d, p as distance2d, v as scalarMultiply2d } from "./helpers-vV2ONZwD.js";
7
+ import { _ as Curve2D, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, x as isPoint2D, y as BoundingBox2d } from "./blueprint-Dv45Evnu.js";
14
8
  //#region node_modules/flatqueue/index.js
15
9
  /** @template T */
16
10
  var FlatQueue = class {
@@ -492,10 +486,10 @@ var intersectCurves = (first, second, precision = 1e-9) => {
492
486
  } catch (e) {
493
487
  return err(computationError("INTERSECTION_FAILED", "Intersections failed between curves", e));
494
488
  }
495
- const segmentsAsPoints = commonSegments.filter((c) => samePoint$1(c.firstPoint, c.lastPoint, precision)).map((c) => c.firstPoint);
489
+ const segmentsAsPoints = commonSegments.filter((c) => samePoint(c.firstPoint, c.lastPoint, precision)).map((c) => c.firstPoint);
496
490
  if (segmentsAsPoints.length) {
497
491
  intersections.push(...segmentsAsPoints);
498
- commonSegments = commonSegments.filter((c) => !samePoint$1(c.firstPoint, c.lastPoint, precision));
492
+ commonSegments = commonSegments.filter((c) => !samePoint(c.firstPoint, c.lastPoint, precision));
499
493
  }
500
494
  const commonSegmentsPoints = commonSegments.flatMap((c) => [c.firstPoint, c.lastPoint]);
501
495
  return ok({
@@ -526,7 +520,7 @@ var selfIntersections = (curve, precision = 1e-9) => {
526
520
  var offsetEndPoints = (firstPoint, lastPoint, offset) => {
527
521
  const tangent = normalize2d(subtract2d(lastPoint, firstPoint));
528
522
  const normal = [tangent[1], -tangent[0]];
529
- const offsetVec = [normal[0] * offset, normal[1] * offset];
523
+ const offsetVec = [wasmIndex(normal, 0) * offset, wasmIndex(normal, 1) * offset];
530
524
  return {
531
525
  firstPoint: add2d(firstPoint, offsetVec),
532
526
  lastPoint: add2d(lastPoint, offsetVec)
@@ -623,11 +617,11 @@ function removeCorner(firstCurve, secondCurve, radius) {
623
617
  const splitParam = unwrap(curve.parameter(splitPoint, 1e-6));
624
618
  return curve.splitAt([splitParam]);
625
619
  };
626
- const [first] = splitForFillet(firstCurve, firstOffset);
627
- const [, second] = splitForFillet(secondCurve, secondOffset);
620
+ const firstSplit = splitForFillet(firstCurve, firstOffset);
621
+ const secondSplit = splitForFillet(secondCurve, secondOffset);
628
622
  return {
629
- first,
630
- second,
623
+ first: wasmIndex(firstSplit, 0),
624
+ second: wasmIndex(secondSplit, 1),
631
625
  center
632
626
  };
633
627
  }
@@ -692,8 +686,10 @@ function dogboneFilletCurves(firstCurve, secondCurve, radius) {
692
686
  const firstInt = unwrap(intersectCurves(firstCurve, circle)).intersections[0];
693
687
  const secondInt = unwrap(intersectCurves(secondCurve, circle)).intersections.at(-1);
694
688
  if (!firstInt || !secondInt) return [firstCurve, secondCurve];
695
- const firstPart = firstCurve.splitAt([firstInt])[0];
696
- const secondPart = secondCurve.splitAt([secondInt]).at(-1);
689
+ const firstSplit = firstCurve.splitAt([firstInt]);
690
+ const secondSplit = secondCurve.splitAt([secondInt]);
691
+ const firstPart = wasmIndex(firstSplit, 0);
692
+ const secondPart = wasmIndex(secondSplit, secondSplit.length - 1);
697
693
  try {
698
694
  return [
699
695
  firstPart,
@@ -994,278 +990,7 @@ var organiseBlueprints = (blueprints) => {
994
990
  }));
995
991
  };
996
992
  //#endregion
997
- //#region src/operations/loftFns.ts
998
- /**
999
- * Functional loft operation using branded shape types.
1000
- */
1001
- /**
1002
- * Loft through a set of wire profiles to create a 3D shape.
1003
- *
1004
- * Builds a `BRepOffsetAPI_ThruSections` surface through the given wires,
1005
- * optionally starting and/or ending at point vertices. Produces a solid
1006
- * by default, or a shell when `returnShell` is `true`.
1007
- *
1008
- * @param wires - Ordered wire profiles to loft through.
1009
- * @param config - Loft configuration (ruled interpolation, start/end points).
1010
- * @param returnShell - When `true`, return a shell instead of a solid.
1011
- * @returns `Result` containing the lofted 3D shape, or an error on failure.
1012
- *
1013
- * @example
1014
- * ```ts
1015
- * const result = loft([bottomWire, topWire], { ruled: false });
1016
- * ```
1017
- *
1018
- * @see {@link loft!loft | loft} for the OOP API equivalent.
1019
- */
1020
- function loft(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
1021
- if (wires.length === 0 && !startPoint && !endPoint) return err(validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
1022
- const kernel = getKernel();
1023
- const startVertex = startPoint ? kernel.makeVertex(...toVec3(startPoint)) : void 0;
1024
- const endVertex = endPoint ? kernel.makeVertex(...toVec3(endPoint)) : void 0;
1025
- try {
1026
- const result = castShape(kernel.loftAdvanced(wires.map((w) => w.wrapped), {
1027
- solid: !returnShell,
1028
- ruled,
1029
- tolerance,
1030
- ...startVertex ? { startVertex } : {},
1031
- ...endVertex ? { endVertex } : {}
1032
- }));
1033
- if (!isShape3D(result)) return err(typeCastError("LOFT_NOT_3D", "Loft did not produce a 3D shape"));
1034
- return ok(result);
1035
- } catch (e) {
1036
- return err(kernelError("LOFT_FAILED", "Loft operation failed", e, void 0, "Common causes: wire profiles with different edge counts, self-intersecting result, or profiles too far apart. Ensure profiles are compatible and ordered."));
1037
- }
1038
- }
1039
- /**
1040
- * Batch loft: build N independent lofts in a single kernel call.
1041
- *
1042
- * Uses the C++ LoftBatch extractor when available (single WASM call),
1043
- * falling back to N individual loft operations otherwise.
1044
- *
1045
- * @returns Array of 3D shapes, one per entry.
1046
- */
1047
- function loftAll(entries) {
1048
- if (entries.length === 0) return ok([]);
1049
- const kernel = getKernel();
1050
- const verticesToDelete = [];
1051
- const kernelEntries = entries.map((e) => {
1052
- const startVertex = e.startPoint ? kernel.makeVertex(...toVec3(e.startPoint)) : void 0;
1053
- const endVertex = e.endPoint ? kernel.makeVertex(...toVec3(e.endPoint)) : void 0;
1054
- if (startVertex) verticesToDelete.push(startVertex);
1055
- if (endVertex) verticesToDelete.push(endVertex);
1056
- return {
1057
- wires: e.wires.map((w) => w.wrapped),
1058
- solid: true,
1059
- ruled: e.ruled ?? true,
1060
- tolerance: e.tolerance ?? 1e-6,
1061
- startVertex,
1062
- endVertex
1063
- };
1064
- });
1065
- try {
1066
- const shapes = kernel.loftBatch?.(kernelEntries) ?? kernelEntries.map((e) => kernel.loftAdvanced(e.wires, {
1067
- solid: e.solid,
1068
- ruled: e.ruled,
1069
- tolerance: e.tolerance,
1070
- startVertex: e.startVertex,
1071
- endVertex: e.endVertex
1072
- }));
1073
- const results = [];
1074
- for (const shape of shapes) {
1075
- const cast = castShape(shape);
1076
- if (!isShape3D(cast)) return err(typeCastError("LOFT_ALL_NOT_3D", "Batch loft entry did not produce a 3D shape"));
1077
- results.push(cast);
1078
- }
1079
- return ok(results);
1080
- } catch (e) {
1081
- return err(kernelError("LOFT_ALL_FAILED", "Batch loft operation failed", e));
1082
- } finally {
1083
- for (const v of verticesToDelete) kernel.dispose(v);
1084
- }
1085
- }
1086
- //#endregion
1087
- //#region src/sketching/sketch.ts
1088
- /**
1089
- * Represent a closed or open wire profile with a default extrusion origin and direction.
1090
- *
1091
- * A Sketch wraps a single {@link Wire} and carries metadata (origin, direction,
1092
- * optional base face) so that downstream operations like {@link Sketch.extrude},
1093
- * {@link Sketch.revolve}, {@link Sketch.sweepSketch}, and {@link Sketch.loftWith}
1094
- * know how to act on it without extra arguments.
1095
- *
1096
- * @remarks Most operations consume (delete) the sketch after producing a solid.
1097
- *
1098
- * @see {@link Sketcher} to build a Sketch interactively.
1099
- * @see {@link CompoundSketch} for multi-wire (outer + holes) profiles.
1100
- * @category Sketching
1101
- */
1102
- var Sketch = class Sketch {
1103
- wire;
1104
- /**
1105
- * @ignore
1106
- */
1107
- _defaultOrigin;
1108
- /**
1109
- * @ignore
1110
- */
1111
- _defaultDirection;
1112
- _baseFace;
1113
- constructor(wire, { defaultOrigin = [
1114
- 0,
1115
- 0,
1116
- 0
1117
- ], defaultDirection = [
1118
- 0,
1119
- 0,
1120
- 1
1121
- ] } = {}) {
1122
- this.wire = wire;
1123
- this._defaultOrigin = toVec3(defaultOrigin);
1124
- this._defaultDirection = toVec3(defaultDirection);
1125
- this.baseFace = null;
1126
- }
1127
- get baseFace() {
1128
- return this._baseFace;
1129
- }
1130
- set baseFace(newFace) {
1131
- if (this._baseFace) this._baseFace.delete();
1132
- this._baseFace = newFace ? createFace(unwrap(downcast(newFace.wrapped))) : newFace;
1133
- }
1134
- /** Release all kernel resources held by this sketch. */
1135
- delete() {
1136
- this.wire.delete();
1137
- if (this.baseFace) this.baseFace.delete();
1138
- }
1139
- /** Create an independent deep copy of this sketch. */
1140
- clone() {
1141
- const sketch = new Sketch(createWire(unwrap(downcast(this.wire.wrapped))), {
1142
- defaultOrigin: this.defaultOrigin,
1143
- defaultDirection: this.defaultDirection
1144
- });
1145
- if (this.baseFace) sketch.baseFace = createFace(unwrap(downcast(this.baseFace.wrapped)));
1146
- return sketch;
1147
- }
1148
- /** Get the 3D origin used as default for extrusion and revolution. */
1149
- get defaultOrigin() {
1150
- return this._defaultOrigin;
1151
- }
1152
- /** Set the 3D origin used as default for extrusion and revolution. */
1153
- set defaultOrigin(newOrigin) {
1154
- this._defaultOrigin = toVec3(newOrigin);
1155
- }
1156
- /** Get the default extrusion/normal direction. */
1157
- get defaultDirection() {
1158
- return this._defaultDirection;
1159
- }
1160
- /** Set the default extrusion/normal direction. */
1161
- set defaultDirection(newDirection) {
1162
- this._defaultDirection = toVec3(newDirection);
1163
- }
1164
- /**
1165
- * Transforms the lines into a face. The lines should be closed.
1166
- */
1167
- face() {
1168
- let face;
1169
- const closedWire = this.wire;
1170
- if (!this.baseFace) face = unwrap(makeFace(closedWire));
1171
- else face = makeNewFaceWithinFace(this.baseFace, closedWire);
1172
- return face;
1173
- }
1174
- /** Return a clone of the underlying wire. */
1175
- wires() {
1176
- return createWire(unwrap(downcast(this.wire.wrapped)));
1177
- }
1178
- /** Alias for {@link Sketch.face}. */
1179
- faces() {
1180
- return this.face();
1181
- }
1182
- /**
1183
- * Revolves the drawing on an axis (defined by its direction and an origin
1184
- * (defaults to the sketch origin)
1185
- */
1186
- revolve(revolutionAxis, { origin } = {}) {
1187
- const face = unwrap(makeFace(this.wire));
1188
- const solid = unwrap(revolve(face, origin ? toVec3(origin) : this.defaultOrigin, revolutionAxis ? toVec3(revolutionAxis) : [
1189
- 0,
1190
- 0,
1191
- 1
1192
- ]));
1193
- face.delete();
1194
- this.delete();
1195
- return solid;
1196
- }
1197
- /** Extrudes the sketch to a certain distance (along the default direction
1198
- * and origin of the sketch).
1199
- *
1200
- * You can define another extrusion direction or origin,
1201
- *
1202
- * It is also possible to twist extrude with an angle (in degrees), or to
1203
- * give a profile to the extrusion (the endFactor will scale the face, and
1204
- * the profile will define how the scale is applied (either linearly or with
1205
- * a s-shape).
1206
- */
1207
- extrude(extrusionDistance, { extrusionDirection, extrusionProfile, twistAngle, origin } = {}) {
1208
- const extrusionVec = vecScale(vecNormalize(extrusionDirection ? toVec3(extrusionDirection) : this.defaultDirection), extrusionDistance);
1209
- const originVec = origin ? toVec3(origin) : this.defaultOrigin;
1210
- if (extrusionProfile && !twistAngle) {
1211
- const solid = unwrap(complexExtrude(this.wire, [...originVec], [...extrusionVec], extrusionProfile));
1212
- this.delete();
1213
- return solid;
1214
- }
1215
- if (twistAngle) {
1216
- const solid = unwrap(twistExtrude(this.wire, twistAngle, [...originVec], [...extrusionVec], extrusionProfile));
1217
- this.delete();
1218
- return solid;
1219
- }
1220
- const solid = unwrap(extrude(unwrap(makeFace(this.wire)), [...extrusionVec]));
1221
- this.delete();
1222
- return solid;
1223
- }
1224
- /**
1225
- * Sweep along this sketch another sketch defined in the function
1226
- * `sketchOnPlane`.
1227
- */
1228
- sweepSketch(sketchOnPlane, sweepConfig = {}) {
1229
- const startPoint = curveStartPoint(this.wire);
1230
- const normal = vecNormalize(vecScale(curveTangentAt(this.wire, 1e-9), -1));
1231
- const defaultDir = this.defaultDirection;
1232
- const xDir = vecScale(vecCross(normal, defaultDir), -1);
1233
- const result = sketchOnPlane(createPlane([...startPoint], [...xDir], [...normal]), [...startPoint]);
1234
- let sketch;
1235
- if ("sketches" in result && Array.isArray(result.sketches)) {
1236
- const pieces = result.sketches;
1237
- sketch = pieces[0];
1238
- for (let i = 1; i < pieces.length; i++) pieces[i]?.delete();
1239
- } else sketch = result;
1240
- const config = {
1241
- forceProfileSpineOthogonality: true,
1242
- ...sweepConfig
1243
- };
1244
- if (this.baseFace) config.support = this.baseFace.wrapped;
1245
- const shape = unwrap(sweep(sketch.wire, this.wire, config));
1246
- this.delete();
1247
- return shape;
1248
- }
1249
- /** Loft between this sketch and another sketch (or an array of them)
1250
- *
1251
- * You can also define a `startPoint` for the loft (that will be placed
1252
- * before this sketch) and an `endPoint` after the last one.
1253
- *
1254
- * You can also define if you want the loft to result in a ruled surface.
1255
- *
1256
- * Note that all sketches will be deleted by this operation
1257
- */
1258
- loftWith(otherSketches, loftConfig = {}, returnShell = false) {
1259
- const sketchArray = Array.isArray(otherSketches) ? [this, ...otherSketches] : [this, otherSketches];
1260
- const shape = unwrap(loft(sketchArray.map((s) => s.wire), loftConfig, returnShell));
1261
- sketchArray.forEach((s) => {
1262
- s.delete();
1263
- });
1264
- return shape;
1265
- }
1266
- };
1267
- //#endregion
1268
- //#region src/sketching/sketcherlib.ts
993
+ //#region src/2d/blueprints/genericSketcher.ts
1269
994
  var isTangent = (c) => c === "symmetric" || typeof c === "number" || Array.isArray(c) && c.length === 2;
1270
995
  /** Resolve a {@link SplineOptions} into fully-expanded tangent directions and factors. */
1271
996
  var defaultsSplineOptions = (config) => {
@@ -1290,6 +1015,49 @@ var defaultsSplineOptions = (config) => {
1290
1015
  startTangent
1291
1016
  };
1292
1017
  };
1018
+ //#endregion
1019
+ //#region src/2d/blueprints/ellipseUtils.ts
1020
+ /**
1021
+ * Normalize ellipse radii so that major >= minor, adjusting the rotation
1022
+ * angle by 90 degrees when the radii need to be swapped.
1023
+ */
1024
+ function normalizeEllipseRadii(horizontalRadius, verticalRadius, rotation) {
1025
+ if (horizontalRadius < verticalRadius) return {
1026
+ majorRadius: verticalRadius,
1027
+ minorRadius: horizontalRadius,
1028
+ rotationAngle: rotation + 90
1029
+ };
1030
+ return {
1031
+ majorRadius: horizontalRadius,
1032
+ minorRadius: verticalRadius,
1033
+ rotationAngle: rotation
1034
+ };
1035
+ }
1036
+ /**
1037
+ * Build a 2D elliptical arc curve from SVG-style endpoint parameters,
1038
+ * applying the UV coordinate conversions used by {@link BaseSketcher2d}.
1039
+ *
1040
+ * @param startUV - Start point in UV space.
1041
+ * @param endUV - End point in UV space.
1042
+ * @param majorRadius - Major radius (already normalized so major >= minor).
1043
+ * @param minorRadius - Minor radius.
1044
+ * @param rotationAngleDeg - Rotation of the ellipse in degrees.
1045
+ * @param longAxis - SVG large-arc flag.
1046
+ * @param sweep - SVG sweep flag.
1047
+ * @param convertToUV - Coordinate conversion function from user space to UV space.
1048
+ */
1049
+ function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, rotationAngleDeg, longAxis, sweep, convertToUV) {
1050
+ const radRotationAngle = rotationAngleDeg * DEG2RAD;
1051
+ const convertAxis = (ax) => distance2d(convertToUV(ax));
1052
+ const r1 = convertAxis(polarToCartesian(majorRadius, radRotationAngle));
1053
+ const r2 = convertAxis(polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
1054
+ const xDir = normalize2d(convertToUV(rotate2d([1, 0], radRotationAngle)));
1055
+ const [, newRotationAngle] = cartesianToPolar(xDir);
1056
+ const { cx, cy, startAngle, endAngle, clockwise, rx, ry } = convertSvgEllipseParams(startUV, endUV, r1, r2, newRotationAngle, longAxis, sweep);
1057
+ const arc = make2dEllipseArc(rx, ry, clockwise ? startAngle : endAngle, clockwise ? endAngle : startAngle, [cx, cy], xDir);
1058
+ if (!clockwise) arc.reverse();
1059
+ return arc;
1060
+ }
1293
1061
  /**
1294
1062
  * Compute start/delta/end angles from the unit-circle parameterization
1295
1063
  * of an SVG elliptical arc (F6.5.5–F6.5.6).
@@ -1369,50 +1137,7 @@ function convertSvgEllipseParams([x1, y1], [x2, y2], rx, ry, phi, fA, fS) {
1369
1137
  };
1370
1138
  }
1371
1139
  //#endregion
1372
- //#region src/sketching/ellipseUtils.ts
1373
- /**
1374
- * Normalize ellipse radii so that major >= minor, adjusting the rotation
1375
- * angle by 90 degrees when the radii need to be swapped.
1376
- */
1377
- function normalizeEllipseRadii(horizontalRadius, verticalRadius, rotation) {
1378
- if (horizontalRadius < verticalRadius) return {
1379
- majorRadius: verticalRadius,
1380
- minorRadius: horizontalRadius,
1381
- rotationAngle: rotation + 90
1382
- };
1383
- return {
1384
- majorRadius: horizontalRadius,
1385
- minorRadius: verticalRadius,
1386
- rotationAngle: rotation
1387
- };
1388
- }
1389
- /**
1390
- * Build a 2D elliptical arc curve from SVG-style endpoint parameters,
1391
- * applying the UV coordinate conversions used by {@link BaseSketcher2d}.
1392
- *
1393
- * @param startUV - Start point in UV space.
1394
- * @param endUV - End point in UV space.
1395
- * @param majorRadius - Major radius (already normalized so major >= minor).
1396
- * @param minorRadius - Minor radius.
1397
- * @param rotationAngleDeg - Rotation of the ellipse in degrees.
1398
- * @param longAxis - SVG large-arc flag.
1399
- * @param sweep - SVG sweep flag.
1400
- * @param convertToUV - Coordinate conversion function from user space to UV space.
1401
- */
1402
- function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, rotationAngleDeg, longAxis, sweep, convertToUV) {
1403
- const radRotationAngle = rotationAngleDeg * DEG2RAD;
1404
- const convertAxis = (ax) => distance2d(convertToUV(ax));
1405
- const r1 = convertAxis(polarToCartesian(majorRadius, radRotationAngle));
1406
- const r2 = convertAxis(polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
1407
- const xDir = normalize2d(convertToUV(rotate2d([1, 0], radRotationAngle)));
1408
- const [, newRotationAngle] = cartesianToPolar(xDir);
1409
- const { cx, cy, startAngle, endAngle, clockwise, rx, ry } = convertSvgEllipseParams(startUV, endUV, r1, r2, newRotationAngle, longAxis, sweep);
1410
- const arc = make2dEllipseArc(rx, ry, clockwise ? startAngle : endAngle, clockwise ? endAngle : startAngle, [cx, cy], xDir);
1411
- if (!clockwise) arc.reverse();
1412
- return arc;
1413
- }
1414
- //#endregion
1415
- //#region src/sketching/sketcher2d.ts
1140
+ //#region src/2d/blueprints/baseSketcher2d.ts
1416
1141
  var cornerModeFns = {
1417
1142
  chamfer: chamferCurves,
1418
1143
  dogbone: dogboneFilletCurves,
@@ -1427,7 +1152,7 @@ function buildCornerFunction(radius, mode) {
1427
1152
  * Base class for 2D sketchers that accumulate {@link Curve2D} segments.
1428
1153
  *
1429
1154
  * Provides the shared pen-drawing API (lines, arcs, ellipses, beziers, splines)
1430
- * used by {@link FaceSketcher}, {@link BlueprintSketcher}, and {@link DrawingPen}.
1155
+ * used by `FaceSketcher`, `BlueprintSketcher`, and `DrawingPen`.
1431
1156
  * Subclasses implement `done()` / `close()` to produce the appropriate output type.
1432
1157
  *
1433
1158
  * @category Sketching
@@ -1449,23 +1174,19 @@ var BaseSketcher2d = class {
1449
1174
  _convertFromUV([u, v]) {
1450
1175
  return [u, v];
1451
1176
  }
1452
- /** Return the last curve in the pending list, or null if empty. */
1453
1177
  _lastCurve() {
1454
1178
  const len = this.pendingCurves.length;
1455
1179
  if (len === 0) return null;
1456
1180
  return this.pendingCurves[len - 1];
1457
1181
  }
1458
- /** Require that a previous curve exists, returning it or throwing. */
1459
1182
  _requireLastCurve(caller, action) {
1460
1183
  const curve = this._lastCurve();
1461
1184
  if (!curve) bug(caller, `You need a previous curve to ${action}`);
1462
1185
  return curve;
1463
1186
  }
1464
- /** Resolve a relative offset from the current pointer position. */
1465
1187
  _resolveRelative(xDist, yDist) {
1466
1188
  return [this.pointer[0] + xDist, this.pointer[1] + yDist];
1467
1189
  }
1468
- /** Save a curve, advance the pointer to the given end point, and return `this`. */
1469
1190
  _saveCurveAndAdvance(curve, end) {
1470
1191
  this.saveCurve(curve);
1471
1192
  this.pointer = end;
@@ -1482,10 +1203,6 @@ var BaseSketcher2d = class {
1482
1203
  /**
1483
1204
  * Returns the current pen angle in degrees
1484
1205
  *
1485
- * The angle represents the tangent direction at the current pen position,
1486
- * based on the last drawing operation (line, arc, bezier, etc.).
1487
- * Returns 0 if nothing has been drawn yet.
1488
- *
1489
1206
  * @category Drawing State
1490
1207
  */
1491
1208
  get penAngle() {
@@ -1671,9 +1388,7 @@ var BaseSketcher2d = class {
1671
1388
  smoothSpline(xDist, yDist, splineConfig) {
1672
1389
  return this.smoothSplineTo(this._resolveRelative(xDist, yDist), splineConfig);
1673
1390
  }
1674
- /**
1675
- * Changes the corner between the previous and next segments.
1676
- */
1391
+ /** Changes the corner between the previous and next segments. */
1677
1392
  customCorner(radius, mode = "fillet") {
1678
1393
  if (!this.pendingCurves.length) bug("Sketcher2d.customCorner", "You need a curve defined to fillet the angle");
1679
1394
  this._nextCorner = buildCornerFunction(radius, mode);
@@ -1687,10 +1402,10 @@ var BaseSketcher2d = class {
1687
1402
  this.pendingCurves.push(...buildCornerFunction(radius, mode)(previousCurve, curve));
1688
1403
  }
1689
1404
  _closeSketch() {
1690
- if (!samePoint$1(this.pointer, this.firstPoint)) this.lineTo(this.firstPoint);
1405
+ if (!samePoint(this.pointer, this.firstPoint)) this.lineTo(this.firstPoint);
1691
1406
  }
1692
1407
  _closeWithMirror() {
1693
- if (samePoint$1(this.pointer, this.firstPoint)) bug("Sketcher2d._closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
1408
+ if (samePoint(this.pointer, this.firstPoint)) bug("Sketcher2d._closeWithMirror", "Cannot close with a mirror when the sketch is already closed");
1694
1409
  const startToEndVector = [this.pointer[0] - this.firstPoint[0], this.pointer[1] - this.firstPoint[1]];
1695
1410
  const uvOrigin = this._convertToUV(this.pointer);
1696
1411
  const uvDir = this._convertToUV(startToEndVector);
@@ -1701,127 +1416,14 @@ var BaseSketcher2d = class {
1701
1416
  this.pointer = this.firstPoint;
1702
1417
  }
1703
1418
  };
1704
- /**
1705
- * The FaceSketcher allows you to sketch on a face that is not planar, for
1706
- * instance the sides of a cylinder.
1707
- *
1708
- * The coordinates passed to the methods corresponds to normalised distances on
1709
- * this surface, between 0 and 1 in both direction.
1710
- *
1711
- * Note that if you are drawing on a closed surface (typically a revolution
1712
- * surface or a cylinder), the first parameters represents the angle and can be
1713
- * smaller than 0 or bigger than 1.
1714
- *
1715
- * @category Sketching
1716
- */
1717
- var FaceSketcher = class extends BaseSketcher2d {
1718
- face;
1719
- _bounds;
1720
- constructor(face, origin = [0, 0]) {
1721
- super(origin);
1722
- this.face = createFace(unwrap(downcast(face.wrapped)));
1723
- this._bounds = uvBounds(face);
1724
- }
1725
- _convertToUV([x, y]) {
1726
- const { uMin, uMax, vMin, vMax } = this._bounds;
1727
- return [uMin + x * (uMax - uMin), vMin + y * (vMax - vMin)];
1728
- }
1729
- _convertFromUV([u, v]) {
1730
- const { uMin, uMax, vMin, vMax } = this._bounds;
1731
- return [(u - uMin) / (uMax - uMin), (v - vMin) / (vMax - vMin)];
1732
- }
1733
- _adaptSurface() {
1734
- return getKernel().extractSurfaceFromFace(this.face.wrapped);
1735
- }
1736
- /**
1737
- * @ignore
1738
- */
1739
- buildWire() {
1740
- const kernel = getKernel();
1741
- const geomSurf = this._adaptSurface();
1742
- const wire = unwrap(assembleWire(this.pendingCurves.map((curve) => {
1743
- return createEdge(kernel.buildEdgeOnSurface(curve.wrapped, geomSurf));
1744
- })));
1745
- kernel.buildCurves3d(wire.wrapped);
1746
- return wire;
1747
- }
1748
- /** Finish drawing and return the resulting {@link Sketch} (does not close the path). */
1749
- done() {
1750
- try {
1751
- var _usingCtx$1 = _usingCtx();
1752
- const scope = _usingCtx$1.u(new DisposalScope());
1753
- const wire = this.buildWire();
1754
- const sketch = new Sketch(wire);
1755
- if (curveIsClosed(wire)) {
1756
- const face = scope.register(sketch.clone().face());
1757
- const origin = pointOnSurface(face, .5, .5);
1758
- const direction = vecScale(normalAt(face), -1);
1759
- sketch.defaultOrigin = [
1760
- origin[0],
1761
- origin[1],
1762
- origin[2]
1763
- ];
1764
- sketch.defaultDirection = [
1765
- direction[0],
1766
- direction[1],
1767
- direction[2]
1768
- ];
1769
- } else {
1770
- const startPoint = curveStartPoint(wire);
1771
- const normal = normalAt(this.face, [
1772
- startPoint[0],
1773
- startPoint[1],
1774
- startPoint[2]
1775
- ]);
1776
- sketch.defaultOrigin = [
1777
- startPoint[0],
1778
- startPoint[1],
1779
- startPoint[2]
1780
- ];
1781
- sketch.defaultDirection = [
1782
- normal[0],
1783
- normal[1],
1784
- normal[2]
1785
- ];
1786
- }
1787
- sketch.baseFace = this.face;
1788
- return sketch;
1789
- } catch (_) {
1790
- _usingCtx$1.e = _;
1791
- } finally {
1792
- _usingCtx$1.d();
1793
- }
1794
- }
1795
- /** Close the path with a straight line to the start point and return the Sketch. */
1796
- close() {
1797
- this._closeSketch();
1798
- return this.done();
1799
- }
1800
- /** Close the path by mirroring all curves about the line from first to last point. */
1801
- closeWithMirror() {
1802
- this._closeWithMirror();
1803
- return this.close();
1804
- }
1805
- /**
1806
- * Close the path and apply a custom corner treatment between the last and first segments.
1807
- *
1808
- * @param radius - Fillet/chamfer radius, or a custom corner function.
1809
- * @param mode - Corner treatment type.
1810
- * @returns The closed {@link Sketch}.
1811
- */
1812
- closeWithCustomCorner(radius, mode = "fillet") {
1813
- this._closeSketch();
1814
- this._customCornerLastWithFirst(radius, mode);
1815
- return this.done();
1816
- }
1817
- };
1419
+ //#endregion
1420
+ //#region src/2d/blueprints/blueprintSketcher.ts
1818
1421
  /**
1819
1422
  * Draw 2D curves and produce a {@link Blueprint} (pure-2D shape, no kernel wire).
1820
1423
  *
1821
1424
  * Use this when you need a reusable 2D profile that can later be sketched onto
1822
1425
  * different planes or faces.
1823
1426
  *
1824
- * @see {@link DrawingPen} for the higher-level Drawing wrapper.
1825
1427
  * @category Sketching
1826
1428
  */
1827
1429
  var BlueprintSketcher = class extends BaseSketcher2d {
@@ -1859,852 +1461,4 @@ var BlueprintSketcher = class extends BaseSketcher2d {
1859
1461
  }
1860
1462
  };
1861
1463
  //#endregion
1862
- //#region src/2d/blueprints/cannedBlueprints.ts
1863
- /**
1864
- * Create a regular polygon blueprint inscribed in a circle of the given radius.
1865
- *
1866
- * @param radius - Circumscribed circle radius.
1867
- * @param sidesCount - Number of sides (3 = triangle, 6 = hexagon, etc.).
1868
- * @param sagitta - When non-zero, sides are replaced by sagitta arcs (bulge height).
1869
- * @returns A closed Blueprint representing the polygon.
1870
- *
1871
- * @example
1872
- * ```ts
1873
- * const hexagon = polysidesBlueprint(10, 6);
1874
- * const roundedTriangle = polysidesBlueprint(10, 3, 2);
1875
- * ```
1876
- */
1877
- var polysidesBlueprint = (radius, sidesCount, sagitta = 0) => {
1878
- const points = [...Array(sidesCount).keys()].map((i) => {
1879
- const theta = -(Math.PI * 2 / sidesCount) * i;
1880
- return [radius * Math.sin(theta), radius * Math.cos(theta)];
1881
- });
1882
- const lastPoint = lastOrThrow(points);
1883
- const blueprint = new BlueprintSketcher().movePointerTo([lastPoint[0], lastPoint[1]]);
1884
- if (sagitta) points.forEach(([x, y]) => blueprint.sagittaArcTo([x, y], sagitta));
1885
- else points.forEach(([x, y]) => blueprint.lineTo([x, y]));
1886
- return blueprint.done();
1887
- };
1888
- /**
1889
- * Create an axis-aligned rectangle blueprint with optional rounded corners.
1890
- *
1891
- * The rectangle is centered at the origin. When `r` is zero the corners
1892
- * are sharp; otherwise they are filleted with circular or elliptical arcs.
1893
- *
1894
- * @param width - Total width of the rectangle.
1895
- * @param height - Total height of the rectangle.
1896
- * @param r - Corner radius. Pass a number for uniform rounding, or
1897
- * `{ rx, ry }` for elliptical corners. Clamped to half the respective
1898
- * dimension.
1899
- * @returns A closed Blueprint representing the rectangle.
1900
- *
1901
- * @example
1902
- * ```ts
1903
- * const sharp = roundedRectangleBlueprint(20, 10);
1904
- * const rounded = roundedRectangleBlueprint(20, 10, 3);
1905
- * const elliptical = roundedRectangleBlueprint(20, 10, { rx: 4, ry: 2 });
1906
- * ```
1907
- */
1908
- var roundedRectangleBlueprint = (width, height, r = 0) => {
1909
- const { rx: inputRx = 0, ry: inputRy = 0 } = typeof r === "number" ? {
1910
- ry: r,
1911
- rx: r
1912
- } : r;
1913
- let rx = Math.min(inputRx, width / 2);
1914
- let ry = Math.min(inputRy, height / 2);
1915
- const withRadius = rx && ry;
1916
- if (!withRadius) {
1917
- rx = 0;
1918
- ry = 0;
1919
- }
1920
- const symmetricRadius = rx === ry;
1921
- const sk = new BlueprintSketcher([Math.min(0, -(width / 2 - rx)), -height / 2]);
1922
- const addFillet = (xDist, yDist) => {
1923
- if (withRadius) if (symmetricRadius) sk.tangentArc(xDist, yDist);
1924
- else sk.ellipse(xDist, yDist, rx, ry, 0, false, true);
1925
- };
1926
- if (rx < width / 2) sk.hLine(width - 2 * rx);
1927
- addFillet(rx, ry);
1928
- if (ry < height / 2) sk.vLine(height - 2 * ry);
1929
- addFillet(-rx, ry);
1930
- if (rx < width / 2) sk.hLine(-(width - 2 * rx));
1931
- addFillet(-rx, -ry);
1932
- if (ry < height / 2) sk.vLine(-(height - 2 * ry));
1933
- addFillet(rx, -ry);
1934
- return sk.close();
1935
- };
1936
- //#endregion
1937
- //#region src/2d/blueprints/booleanHelpers.ts
1938
- var samePoint = (x, y) => samePoint$1(x, y, PRECISION_INTERSECTION);
1939
- /**
1940
- * Hash a point for Set/Map lookup using precision rounding.
1941
- * Must match PRECISION_INTERSECTION (1e-9) to avoid hash collisions for
1942
- * nearly-equal points.
1943
- */
1944
- function hashPoint(p) {
1945
- return `${p[0].toFixed(9)},${p[1].toFixed(9)}`;
1946
- }
1947
- /**
1948
- * Hash a segment by both orientations for bidirectional lookup.
1949
- * The smaller hash comes first so that (A,B) and (B,A) produce the same key.
1950
- */
1951
- function hashSegment(first, last) {
1952
- const h1 = hashPoint(first);
1953
- const h2 = hashPoint(last);
1954
- return h1 < h2 ? `${h1}|${h2}` : `${h2}|${h1}`;
1955
- }
1956
- function startOfSegment(s) {
1957
- const first = s[0];
1958
- if (first === void 0) bug("startOfSegment", "empty segment");
1959
- return first.firstPoint;
1960
- }
1961
- function endOfSegment(s) {
1962
- const last = s[s.length - 1];
1963
- if (last === void 0) bug("endOfSegment", "empty segment");
1964
- return last.lastPoint;
1965
- }
1966
- function reverseSegment(segment) {
1967
- return [...segment].reverse().map((curve) => {
1968
- const newCurve = curve.clone();
1969
- newCurve.reverse();
1970
- return newCurve;
1971
- });
1972
- }
1973
- function reverseSegments(segments) {
1974
- return [...segments].reverse().map(reverseSegment);
1975
- }
1976
- function curveMidPoint(curve) {
1977
- const midParameter = (curve.lastParameter + curve.firstParameter) / 2;
1978
- return curve.value(midParameter);
1979
- }
1980
- /**
1981
- * Find the index of the first curve in `curves` whose firstPoint matches
1982
- * `point`. Uses hash for a fast first pass, then falls back to tolerance-only
1983
- * comparison to handle floating-point rounding at `toFixed(9)` boundaries.
1984
- * Returns -1 if no match is found.
1985
- */
1986
- function findCurveIndexByStartPoint(curves, point) {
1987
- const targetHash = hashPoint(point);
1988
- for (let i = 0; i < curves.length; i++) {
1989
- const curve = curves[i];
1990
- if (curve === void 0) continue;
1991
- if (hashPoint(curve.firstPoint) === targetHash && samePoint(point, curve.firstPoint)) return i;
1992
- }
1993
- for (let i = 0; i < curves.length; i++) {
1994
- const curve = curves[i];
1995
- if (curve === void 0) continue;
1996
- if (samePoint(point, curve.firstPoint)) return i;
1997
- }
1998
- return -1;
1999
- }
2000
- /**
2001
- * Find the index of the first curve in `curves` that matches the given
2002
- * segment's start and end points. Uses hash for a fast first pass, then
2003
- * falls back to tolerance-only comparison.
2004
- * Returns -1 if no match is found.
2005
- */
2006
- function findCurveIndexBySegment(curves, segFirstHash, segLastHash, matchesFn) {
2007
- for (let i = 0; i < curves.length; i++) {
2008
- const curve = curves[i];
2009
- if (curve === void 0) continue;
2010
- if (hashPoint(curve.firstPoint) === segFirstHash && hashPoint(curve.lastPoint) === segLastHash && matchesFn(curve)) return i;
2011
- }
2012
- for (let i = 0; i < curves.length; i++) {
2013
- const curve = curves[i];
2014
- if (curve === void 0) continue;
2015
- if (matchesFn(curve)) return i;
2016
- }
2017
- return -1;
2018
- }
2019
- /** Rotate an array so that element at `startIndex` becomes the first element. */
2020
- function rotateArray(arr, startIndex) {
2021
- if (startIndex <= 0) return arr;
2022
- return arr.slice(startIndex).concat(arr.slice(0, startIndex));
2023
- }
2024
- /**
2025
- * Rotate the curves array so that it starts at the curve whose firstPoint
2026
- * matches the given point.
2027
- */
2028
- function rotateToStartAt(curves, point) {
2029
- return rotateArray(curves, findCurveIndexByStartPoint(curves, point));
2030
- }
2031
- /**
2032
- * Rotate the curves array so that it starts at the curve matching the given
2033
- * segment. Tries both segment orientations (forward and flipped) against both
2034
- * curve orientations (original and reversed chain) to handle cases where
2035
- * `intersectCurves` returns a common segment oriented opposite to the
2036
- * matching curve in the split result.
2037
- */
2038
- function rotateToStartAtSegment(curves, segment) {
2039
- const segFirstHash = hashPoint(segment.firstPoint);
2040
- const segLastHash = hashPoint(segment.lastPoint);
2041
- const matchesForward = (curve) => samePoint(segment.firstPoint, curve.firstPoint) && samePoint(segment.lastPoint, curve.lastPoint);
2042
- const matchesFlipped = (curve) => samePoint(segment.lastPoint, curve.firstPoint) && samePoint(segment.firstPoint, curve.lastPoint);
2043
- function tryRotate(chain, firstHash, lastHash, matchFn) {
2044
- const idx = findCurveIndexBySegment(chain, firstHash, lastHash, matchFn);
2045
- return idx !== -1 ? rotateArray(chain, idx) : null;
2046
- }
2047
- const fwdFwd = tryRotate(curves, segFirstHash, segLastHash, matchesForward);
2048
- if (fwdFwd !== null) return fwdFwd;
2049
- const flipFwd = tryRotate(curves, segLastHash, segFirstHash, matchesFlipped);
2050
- if (flipFwd !== null) return flipFwd;
2051
- const reversed = reverseSegment(curves);
2052
- const fwdRev = tryRotate(reversed, segFirstHash, segLastHash, matchesForward);
2053
- if (fwdRev !== null) return fwdRev;
2054
- const flipRev = tryRotate(reversed, segLastHash, segFirstHash, matchesFlipped);
2055
- if (flipRev !== null) return flipRev;
2056
- bug("rotateToStartAtSegment", "failed to rotate to segment start");
2057
- }
2058
- //#endregion
2059
- //#region src/2d/blueprints/intersectionSegments.ts
2060
- function* createSegmentOnPoints(curves, allIntersections, allCommonSegments) {
2061
- const intersectionSet = new Set(allIntersections.map(hashPoint));
2062
- const commonSegmentSet = new Set(allCommonSegments.map((seg) => hashSegment(seg.firstPoint, seg.lastPoint)));
2063
- const matchesIntersection = (point) => {
2064
- if (intersectionSet.has(hashPoint(point))) return true;
2065
- return allIntersections.some((p) => samePoint(p, point));
2066
- };
2067
- const matchesCommonSegment = (first, last) => {
2068
- if (commonSegmentSet.has(hashSegment(first, last))) return true;
2069
- return allCommonSegments.some((seg) => samePoint(seg.firstPoint, first) && samePoint(seg.lastPoint, last) || samePoint(seg.firstPoint, last) && samePoint(seg.lastPoint, first));
2070
- };
2071
- let currentCurves = [];
2072
- for (const curve of curves) {
2073
- if (samePoint(curve.firstPoint, curve.lastPoint)) {
2074
- currentCurves.push(curve);
2075
- continue;
2076
- }
2077
- const endsAtIntersection = matchesIntersection(curve.lastPoint);
2078
- const isCommon = matchesCommonSegment(curve.firstPoint, curve.lastPoint);
2079
- if (endsAtIntersection) {
2080
- currentCurves.push(curve);
2081
- yield currentCurves;
2082
- currentCurves = [];
2083
- } else if (isCommon) {
2084
- if (currentCurves.length) {
2085
- yield currentCurves;
2086
- currentCurves = [];
2087
- }
2088
- yield [curve];
2089
- } else currentCurves.push(curve);
2090
- }
2091
- if (currentCurves.length) yield currentCurves;
2092
- }
2093
- /**
2094
- * Filter out intersection points where the curves only touch but do not
2095
- * actually cross from one side to the other.
2096
- */
2097
- function removeNonCrossingPoints(allIntersections, segmentedCurve, blueprintToCheck) {
2098
- return allIntersections.filter((intersection) => {
2099
- const touching = segmentedCurve.filter((s) => samePoint(s.firstPoint, intersection) || samePoint(s.lastPoint, intersection));
2100
- const effectiveTouching = touching.length % 2 ? touching.filter((s) => !(samePoint(s.firstPoint, intersection) && samePoint(s.lastPoint, intersection))) : touching;
2101
- if (effectiveTouching.length === 0 || effectiveTouching.length % 2) return false;
2102
- const insideFlags = effectiveTouching.map((segment) => blueprintToCheck.isInside(curveMidPoint(segment)));
2103
- return !(insideFlags.every(Boolean) || insideFlags.every((f) => !f));
2104
- });
2105
- }
2106
- /**
2107
- * Find all intersection points and common segments between two blueprints'
2108
- * curves. Returns per-curve intersection points for subsequent splitting.
2109
- */
2110
- function findAllIntersections(first, second) {
2111
- const allIntersections = [];
2112
- const allCommonSegments = [];
2113
- const firstCurvePoints = first.curves.map(() => []);
2114
- const secondCurvePoints = second.curves.map(() => []);
2115
- const secondIndex = new Flatbush(second.curves.length);
2116
- for (const curve of second.curves) {
2117
- const [[xMin, yMin], [xMax, yMax]] = curve.boundingBox.bounds;
2118
- secondIndex.add(xMin, yMin, xMax, yMax);
2119
- }
2120
- secondIndex.finish();
2121
- first.curves.forEach((thisCurve, firstIdx) => {
2122
- const [[xMin, yMin], [xMax, yMax]] = thisCurve.boundingBox.bounds;
2123
- const candidates = secondIndex.search(xMin, yMin, xMax, yMax);
2124
- for (const secondIdx of candidates) {
2125
- const otherCurve = second.curves[secondIdx];
2126
- const { intersections, commonSegments, commonSegmentsPoints } = unwrap(intersectCurves(thisCurve, otherCurve, PRECISION_INTERSECTION / 100));
2127
- allIntersections.push(...intersections);
2128
- firstCurvePoints[firstIdx]?.push(...intersections);
2129
- secondCurvePoints[secondIdx]?.push(...intersections);
2130
- allCommonSegments.push(...commonSegments);
2131
- allIntersections.push(...commonSegmentsPoints);
2132
- firstCurvePoints[firstIdx]?.push(...commonSegmentsPoints);
2133
- secondCurvePoints[secondIdx]?.push(...commonSegmentsPoints);
2134
- }
2135
- });
2136
- return {
2137
- allIntersections: removeDuplicatePoints(allIntersections, PRECISION_INTERSECTION),
2138
- allCommonSegments,
2139
- firstCurvePoints,
2140
- secondCurvePoints
2141
- };
2142
- }
2143
- /**
2144
- * Split each curve at its intersection points and return the resulting
2145
- * sub-curves.
2146
- */
2147
- function splitCurvesAtIntersections(curves, curvePoints) {
2148
- return zip([curves, curvePoints]).flatMap(([curve, intersections]) => {
2149
- if (intersections.length === 0) return [curve];
2150
- return curve.splitAt(intersections, PRECISION_INTERSECTION / 100);
2151
- });
2152
- }
2153
- /**
2154
- * Check whether a segment's start/end points match one of the common segment
2155
- * point pairs.
2156
- */
2157
- function isCommonSegmentMatch(commonSegmentsPoints, segmentStart, segmentEnd) {
2158
- return commonSegmentsPoints.some(([startPoint, endPoint]) => {
2159
- if (startPoint === void 0 || endPoint === void 0) return false;
2160
- return samePoint(startPoint, segmentStart) && samePoint(endPoint, segmentEnd) || samePoint(startPoint, segmentEnd) && samePoint(endPoint, segmentStart);
2161
- });
2162
- }
2163
- /**
2164
- * Given two closed blueprints, find their intersection points, split each
2165
- * blueprint's curves at those points, and pair up the resulting segments.
2166
- *
2167
- * Returns an array of paired segments (one from each blueprint) that share
2168
- * the same start/end intersection points, or `null` if the blueprints do not
2169
- * intersect.
2170
- */
2171
- function blueprintsIntersectionSegments(first, second) {
2172
- const { allIntersections: rawIntersections, allCommonSegments, firstCurvePoints, secondCurvePoints } = findAllIntersections(first, second);
2173
- if (rawIntersections.length <= 1) return null;
2174
- let firstCurveSegments = splitCurvesAtIntersections(first.curves, firstCurvePoints);
2175
- let secondCurveSegments = splitCurvesAtIntersections(second.curves, secondCurvePoints);
2176
- const commonSegmentsPoints = allCommonSegments.map((c) => [c.firstPoint, c.lastPoint]);
2177
- const allIntersections = removeNonCrossingPoints(removeNonCrossingPoints(rawIntersections, firstCurveSegments, second), secondCurveSegments, first);
2178
- if (allIntersections.length === 0 && allCommonSegments.length === 0) return null;
2179
- if (allCommonSegments.length === 0) {
2180
- const startAt = allIntersections[0];
2181
- if (startAt === void 0) return null;
2182
- firstCurveSegments = rotateToStartAt(firstCurveSegments, startAt);
2183
- secondCurveSegments = rotateToStartAt(secondCurveSegments, startAt);
2184
- } else {
2185
- const startSegment = allCommonSegments[0];
2186
- if (startSegment === void 0) return null;
2187
- firstCurveSegments = rotateToStartAtSegment(firstCurveSegments, startSegment);
2188
- secondCurveSegments = rotateToStartAtSegment(secondCurveSegments, startSegment);
2189
- }
2190
- const firstIntersectedSegments = Array.from(createSegmentOnPoints(firstCurveSegments, allIntersections, allCommonSegments));
2191
- let secondIntersectedSegments = Array.from(createSegmentOnPoints(secondCurveSegments, allIntersections, allCommonSegments));
2192
- const firstSeg = firstIntersectedSegments[0];
2193
- const secondSeg = secondIntersectedSegments[0];
2194
- if (firstSeg !== void 0 && secondSeg !== void 0) {
2195
- const endpointsMismatch = !samePoint(endOfSegment(secondSeg), endOfSegment(firstSeg));
2196
- const commonSegmentLengthMismatch = allCommonSegments.length > 0 && secondSeg.length !== 1;
2197
- if (endpointsMismatch || commonSegmentLengthMismatch) secondIntersectedSegments = reverseSegments(secondIntersectedSegments);
2198
- }
2199
- const maxLen = Math.max(firstIntersectedSegments.length, secondIntersectedSegments.length);
2200
- const result = [];
2201
- for (let i = 0; i < maxLen; i++) {
2202
- const firstSeg2 = firstIntersectedSegments[i];
2203
- const secondSeg2 = secondIntersectedSegments[i];
2204
- if (firstSeg2 === void 0 || secondSeg2 === void 0) {
2205
- const available = firstSeg2 ?? secondSeg2;
2206
- if (available === void 0) continue;
2207
- result.push([available, available]);
2208
- continue;
2209
- }
2210
- if (isCommonSegmentMatch(commonSegmentsPoints, startOfSegment(firstSeg2), endOfSegment(firstSeg2))) result.push([firstSeg2, "same"]);
2211
- else result.push([firstSeg2, secondSeg2]);
2212
- }
2213
- return result;
2214
- }
2215
- //#endregion
2216
- //#region src/2d/blueprints/segmentAssembly.ts
2217
- /**
2218
- * Merge adjacent collinear line segments into single segments.
2219
- *
2220
- * Boolean operations can split a line at intersection points that lie on the
2221
- * line itself (e.g. when a cut rectangle's edge is collinear with the
2222
- * profile's edge). The extra split creates a C0 discontinuity in swept
2223
- * surfaces. Merging eliminates unnecessary vertices.
2224
- */
2225
- function mergeCollinearSegments(curves) {
2226
- if (curves.length < 2) return curves;
2227
- const result = [];
2228
- let i = 0;
2229
- while (i < curves.length) {
2230
- const current = curves[i];
2231
- if (current.geomType !== "LINE") {
2232
- result.push(current);
2233
- i++;
2234
- continue;
2235
- }
2236
- let endPoint = current.lastPoint;
2237
- let j = i + 1;
2238
- while (j < curves.length) {
2239
- const next = curves[j];
2240
- if (next.geomType !== "LINE") break;
2241
- if (!samePoint(endPoint, next.firstPoint)) break;
2242
- const dir1 = subtract2d(endPoint, current.firstPoint);
2243
- const dir2 = subtract2d(next.lastPoint, next.firstPoint);
2244
- if (Math.abs(crossProduct2d(dir1, dir2)) > 1e-9) break;
2245
- endPoint = next.lastPoint;
2246
- j++;
2247
- }
2248
- if (j > i + 1) result.push(make2dSegmentCurve(current.firstPoint, endPoint));
2249
- else result.push(current);
2250
- i = j;
2251
- }
2252
- return result;
2253
- }
2254
- /**
2255
- * Split an array of curves into separate continuous paths. A discontinuity
2256
- * occurs where one curve's lastPoint does not match the next curve's
2257
- * firstPoint.
2258
- */
2259
- function splitPaths(curves) {
2260
- const startPoints = curves.map((c) => c.firstPoint);
2261
- const shiftedEndPoints = curves.map((c) => c.lastPoint);
2262
- const discontinuities = zip([startPoints, shiftedEndPoints.slice(-1).concat(shiftedEndPoints.slice(0, -1))]).map(([startPoint, endPoint], index) => {
2263
- if (startPoint === void 0 || endPoint === void 0) return null;
2264
- return samePoint(startPoint, endPoint) ? null : index;
2265
- }).filter((f) => f !== null);
2266
- if (discontinuities.length === 0) return [curves];
2267
- const paths = zip([discontinuities.slice(0, -1), discontinuities.slice(1)]).map(([start, end]) => curves.slice(start, end));
2268
- let lastPath = curves.slice(discontinuities[discontinuities.length - 1]);
2269
- const firstDiscontinuity = discontinuities[0];
2270
- if (firstDiscontinuity !== void 0 && firstDiscontinuity !== 0) lastPath = lastPath.concat(curves.slice(0, firstDiscontinuity));
2271
- paths.push(lastPath);
2272
- return paths;
2273
- }
2274
- /**
2275
- * Handle the case where two segments overlap ("same"). The decision depends
2276
- * on how many segments are entering the current intersection node.
2277
- */
2278
- function handleSameSegment(firstSegment, segmentsIn, lastWasSame) {
2279
- if (segmentsIn === 1) return {
2280
- curves: [...firstSegment],
2281
- segmentsIn: 1,
2282
- lastWasSame: null
2283
- };
2284
- if (segmentsIn === 2 || segmentsIn === 0) return {
2285
- curves: [],
2286
- segmentsIn: null,
2287
- lastWasSame: null
2288
- };
2289
- if (segmentsIn === null) return {
2290
- curves: [],
2291
- segmentsIn: null,
2292
- lastWasSame: lastWasSame ? [...lastWasSame, ...firstSegment] : firstSegment
2293
- };
2294
- return {
2295
- curves: [],
2296
- segmentsIn,
2297
- lastWasSame
2298
- };
2299
- }
2300
- /**
2301
- * Determine which non-overlapping segments to keep based on
2302
- * inside/outside status relative to the other blueprint.
2303
- */
2304
- function selectSegments(firstSegment, secondSegment, first, second, config, segmentsIn, lastWasSame) {
2305
- let segments = [];
2306
- let segmentsOut = 0;
2307
- const firstCurve = firstSegment[0];
2308
- if (firstCurve !== void 0) {
2309
- const firstSegmentPoint = curveMidPoint(firstCurve);
2310
- const firstInSecond = second.isInside(firstSegmentPoint);
2311
- if (config.firstInside === "keep" && firstInSecond || config.firstInside === "remove" && !firstInSecond) {
2312
- segmentsOut += 1;
2313
- segments.push(...firstSegment);
2314
- }
2315
- }
2316
- const secondCurve = secondSegment[0];
2317
- if (secondCurve !== void 0) {
2318
- const secondSegmentPoint = curveMidPoint(secondCurve);
2319
- const secondInFirst = first.isInside(secondSegmentPoint);
2320
- if (config.secondInside === "keep" && secondInFirst || config.secondInside === "remove" && !secondInFirst) {
2321
- let segmentsToAdd = secondSegment;
2322
- if (segmentsOut === 1) segmentsToAdd = reverseSegment(secondSegment);
2323
- segmentsOut += 1;
2324
- segments.push(...segmentsToAdd);
2325
- }
2326
- }
2327
- if (segmentsIn === null && segmentsOut === 1 && lastWasSame !== null) segments = [...lastWasSame, ...segments];
2328
- return {
2329
- curves: segments,
2330
- segmentsIn: segmentsOut === 1 ? segmentsOut : segmentsIn,
2331
- lastWasSame: segmentsOut === 1 ? null : lastWasSame
2332
- };
2333
- }
2334
- /**
2335
- * Core boolean operation between two simple (non-compound) blueprints.
2336
- *
2337
- * Segments both blueprints at their intersection points, then selects which
2338
- * segments to keep based on the `firstInside`/`secondInside` configuration.
2339
- */
2340
- function booleanOperation(first, second, config) {
2341
- const segments = blueprintsIntersectionSegments(first, second);
2342
- if (segments === null) return buildNoIntersectionResult(first, second);
2343
- if (segments.every(([, secondSegment]) => secondSegment === "same")) return { identical: true };
2344
- let segmentsIn = null;
2345
- let lastWasSame = null;
2346
- let assembledCurves = segments.flatMap(([firstSegment, secondSegment]) => {
2347
- if (secondSegment === "same") {
2348
- const result = handleSameSegment(firstSegment, segmentsIn, lastWasSame);
2349
- segmentsIn = result.segmentsIn;
2350
- lastWasSame = result.lastWasSame;
2351
- return result.curves;
2352
- }
2353
- const result = selectSegments(firstSegment, secondSegment, first, second, config, segmentsIn, lastWasSame);
2354
- segmentsIn = result.segmentsIn;
2355
- lastWasSame = result.lastWasSame;
2356
- return result.curves;
2357
- });
2358
- const finalLastWasSame = lastWasSame;
2359
- if (finalLastWasSame !== null && segmentsIn === 1) assembledCurves = [...finalLastWasSame, ...assembledCurves];
2360
- const paths = splitPaths(mergeCollinearSegments(assembledCurves)).filter((b) => b.length > 0).map((b) => new Blueprint(b));
2361
- if (paths.length === 0) return null;
2362
- if (paths.length === 1) {
2363
- const single = paths[0];
2364
- if (single === void 0) return null;
2365
- return single;
2366
- }
2367
- return organiseBlueprints(paths);
2368
- }
2369
- function buildNoIntersectionResult(first, second) {
2370
- const firstCurve = first.curves[0];
2371
- const secondCurve = second.curves[0];
2372
- return {
2373
- identical: false,
2374
- firstCurveInSecond: firstCurve !== void 0 && second.isInside(curveMidPoint(firstCurve)),
2375
- secondCurveInFirst: secondCurve !== void 0 && first.isInside(curveMidPoint(secondCurve))
2376
- };
2377
- }
2378
- //#endregion
2379
- //#region src/2d/blueprints/booleanOperations.ts
2380
- /**
2381
- * Boolean operations on 2D blueprints: fuse, cut, and intersect.
2382
- *
2383
- * This module is the public API. Internal logic is split across:
2384
- * - `booleanHelpers.ts` — hashing, segment types, rotation utilities
2385
- * - `intersectionSegments.ts` — curve intersection and segment pairing
2386
- * - `segmentAssembly.ts` — segment selection and path assembly
2387
- */
2388
- /**
2389
- * Compute the boolean union of two simple blueprints.
2390
- *
2391
- * Segments each blueprint at their intersection points, discards segments
2392
- * inside the other shape, and reassembles the remaining curves.
2393
- *
2394
- * @param first - First blueprint operand.
2395
- * @param second - Second blueprint operand.
2396
- * @returns The fused outline, a {@link Blueprints} if the result is
2397
- * disjoint, or `null` if the operation produces no geometry.
2398
- *
2399
- * @remarks Both blueprints must be closed. For compound or multi-blueprint
2400
- * inputs, use {@link fuse2D} instead.
2401
- */
2402
- function fuseBlueprints(first, second) {
2403
- const result = booleanOperation(first, second, {
2404
- firstInside: "remove",
2405
- secondInside: "remove"
2406
- });
2407
- if (result === null || result instanceof Blueprint || result instanceof Blueprints) return result;
2408
- if (result.identical) return first.clone();
2409
- if (result.firstCurveInSecond) return second.clone();
2410
- if (result.secondCurveInFirst) return first.clone();
2411
- return new Blueprints([first, second]);
2412
- }
2413
- /**
2414
- * Compute the boolean difference of two simple blueprints (first minus second).
2415
- *
2416
- * Segments the blueprints at their intersections, keeps segments of the first
2417
- * that are outside the second, and segments of the second that are inside the
2418
- * first (reversed to form the boundary of the cut).
2419
- *
2420
- * @param first - Base blueprint to cut from.
2421
- * @param second - Tool blueprint to subtract.
2422
- * @returns The remaining outline, or `null` if nothing remains.
2423
- *
2424
- * @remarks Both blueprints must be closed. For compound inputs use {@link cut2D}.
2425
- */
2426
- function cutBlueprints(first, second) {
2427
- const result = booleanOperation(first, second, {
2428
- firstInside: "remove",
2429
- secondInside: "keep"
2430
- });
2431
- if (result === null || result instanceof Blueprint || result instanceof Blueprints) return result;
2432
- if (result.identical) return null;
2433
- if (result.firstCurveInSecond) return null;
2434
- if (result.secondCurveInFirst) return new Blueprints([new CompoundBlueprint([first, second])]);
2435
- return first.clone();
2436
- }
2437
- /**
2438
- * Compute the boolean intersection of two simple blueprints.
2439
- *
2440
- * Keeps only the segments of each blueprint that lie inside the other,
2441
- * producing the overlapping region.
2442
- *
2443
- * @param first - First blueprint operand.
2444
- * @param second - Second blueprint operand.
2445
- * @returns The intersection outline, or `null` if the blueprints do not overlap.
2446
- *
2447
- * @remarks Both blueprints must be closed. For compound inputs use {@link intersect2D}.
2448
- */
2449
- function intersectBlueprints(first, second) {
2450
- const result = booleanOperation(first, second, {
2451
- firstInside: "keep",
2452
- secondInside: "keep"
2453
- });
2454
- if (result === null || result instanceof Blueprint || result instanceof Blueprints) return result;
2455
- if (result.identical) return first.clone();
2456
- if (result.firstCurveInSecond) return first.clone();
2457
- if (result.secondCurveInFirst) return second.clone();
2458
- return null;
2459
- }
2460
- //#endregion
2461
- //#region src/2d/blueprints/boolean2D.ts
2462
- var genericIntersects = (first, second) => {
2463
- if (first instanceof Blueprint && second instanceof Blueprint) {
2464
- let allIntersections = [];
2465
- first.curves.forEach((thisCurve) => {
2466
- second.curves.forEach((otherCurve) => {
2467
- const { intersections, commonSegmentsPoints } = unwrap(intersectCurves(thisCurve, otherCurve));
2468
- allIntersections.push(...intersections);
2469
- allIntersections.push(...commonSegmentsPoints);
2470
- });
2471
- });
2472
- allIntersections = removeDuplicatePoints(allIntersections);
2473
- return allIntersections.length > 1;
2474
- }
2475
- if (first instanceof CompoundBlueprint || first instanceof Blueprints) return first.blueprints.some((bp) => genericIntersects(bp, second));
2476
- if (second instanceof CompoundBlueprint || second instanceof Blueprints) return second.blueprints.some((bp) => genericIntersects(first, bp));
2477
- bug("genericIntersects", "Unhandled shape combination in genericIntersects");
2478
- };
2479
- var genericFuse = (first, second) => {
2480
- if (first instanceof CompoundBlueprint) {
2481
- if (second instanceof Blueprint) return fuseBlueprintWithCompound(second, first);
2482
- if (second instanceof CompoundBlueprint) return fuseCompoundWithCompound(first, second);
2483
- }
2484
- if (second instanceof CompoundBlueprint) {
2485
- if (first instanceof Blueprint) return fuseBlueprintWithCompound(first, second);
2486
- if (first instanceof CompoundBlueprint) return fuseCompoundWithCompound(first, second);
2487
- }
2488
- if (first instanceof Blueprint && second instanceof Blueprint) return fuseBlueprints(first, second);
2489
- bug("genericFuse", "Unhandled shape combination in genericFuse");
2490
- };
2491
- var fuseIntersectingBlueprints = (blueprints) => {
2492
- const fused = /* @__PURE__ */ new Map();
2493
- const output = [];
2494
- blueprints.forEach((inputBlueprint, i) => {
2495
- let savedBlueprint;
2496
- if (fused.has(i)) savedBlueprint = fused.get(i);
2497
- else {
2498
- savedBlueprint = {
2499
- current: inputBlueprint,
2500
- fusedWith: new Set([i])
2501
- };
2502
- output.push(savedBlueprint);
2503
- }
2504
- blueprints.slice(i + 1).forEach((inputOtherBlueprint, j) => {
2505
- const blueprint = savedBlueprint.current;
2506
- const currentIndex = i + j + 1;
2507
- if (savedBlueprint.fusedWith.has(currentIndex)) return;
2508
- let otherBlueprint = inputOtherBlueprint;
2509
- let otherIsFused = false;
2510
- if (fused.has(currentIndex)) {
2511
- otherBlueprint = fused.get(currentIndex).current;
2512
- otherIsFused = true;
2513
- }
2514
- if (blueprint.boundingBox.isOut(otherBlueprint.boundingBox)) return;
2515
- if (!genericIntersects(blueprint, otherBlueprint)) return;
2516
- let newFused;
2517
- if (blueprint instanceof Blueprints || otherBlueprint instanceof Blueprints) {
2518
- const fused = fuse2D(blueprint, otherBlueprint);
2519
- if (fused === null) bug("fuseIntersectingBlueprints", "fuse2D returned null for non-null inputs");
2520
- newFused = fused;
2521
- } else newFused = genericFuse(blueprint, otherBlueprint);
2522
- if (!(newFused instanceof Blueprint || newFused instanceof CompoundBlueprint)) {
2523
- if (newFused instanceof Blueprints && newFused.blueprints.length === 2) return;
2524
- else if (newFused instanceof Blueprints && newFused.blueprints.length === 1) newFused = safeIndex(newFused.blueprints, 0, "fuseIntersectingBlueprints");
2525
- else if (!(newFused instanceof Blueprints)) bug("fuseIntersectingBlueprints", "Fuse produced unexpected non-blueprint result");
2526
- }
2527
- savedBlueprint.fusedWith.add(currentIndex);
2528
- savedBlueprint.current = newFused;
2529
- if (!otherIsFused) fused.set(currentIndex, savedBlueprint);
2530
- });
2531
- });
2532
- return organiseBlueprints(output.map(({ current }) => current).flatMap((b) => allBlueprints(b)));
2533
- };
2534
- var allBlueprints = (shape) => {
2535
- if (shape instanceof Blueprint) return [shape];
2536
- if (shape instanceof CompoundBlueprint) return shape.blueprints;
2537
- if (shape instanceof Blueprints) return shape.blueprints.flatMap((b) => allBlueprints(b));
2538
- return [];
2539
- };
2540
- var fuseBlueprintWithCompound = (blueprint, compound) => {
2541
- const outerFused = fuseBlueprints(blueprint, safeIndex(compound.blueprints, 0, "fuseBlueprintWithCompound"));
2542
- const innerFused = compound.blueprints.slice(1).map((c) => cutBlueprints(c, blueprint));
2543
- return organiseBlueprints([...allBlueprints(outerFused), ...innerFused.flatMap((fused) => allBlueprints(fused))]);
2544
- };
2545
- function allPairs(list1, list2) {
2546
- const result = [];
2547
- for (const l1 of list1) for (const l2 of list2) result.push([l1, l2]);
2548
- return result;
2549
- }
2550
- var fuseCompoundWithCompound = (first, second) => {
2551
- const firstOuter = safeIndex(first.blueprints, 0, "fuseCompoundWithCompound");
2552
- const secondOuter = safeIndex(second.blueprints, 0, "fuseCompoundWithCompound");
2553
- const outerFused = fuseBlueprints(firstOuter, secondOuter);
2554
- const inner1Fused = second.blueprints.slice(1).map((c) => cutBlueprints(c, firstOuter));
2555
- const inner2Fused = first.blueprints.slice(1).map((c) => cutBlueprints(c, secondOuter));
2556
- const innerIntersections = allPairs(first.blueprints.slice(1), second.blueprints.slice(1)).flatMap(([first, second]) => {
2557
- return allBlueprints(intersectBlueprints(first, second));
2558
- });
2559
- return organiseBlueprints([
2560
- ...allBlueprints(outerFused),
2561
- ...inner1Fused.flatMap((fused) => allBlueprints(fused)),
2562
- ...inner2Fused.flatMap((fused) => allBlueprints(fused)),
2563
- ...innerIntersections
2564
- ]);
2565
- };
2566
- /**
2567
- * Compute the boolean union of two 2D shapes.
2568
- *
2569
- * Handles all combinations of {@link Blueprint}, {@link CompoundBlueprint},
2570
- * {@link Blueprints}, and `null`. When both inputs are simple blueprints the
2571
- * operation delegates to {@link fuseBlueprints}; compound and multi-blueprint
2572
- * cases are decomposed recursively.
2573
- *
2574
- * @param first - First operand (or `null` for empty).
2575
- * @param second - Second operand (or `null` for empty).
2576
- * @returns The fused shape, or `null` if both operands are empty.
2577
- *
2578
- * @example
2579
- * ```ts
2580
- * const union = fuse2D(circleBlueprint, squareBlueprint);
2581
- * ```
2582
- *
2583
- * @see {@link fuse2D} for the functional API.
2584
- */
2585
- var fuse2D = (first, second) => {
2586
- if (first === null) return second?.clone() ?? null;
2587
- if (second === null) return first.clone();
2588
- if (!(first instanceof Blueprints) && second instanceof Blueprints) return fuseIntersectingBlueprints([first, ...second.blueprints]);
2589
- if (!(second instanceof Blueprints) && first instanceof Blueprints) return fuseIntersectingBlueprints([second, ...first.blueprints]);
2590
- if (first instanceof Blueprints && second instanceof Blueprints) {
2591
- let out = fuse2D(safeIndex(first.blueprints, 0, "fuse2D"), second);
2592
- first.blueprints.slice(1).forEach((bp) => {
2593
- out = fuse2D(bp, out);
2594
- });
2595
- return out;
2596
- }
2597
- if (first instanceof CompoundBlueprint) {
2598
- if (second instanceof Blueprints) return fuse2D(second, first);
2599
- if (second instanceof Blueprint) return fuseBlueprintWithCompound(second, first);
2600
- if (second instanceof CompoundBlueprint) return fuseCompoundWithCompound(first, second);
2601
- }
2602
- if (second instanceof CompoundBlueprint) {
2603
- if (first instanceof Blueprints) return fuse2D(first, second);
2604
- if (first instanceof Blueprint) return fuseBlueprintWithCompound(first, second);
2605
- if (first instanceof CompoundBlueprint) return fuseCompoundWithCompound(first, second);
2606
- }
2607
- if (first instanceof Blueprint && second instanceof Blueprint) return fuseBlueprints(first, second);
2608
- return null;
2609
- };
2610
- var mergeNonIntersecting = (shapes) => {
2611
- const exploded = shapes.flatMap((s) => {
2612
- if (s === null) return [];
2613
- if (s instanceof Blueprints) return s.blueprints;
2614
- return s;
2615
- });
2616
- if (exploded.length === 1) return safeIndex(exploded, 0, "mergeNonIntersecting");
2617
- return new Blueprints(exploded);
2618
- };
2619
- /**
2620
- * Compute the boolean difference of two 2D shapes (first minus second).
2621
- *
2622
- * Removes the region covered by `second` from `first`. When the tool is fully
2623
- * inside the base, the result is a {@link CompoundBlueprint} (base with a
2624
- * hole).
2625
- *
2626
- * @param first - Base shape to cut from.
2627
- * @param second - Tool shape to subtract.
2628
- * @returns The remaining shape, or `null` if nothing remains.
2629
- *
2630
- * @example
2631
- * ```ts
2632
- * const withHole = cut2D(outerRect, innerCircle);
2633
- * ```
2634
- *
2635
- * @see {@link cut2D} for the functional API.
2636
- */
2637
- var cut2D = (first, second) => {
2638
- if (first === null) return null;
2639
- if (second === null) return first.clone();
2640
- if (first instanceof Blueprints) return mergeNonIntersecting(first.blueprints.map((bp) => cut2D(bp, second)));
2641
- if (first instanceof CompoundBlueprint) {
2642
- const wrapper = safeIndex(first.blueprints, 0, "cut2D");
2643
- if (second instanceof Blueprint && !second.intersects(wrapper)) {
2644
- if (!wrapper.isInside(second.firstPoint)) return first.clone();
2645
- return organiseBlueprints([wrapper, ...allBlueprints(fuse2D(second, new Blueprints(first.blueprints.slice(1))))]);
2646
- } else {
2647
- let out = cut2D(wrapper, second);
2648
- first.blueprints.slice(1).forEach((bp) => {
2649
- out = cut2D(out, bp);
2650
- });
2651
- return out;
2652
- }
2653
- }
2654
- if (second instanceof Blueprints) {
2655
- let out = first;
2656
- for (const bp of second.blueprints) out = cut2D(out, bp);
2657
- return out;
2658
- }
2659
- if (second instanceof CompoundBlueprint) {
2660
- let out = cutBlueprints(first, safeIndex(second.blueprints, 0, "cut2D"));
2661
- second.blueprints.slice(1).forEach((bp) => {
2662
- out = fuse2D(out, intersectBlueprints(bp, first));
2663
- });
2664
- return out;
2665
- }
2666
- return cutBlueprints(first, second);
2667
- };
2668
- /**
2669
- * Compute the boolean intersection of two 2D shapes.
2670
- *
2671
- * Returns only the region common to both shapes. Compound and multi-blueprint
2672
- * operands are decomposed recursively, with holes handled via complementary
2673
- * cut operations.
2674
- *
2675
- * @param first - First operand.
2676
- * @param second - Second operand.
2677
- * @returns The intersection shape, or `null` if the shapes do not overlap.
2678
- *
2679
- * @example
2680
- * ```ts
2681
- * const overlap = intersect2D(circle, rectangle);
2682
- * ```
2683
- *
2684
- * @see {@link intersect2D} for the functional API.
2685
- */
2686
- function intersect2D(first, second) {
2687
- if (first === null || second === null) return null;
2688
- if (first instanceof Blueprint && second instanceof Blueprint) return intersectBlueprints(first, second);
2689
- if (first instanceof Blueprints) return mergeNonIntersecting(first.blueprints.map((bp) => intersect2D(bp, second)));
2690
- if (first instanceof CompoundBlueprint) {
2691
- const wrapper = safeIndex(first.blueprints, 0, "intersect2D");
2692
- const cuts = first.blueprints.slice(1);
2693
- if (cuts.length === 0) return intersect2D(wrapper, second);
2694
- let result = intersect2D(wrapper, second);
2695
- for (const cut of cuts) result = cut2D(result, cut);
2696
- return result;
2697
- }
2698
- if (second instanceof Blueprints) return mergeNonIntersecting(second.blueprints.map((bp) => intersect2D(first, bp)));
2699
- if (second instanceof CompoundBlueprint) {
2700
- const wrapper = safeIndex(second.blueprints, 0, "intersect2D");
2701
- const cuts = second.blueprints.slice(1);
2702
- if (cuts.length === 0) return intersect2D(wrapper, first);
2703
- let result = intersect2D(wrapper, first);
2704
- for (const cut of cuts) result = cut2D(result, cut);
2705
- return result;
2706
- }
2707
- bug("intersect2D", "Unhandled Shape2D combination");
2708
- }
2709
- //#endregion
2710
- export { Flatbush as S, Blueprints as _, fuseBlueprints as a, make2dOffset as b, roundedRectangleBlueprint as c, FaceSketcher as d, Sketch as f, CompoundBlueprint as g, organiseBlueprints as h, cutBlueprints as i, BaseSketcher2d as l, loftAll as m, fuse2D as n, intersectBlueprints as o, loft as p, intersect2D as r, polysidesBlueprint as s, cut2D as t, BlueprintSketcher as u, chamferCurves as v, intersectCurves as x, filletCurves as y };
1464
+ export { Blueprints as a, make2dOffset as c, CompoundBlueprint as i, intersectCurves as l, BaseSketcher2d as n, chamferCurves as o, organiseBlueprints as r, filletCurves as s, BlueprintSketcher as t, Flatbush as u };