brepjs 12.8.2 → 12.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/dist/2d/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
  2. package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
  3. package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
  4. package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
  5. package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
  6. package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
  7. package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
  8. package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
  9. package/dist/2d/blueprints/index.d.ts +4 -4
  10. package/dist/2d/blueprints/index.d.ts.map +1 -1
  11. package/dist/2d/lib/Curve2D.d.ts +1 -1
  12. package/dist/2d/lib/Curve2D.d.ts.map +1 -1
  13. package/dist/2d/lib/svgPath.d.ts.map +1 -1
  14. package/dist/2d/lib/vectorOperations.d.ts +4 -1
  15. package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
  16. package/dist/2d-CzEysb7A.js +108 -0
  17. package/dist/2d-DCxS_sb_.cjs +107 -0
  18. package/dist/2d.cjs +24 -88
  19. package/dist/2d.d.ts +1 -1
  20. package/dist/2d.js +34 -99
  21. package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
  22. package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
  23. package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
  24. package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
  25. package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
  26. package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
  27. package/dist/brepjs.cjs +448 -379
  28. package/dist/brepjs.js +1634 -1563
  29. package/dist/core/dimensionTypes.d.ts +52 -0
  30. package/dist/core/dimensionTypes.d.ts.map +1 -0
  31. package/dist/core/disposal.d.ts +18 -0
  32. package/dist/core/disposal.d.ts.map +1 -1
  33. package/dist/core/errors.d.ts +7 -8
  34. package/dist/core/errors.d.ts.map +1 -1
  35. package/dist/core/kernelErrorTranslation.d.ts +15 -0
  36. package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
  37. package/dist/core/planeOps.d.ts +14 -0
  38. package/dist/core/planeOps.d.ts.map +1 -1
  39. package/dist/core/result.d.ts +4 -0
  40. package/dist/core/result.d.ts.map +1 -1
  41. package/dist/core/shapeTypes.d.ts +14 -146
  42. package/dist/core/shapeTypes.d.ts.map +1 -1
  43. package/dist/core/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
  44. package/dist/core/typeDiscriminants.d.ts.map +1 -0
  45. package/dist/core/validityTypes.d.ts +100 -0
  46. package/dist/core/validityTypes.d.ts.map +1 -0
  47. package/dist/core.cjs +52 -11
  48. package/dist/core.d.ts +1 -1
  49. package/dist/core.d.ts.map +1 -1
  50. package/dist/core.js +119 -76
  51. package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
  52. package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
  53. package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
  54. package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
  55. package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
  56. package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
  57. package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
  58. package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
  59. package/dist/index.d.ts +20 -19
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/io/gltfImportFns.d.ts +18 -0
  62. package/dist/io/gltfImportFns.d.ts.map +1 -0
  63. package/dist/io/ioUtils.d.ts +16 -0
  64. package/dist/io/ioUtils.d.ts.map +1 -0
  65. package/dist/io/objImportFns.d.ts.map +1 -1
  66. package/dist/io/threemfImportFns.d.ts.map +1 -1
  67. package/dist/io.cjs +4 -4
  68. package/dist/io.js +4 -4
  69. package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
  70. package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
  71. package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
  72. package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
  73. package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
  74. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
  75. package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
  76. package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
  77. package/dist/kernel/brepkit/helpers.d.ts +84 -0
  78. package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
  79. package/dist/kernel/brepkit/internalOps.d.ts +28 -0
  80. package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
  81. package/dist/kernel/brepkit/ioOps.d.ts +43 -0
  82. package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
  83. package/dist/kernel/brepkit/measureOps.d.ts +30 -0
  84. package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
  85. package/dist/kernel/brepkit/meshOps.d.ts +7 -0
  86. package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
  87. package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
  88. package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
  89. package/dist/kernel/brepkit/repairOps.d.ts +14 -0
  90. package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
  91. package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
  92. package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
  93. package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
  94. package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
  95. package/dist/kernel/brepkit/transformOps.d.ts +14 -0
  96. package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
  97. package/dist/kernel/brepkitAdapter.d.ts +1 -1
  98. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  99. package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
  100. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  101. package/dist/kernel/defaultAdapter.d.ts.map +1 -1
  102. package/dist/kernel/extendedConstructorOps.d.ts +9 -1
  103. package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
  104. package/dist/kernel/index.d.ts +1 -0
  105. package/dist/kernel/index.d.ts.map +1 -1
  106. package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
  107. package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
  108. package/dist/kernel/interfaces/builder-ops.d.ts +57 -0
  109. package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
  110. package/dist/kernel/interfaces/core.d.ts +30 -0
  111. package/dist/kernel/interfaces/core.d.ts.map +1 -0
  112. package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
  113. package/dist/kernel/interfaces/curve-ops.d.ts.map +1 -0
  114. package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
  115. package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
  116. package/dist/kernel/interfaces/index.d.ts +37 -0
  117. package/dist/kernel/interfaces/index.d.ts.map +1 -0
  118. package/dist/kernel/interfaces/io-ops.d.ts +66 -0
  119. package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
  120. package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
  121. package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
  122. package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
  123. package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
  124. package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
  125. package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
  126. package/dist/kernel/interfaces/primitive-ops.d.ts +13 -0
  127. package/dist/kernel/interfaces/primitive-ops.d.ts.map +1 -0
  128. package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
  129. package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
  130. package/dist/kernel/interfaces/surface-ops.d.ts +50 -0
  131. package/dist/kernel/interfaces/surface-ops.d.ts.map +1 -0
  132. package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
  133. package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
  134. package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
  135. package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
  136. package/dist/kernel/interfaces/transform-ops.d.ts +35 -0
  137. package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
  138. package/dist/kernel/modifierOps.d.ts +2 -2
  139. package/dist/kernel/modifierOps.d.ts.map +1 -1
  140. package/dist/kernel/types.d.ts +2 -446
  141. package/dist/kernel/types.d.ts.map +1 -1
  142. package/dist/measurement/measureCache.d.ts +11 -9
  143. package/dist/measurement/measureCache.d.ts.map +1 -1
  144. package/dist/measurement/measureFns.d.ts +24 -71
  145. package/dist/measurement/measureFns.d.ts.map +1 -1
  146. package/dist/measurement/measureTypes.d.ts +30 -0
  147. package/dist/measurement/measureTypes.d.ts.map +1 -0
  148. package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
  149. package/dist/measurement-ph-kanQ7.cjs +154 -0
  150. package/dist/measurement.cjs +2 -1
  151. package/dist/measurement.d.ts +1 -1
  152. package/dist/measurement.d.ts.map +1 -1
  153. package/dist/measurement.js +4 -3
  154. package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
  155. package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
  156. package/dist/operations/compoundOpsFns.d.ts +38 -0
  157. package/dist/operations/compoundOpsFns.d.ts.map +1 -0
  158. package/dist/operations/convexHullFns.d.ts +21 -0
  159. package/dist/operations/convexHullFns.d.ts.map +1 -0
  160. package/dist/operations/extrudeFns.d.ts +2 -93
  161. package/dist/operations/extrudeFns.d.ts.map +1 -1
  162. package/dist/operations/guidedSweepFns.d.ts +3 -22
  163. package/dist/operations/guidedSweepFns.d.ts.map +1 -1
  164. package/dist/operations/multiSweepFns.d.ts +3 -29
  165. package/dist/operations/multiSweepFns.d.ts.map +1 -1
  166. package/dist/operations/roofFns.d.ts +2 -2
  167. package/dist/operations/roofFns.d.ts.map +1 -1
  168. package/dist/operations/straightSkeleton.d.ts.map +1 -1
  169. package/dist/operations/sweepFns.d.ts +121 -0
  170. package/dist/operations/sweepFns.d.ts.map +1 -0
  171. package/dist/{operations-BfbkK6DU.js → operations-DX_qy_TB.js} +29 -177
  172. package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
  173. package/dist/operations.cjs +6 -10
  174. package/dist/operations.d.ts +0 -2
  175. package/dist/operations.d.ts.map +1 -1
  176. package/dist/operations.js +26 -30
  177. package/dist/originTrackingFns-BOCAMfd0.js +137 -0
  178. package/dist/originTrackingFns-SPU7ly3_.cjs +136 -0
  179. package/dist/query/edgeFinder.d.ts +4 -14
  180. package/dist/query/edgeFinder.d.ts.map +1 -1
  181. package/dist/query/faceFinder.d.ts +4 -14
  182. package/dist/query/faceFinder.d.ts.map +1 -1
  183. package/dist/query/finderCore.d.ts +6 -0
  184. package/dist/query/finderCore.d.ts.map +1 -1
  185. package/dist/query/shapeFinders.d.ts +32 -0
  186. package/dist/query/shapeFinders.d.ts.map +1 -0
  187. package/dist/query/wireFinder.d.ts +4 -9
  188. package/dist/query/wireFinder.d.ts.map +1 -1
  189. package/dist/query.cjs +54 -32
  190. package/dist/query.js +56 -34
  191. package/dist/{result-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
  192. package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
  193. package/dist/result.cjs +1 -1
  194. package/dist/result.js +23 -23
  195. package/dist/shapeFns-BZ6zk7nd.js +34 -0
  196. package/dist/shapeFns-bRkrwI8R.cjs +33 -0
  197. package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
  198. package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
  199. package/dist/sketching/CompoundSketch.d.ts +4 -4
  200. package/dist/sketching/CompoundSketch.d.ts.map +1 -1
  201. package/dist/sketching/Sketch.d.ts +3 -3
  202. package/dist/sketching/Sketch.d.ts.map +1 -1
  203. package/dist/sketching/Sketcher.d.ts.map +1 -1
  204. package/dist/sketching/Sketches.d.ts +1 -1
  205. package/dist/sketching/Sketches.d.ts.map +1 -1
  206. package/dist/sketching/draw.d.ts +1 -20
  207. package/dist/sketching/draw.d.ts.map +1 -1
  208. package/dist/sketching/draw3d.d.ts +22 -0
  209. package/dist/sketching/draw3d.d.ts.map +1 -0
  210. package/dist/sketching/sketchFns.d.ts +3 -3
  211. package/dist/sketching/sketchFns.d.ts.map +1 -1
  212. package/dist/sketching/sketchLib.d.ts +2 -2
  213. package/dist/sketching/sketchLib.d.ts.map +1 -1
  214. package/dist/sketching.cjs +2 -2
  215. package/dist/sketching.d.ts +2 -1
  216. package/dist/sketching.d.ts.map +1 -1
  217. package/dist/sketching.js +2 -2
  218. package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
  219. package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
  220. package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
  221. package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
  222. package/dist/sweepFns-BKnQs59A.js +215 -0
  223. package/dist/sweepFns-COqeYIUp.cjs +214 -0
  224. package/dist/text/textBlueprints.d.ts +4 -3
  225. package/dist/text/textBlueprints.d.ts.map +1 -1
  226. package/dist/topology/booleanFns.d.ts.map +1 -1
  227. package/dist/topology/cast.d.ts +1 -5
  228. package/dist/topology/cast.d.ts.map +1 -1
  229. package/dist/topology/compoundOpsFns.d.ts +3 -35
  230. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  231. package/dist/topology/curveFns.d.ts +1 -1
  232. package/dist/topology/curveFns.d.ts.map +1 -1
  233. package/dist/topology/index.d.ts +2 -3
  234. package/dist/topology/index.d.ts.map +1 -1
  235. package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
  236. package/dist/topology/metadata/colorFns.d.ts.map +1 -0
  237. package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
  238. package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
  239. package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
  240. package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
  241. package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
  242. package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
  243. package/dist/topology/modifierFns.d.ts.map +1 -1
  244. package/dist/topology/shapeFns.d.ts +6 -120
  245. package/dist/topology/shapeFns.d.ts.map +1 -1
  246. package/dist/topology/topologyQueryFns.d.ts +67 -0
  247. package/dist/topology/topologyQueryFns.d.ts.map +1 -0
  248. package/dist/topology/transformFns.d.ts +49 -0
  249. package/dist/topology/transformFns.d.ts.map +1 -0
  250. package/dist/topology/wrapperFns.d.ts.map +1 -1
  251. package/dist/{topology-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
  252. package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
  253. package/dist/topology.cjs +18 -17
  254. package/dist/topology.js +97 -96
  255. package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
  256. package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -0
  257. package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
  258. package/dist/utils/precisionRound.d.ts +4 -0
  259. package/dist/utils/precisionRound.d.ts.map +1 -1
  260. package/dist/utils/vec2d.d.ts +5 -0
  261. package/dist/utils/vec2d.d.ts.map +1 -1
  262. package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
  263. package/dist/{vectors-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
  264. package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
  265. package/dist/vectors.cjs +1 -1
  266. package/dist/vectors.js +23 -23
  267. package/package.json +9 -9
  268. package/dist/2d/blueprints/approximations.d.ts.map +0 -1
  269. package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
  270. package/dist/2d/blueprints/offset.d.ts.map +0 -1
  271. package/dist/core/definitionMaps.d.ts.map +0 -1
  272. package/dist/core/geometryHelpers.d.ts +0 -30
  273. package/dist/core/geometryHelpers.d.ts.map +0 -1
  274. package/dist/core/memory.d.ts +0 -6
  275. package/dist/core/memory.d.ts.map +0 -1
  276. package/dist/core/typeErrors.d.ts +0 -17
  277. package/dist/core/typeErrors.d.ts.map +0 -1
  278. package/dist/cornerFinder-Ckz-mPHE.js +0 -59
  279. package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
  280. package/dist/loft-Bhw-FMoL.js +0 -228
  281. package/dist/loft-hp3pc1M7.cjs +0 -227
  282. package/dist/measurement-BoNTUBAp.cjs +0 -135
  283. package/dist/operations/extrude.d.ts +0 -72
  284. package/dist/operations/extrude.d.ts.map +0 -1
  285. package/dist/operations/loft.d.ts +0 -33
  286. package/dist/operations/loft.d.ts.map +0 -1
  287. package/dist/shapeFns-C2SnNvdH.cjs +0 -468
  288. package/dist/shapeFns-FDuKkrDR.js +0 -469
  289. package/dist/topology/colorFns.d.ts.map +0 -1
  290. package/dist/topology/faceTagFns.d.ts.map +0 -1
  291. package/dist/utils/round2.d.ts +0 -3
  292. package/dist/utils/round2.d.ts.map +0 -1
  293. package/dist/utils/round5.d.ts +0 -3
  294. package/dist/utils/round5.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
2
+ const result = require("./result-DULetAht.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
- const result = require("./result-fAX0OZzI.cjs");
5
- const loft = require("./loft-hp3pc1M7.cjs");
6
- const booleanFns = require("./booleanFns-gmsX3Cv2.cjs");
7
- const shapeFns = require("./shapeFns-C2SnNvdH.cjs");
8
- const faceFns = require("./faceFns-DB1Fc5gy.cjs");
4
+ const booleanFns = require("./booleanFns-CxArUj_q.cjs");
5
+ const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
6
+ const shapeFns = require("./shapeFns-bRkrwI8R.cjs");
7
+ const faceFns = require("./faceFns-CmIrjdt1.cjs");
8
+ require("./sweepFns-COqeYIUp.cjs");
9
9
  function uuidv() {
10
10
  return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
11
11
  /[018]/g,
@@ -32,148 +32,6 @@ function createAssembly(shapes = []) {
32
32
  const doc = shapeTypes.getKernel().createXCAFDocument(parts);
33
33
  return shapeTypes.createKernelHandle(doc);
34
34
  }
35
- function makeSpineWire(start, end) {
36
- const kernel = shapeTypes.getKernel();
37
- const edge = kernel.makeLineEdge([...start], [...end]);
38
- const wire = kernel.makeWire([edge]);
39
- return shapeTypes.castShape(wire);
40
- }
41
- function makeHelixWire(pitch, height, radius, center, dir, _lefthand = false) {
42
- const kernel = shapeTypes.getKernel();
43
- return shapeTypes.castShape(kernel.makeHelixWire(pitch, height, radius, [...center], [...dir]));
44
- }
45
- function extrude(face, extrusionVec) {
46
- if (shapeTypes.getKernel().isNull(face.wrapped)) {
47
- return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
48
- }
49
- if (vecOps.vecLength(extrusionVec) === 0) {
50
- return result.err(result.validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
51
- }
52
- try {
53
- const kernel = shapeTypes.getKernel();
54
- const len = vecOps.vecLength(extrusionVec);
55
- const dir = vecOps.vecNormalize(extrusionVec);
56
- const shape = kernel.extrude(face.wrapped, [...dir], len);
57
- const downcastShape = kernel.downcast(shape, "solid");
58
- const solid = shapeTypes.createSolid(downcastShape);
59
- return result.ok(solid);
60
- } catch (e) {
61
- return result.err(
62
- result.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
63
- operation: "extrude",
64
- vectorLength: vecOps.vecLength(extrusionVec)
65
- })
66
- );
67
- }
68
- }
69
- function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
70
- if (shapeTypes.getKernel().isNull(face.wrapped)) {
71
- return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
72
- }
73
- const kernel = shapeTypes.getKernel();
74
- const shape = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
75
- const result$1 = shapeTypes.castShape(shape);
76
- if (!shapeTypes.isShape3D(result$1)) {
77
- return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
78
- }
79
- return result.ok(result$1);
80
- }
81
- function sweep(wire, spine, config = {}, shellMode = false) {
82
- if (config.mode === "simple" && !shellMode) {
83
- const kernel2 = shapeTypes.getKernel();
84
- const resultOc = kernel2.simplePipe(wire.wrapped, spine.wrapped);
85
- const shape2 = shapeTypes.castShape(resultOc);
86
- if (!shapeTypes.isShape3D(shape2)) {
87
- return result.err(result.typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
88
- }
89
- return result.ok(shape2);
90
- }
91
- const {
92
- frenet = false,
93
- auxiliarySpine,
94
- law = null,
95
- transitionMode = "right",
96
- withContact,
97
- support,
98
- forceProfileSpineOthogonality,
99
- tolerance,
100
- boundTolerance,
101
- angularTolerance,
102
- maxDegree,
103
- maxSegments
104
- } = config;
105
- const kernel = shapeTypes.getKernel();
106
- const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
107
- const result$1 = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
108
- transitionMode,
109
- contact: !!withContact,
110
- correction: withCorrection,
111
- frenet,
112
- shellMode,
113
- ...auxiliarySpine?.wrapped ? { auxiliary: auxiliarySpine.wrapped } : {},
114
- ...law !== null ? { law } : {},
115
- ...support !== null ? { support } : {},
116
- tolerance,
117
- boundTolerance,
118
- angularTolerance,
119
- maxDegree,
120
- maxSegments
121
- });
122
- if (shellMode && typeof result$1 === "object" && "firstShape" in result$1) {
123
- const shape2 = shapeTypes.castShape(result$1.shape);
124
- if (!shapeTypes.isShape3D(shape2)) {
125
- return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
126
- }
127
- const startWire = shapeTypes.castShape(result$1.firstShape);
128
- const endWire = shapeTypes.castShape(result$1.lastShape);
129
- if (!shapeTypes.isWire(startWire)) {
130
- return result.err(result.typeCastError("SWEEP_START_NOT_WIRE", "Sweep did not produce a start Wire"));
131
- }
132
- if (!shapeTypes.isWire(endWire)) {
133
- return result.err(result.typeCastError("SWEEP_END_NOT_WIRE", "Sweep did not produce an end Wire"));
134
- }
135
- return result.ok([shape2, startWire, endWire]);
136
- }
137
- const shape = shapeTypes.castShape(result$1);
138
- if (!shapeTypes.isShape3D(shape)) {
139
- return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
140
- }
141
- return result.ok(shape);
142
- }
143
- function supportExtrude(wire, center, normal, support) {
144
- const endPoint = vecOps.vecAdd(center, normal);
145
- const spine = makeSpineWire(center, endPoint);
146
- return sweep(wire, spine, { support });
147
- }
148
- function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
149
- const extrusionLength = vecOps.vecLength(normal);
150
- if (extrusionLength === 0) {
151
- return result.err(
152
- result.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length")
153
- );
154
- }
155
- const endPoint = vecOps.vecAdd(center, normal);
156
- const spine = makeSpineWire(center, endPoint);
157
- const law = profileShape ? result.unwrap(loft.buildLawFromProfile(extrusionLength, profileShape)) : null;
158
- return sweep(wire, spine, { law }, shellMode);
159
- }
160
- function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMode = false) {
161
- if (angleDegrees === 0) {
162
- return result.err(result.validationError("ZERO_TWIST_ANGLE", "Twist angle cannot be zero"));
163
- }
164
- const extrusionLength = vecOps.vecLength(normal);
165
- if (extrusionLength === 0) {
166
- return result.err(
167
- result.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length")
168
- );
169
- }
170
- const endPoint = vecOps.vecAdd(center, normal);
171
- const spine = makeSpineWire(center, endPoint);
172
- const pitch = 360 / angleDegrees * extrusionLength;
173
- const auxiliarySpine = makeHelixWire(pitch, extrusionLength, 1, center, normal);
174
- const law = profileShape ? result.unwrap(loft.buildLawFromProfile(extrusionLength, profileShape)) : null;
175
- return sweep(wire, spine, { auxiliarySpine, law }, shellMode);
176
- }
177
35
  function exportAssemblySTEP(shapes = [], { unit, modelUnit } = {}) {
178
36
  const parseHex = (hex) => {
179
37
  let h = hex;
@@ -533,7 +391,6 @@ exports.addChild = addChild;
533
391
  exports.addStep = addStep;
534
392
  exports.circularPattern = circularPattern;
535
393
  exports.collectShapes = collectShapes;
536
- exports.complexExtrude = complexExtrude;
537
394
  exports.countNodes = countNodes;
538
395
  exports.createAssembly = createAssembly;
539
396
  exports.createAssemblyNode = createAssemblyNode;
@@ -541,7 +398,6 @@ exports.createHistory = createHistory;
541
398
  exports.createRegistry = createRegistry;
542
399
  exports.deserializeHistory = deserializeHistory;
543
400
  exports.exportAssemblySTEP = exportAssemblySTEP;
544
- exports.extrude = extrude;
545
401
  exports.findNode = findNode;
546
402
  exports.findStep = findStep;
547
403
  exports.getShape = getShape;
@@ -553,13 +409,9 @@ exports.registerShape = registerShape;
553
409
  exports.removeChild = removeChild;
554
410
  exports.replayFrom = replayFrom;
555
411
  exports.replayHistory = replayHistory;
556
- exports.revolve = revolve;
557
412
  exports.serializeHistory = serializeHistory;
558
413
  exports.stepCount = stepCount;
559
414
  exports.stepsFrom = stepsFrom;
560
- exports.supportExtrude = supportExtrude;
561
- exports.sweep = sweep;
562
- exports.twistExtrude = twistExtrude;
563
415
  exports.undoLast = undoLast;
564
416
  exports.updateNode = updateNode;
565
417
  exports.walkAssembly = walkAssembly;
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const operations = require("./operations-CYpmLSC4.cjs");
4
- const loft = require("./loft-hp3pc1M7.cjs");
3
+ const operations = require("./operations-Ds4xoyxR.cjs");
4
+ const sweepFns = require("./sweepFns-COqeYIUp.cjs");
5
5
  exports.addChild = operations.addChild;
6
6
  exports.addStep = operations.addStep;
7
7
  exports.circularPattern = operations.circularPattern;
8
8
  exports.collectShapes = operations.collectShapes;
9
- exports.complexExtrude = operations.complexExtrude;
10
9
  exports.countNodes = operations.countNodes;
11
10
  exports.createAssembly = operations.createAssembly;
12
11
  exports.createAssemblyNode = operations.createAssemblyNode;
@@ -26,13 +25,10 @@ exports.replayFrom = operations.replayFrom;
26
25
  exports.replayHistory = operations.replayHistory;
27
26
  exports.stepCount = operations.stepCount;
28
27
  exports.stepsFrom = operations.stepsFrom;
29
- exports.supportExtrude = operations.supportExtrude;
30
- exports.sweep = operations.sweep;
31
- exports.twistExtrude = operations.twistExtrude;
32
28
  exports.undoLast = operations.undoLast;
33
29
  exports.updateNode = operations.updateNode;
34
30
  exports.walkAssembly = operations.walkAssembly;
35
- exports.basicFaceExtrusion = loft.basicFaceExtrusion;
36
- exports.genericSweep = loft.genericSweep;
37
- exports.loft = loft.loft;
38
- exports.revolution = loft.revolution;
31
+ exports.complexExtrude = sweepFns.complexExtrude;
32
+ exports.supportExtrude = sweepFns.supportExtrude;
33
+ exports.sweep = sweepFns.sweep;
34
+ exports.twistExtrude = sweepFns.twistExtrude;
@@ -11,7 +11,5 @@ export { linearPattern, circularPattern, gridPattern } from './operations/patter
11
11
  export { createAssemblyNode, addChild, removeChild, updateNode, findNode, walkAssembly, countNodes, collectShapes, type AssemblyNode, type AssemblyNodeOptions, } from './operations/assemblyFns.js';
12
12
  export { exportAssemblySTEP, type ShapeOptions, type SupportedUnit, } from './operations/exporterFns.js';
13
13
  export { createHistory, addStep, undoLast, findStep, getShape as getHistoryShape, stepCount, stepsFrom, registerShape, createRegistry, registerOperation, replayHistory, replayFrom, modifyStep, type OperationStep, type ModelHistory, type OperationFn, type OperationRegistry as HistoryOperationRegistry, } from './operations/historyFns.js';
14
- export { basicFaceExtrusion, revolution, genericSweep, type GenericSweepOptions, } from './operations/extrude.js';
15
- export { loft } from './operations/loft.js';
16
14
  export { type AssemblyExporter, createAssembly } from './operations/exporters.js';
17
15
  //# sourceMappingURL=operations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzF,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,IAAI,eAAe,EAC3B,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,IAAI,wBAAwB,GACnD,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzF,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,IAAI,eAAe,EAC3B,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,IAAI,wBAAwB,GACnD,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,38 +1,34 @@
1
- import { a, b, c, d, f, g, h, i, j, k, n, o, p, q, H, l, t, u, v, x, y, z, B, C, D, s, E, F, G, w } from "./operations-BfbkK6DU.js";
2
- import { b as b2, g as g2, l as l2, r } from "./loft-Bhw-FMoL.js";
1
+ import { a, b, c, d, e, f, g, h, i, k, m, n, o, B, l, p, r, q, s, t, u, x, y, z, A, w } from "./operations-DX_qy_TB.js";
2
+ import { c as c2, a as a2, s as s2, t as t2 } from "./sweepFns-BKnQs59A.js";
3
3
  export {
4
4
  a as addChild,
5
5
  b as addStep,
6
- b2 as basicFaceExtrusion,
7
6
  c as circularPattern,
8
7
  d as collectShapes,
9
- f as complexExtrude,
10
- g as countNodes,
11
- h as createAssembly,
12
- i as createAssemblyNode,
13
- j as createHistory,
14
- k as createRegistry,
15
- n as exportAssemblySTEP,
16
- o as findNode,
17
- p as findStep,
18
- g2 as genericSweep,
19
- q as getHistoryShape,
20
- H as gridPattern,
8
+ c2 as complexExtrude,
9
+ e as countNodes,
10
+ f as createAssembly,
11
+ g as createAssemblyNode,
12
+ h as createHistory,
13
+ i as createRegistry,
14
+ k as exportAssemblySTEP,
15
+ m as findNode,
16
+ n as findStep,
17
+ o as getHistoryShape,
18
+ B as gridPattern,
21
19
  l as linearPattern,
22
- l2 as loft,
23
- t as modifyStep,
24
- u as registerOperation,
25
- v as registerShape,
26
- x as removeChild,
27
- y as replayFrom,
28
- z as replayHistory,
29
- r as revolution,
30
- B as stepCount,
31
- C as stepsFrom,
32
- D as supportExtrude,
33
- s as sweep,
34
- E as twistExtrude,
35
- F as undoLast,
36
- G as updateNode,
20
+ p as modifyStep,
21
+ r as registerOperation,
22
+ q as registerShape,
23
+ s as removeChild,
24
+ t as replayFrom,
25
+ u as replayHistory,
26
+ x as stepCount,
27
+ y as stepsFrom,
28
+ a2 as supportExtrude,
29
+ s2 as sweep,
30
+ t2 as twistExtrude,
31
+ z as undoLast,
32
+ A as updateNode,
37
33
  w as walkAssembly
38
34
  };
@@ -0,0 +1,137 @@
1
+ import { g as getKernel } from "./shapeTypes-dhhm-T5A.js";
2
+ import { H as HASH_CODE_MAX } from "./vecOps-LTN--A58.js";
3
+ import { g as getCacheEntry, a as getOrCreateCache, b as getFaces } from "./topologyQueryFns-Dj4Xd5kx.js";
4
+ function setShapeOrigin(shape, origin) {
5
+ const cache = getOrCreateCache(shape);
6
+ const map = /* @__PURE__ */ new Map();
7
+ for (const f of getFaces(shape)) {
8
+ map.set(getKernel().hashCode(f.wrapped, HASH_CODE_MAX), origin);
9
+ }
10
+ cache.faceOrigins = map;
11
+ }
12
+ function getFaceOrigins(shape) {
13
+ return getCacheEntry(shape)?.faceOrigins;
14
+ }
15
+ function propagateOriginsFromEvolution(evolution, inputs, result) {
16
+ const inputOrigins = /* @__PURE__ */ new Map();
17
+ for (const input of inputs) {
18
+ const origins = getFaceOrigins(input);
19
+ if (!origins) continue;
20
+ for (const [hash, origin] of origins) {
21
+ inputOrigins.set(hash, origin);
22
+ }
23
+ }
24
+ if (inputOrigins.size === 0) return;
25
+ const resultMap = /* @__PURE__ */ new Map();
26
+ for (const [hash, origin] of inputOrigins) {
27
+ if (evolution.deleted.has(hash)) continue;
28
+ const modifiedHashes = evolution.modified.get(hash);
29
+ if (modifiedHashes && modifiedHashes.length > 0) {
30
+ for (const modHash of modifiedHashes) {
31
+ resultMap.set(modHash, origin);
32
+ }
33
+ } else {
34
+ resultMap.set(hash, origin);
35
+ }
36
+ const generatedHashes = evolution.generated.get(hash);
37
+ if (generatedHashes) {
38
+ for (const genHash of generatedHashes) {
39
+ if (!resultMap.has(genHash)) {
40
+ resultMap.set(genHash, 0);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ if (resultMap.size > 0) {
46
+ const cache = getOrCreateCache(result);
47
+ cache.faceOrigins = resultMap;
48
+ }
49
+ }
50
+ function propagateOriginsByHash(inputs, result) {
51
+ const lookup = /* @__PURE__ */ new Map();
52
+ for (const input of inputs) {
53
+ const origins = getFaceOrigins(input);
54
+ if (!origins) continue;
55
+ for (const [hash, origin] of origins) {
56
+ lookup.set(hash, origin);
57
+ }
58
+ }
59
+ if (lookup.size === 0) return;
60
+ const kernel = getKernel();
61
+ const resultMap = /* @__PURE__ */ new Map();
62
+ const resultFaces = getFaces(result);
63
+ for (const f of resultFaces) {
64
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
65
+ const origin = lookup.get(hash);
66
+ if (origin !== void 0) {
67
+ resultMap.set(hash, origin);
68
+ }
69
+ }
70
+ if (resultMap.size === 0) {
71
+ const inputSigs = [];
72
+ for (const input of inputs) {
73
+ const origins = getFaceOrigins(input);
74
+ if (!origins) continue;
75
+ for (const f of getFaces(input)) {
76
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
77
+ const origin = origins.get(hash);
78
+ if (origin === void 0) continue;
79
+ try {
80
+ const bounds = kernel.uvBounds(f.wrapped);
81
+ const normal = kernel.surfaceNormal(
82
+ f.wrapped,
83
+ 0.5 * (bounds.uMin + bounds.uMax),
84
+ 0.5 * (bounds.vMin + bounds.vMax)
85
+ );
86
+ const centroid = kernel.surfaceCenterOfMass(f.wrapped);
87
+ inputSigs.push({ origin, normal, centroid });
88
+ } catch {
89
+ }
90
+ }
91
+ }
92
+ if (inputSigs.length > 0) {
93
+ for (const f of resultFaces) {
94
+ const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
95
+ try {
96
+ const outBounds = kernel.uvBounds(f.wrapped);
97
+ const outNormal = kernel.surfaceNormal(
98
+ f.wrapped,
99
+ 0.5 * (outBounds.uMin + outBounds.uMax),
100
+ 0.5 * (outBounds.vMin + outBounds.vMax)
101
+ );
102
+ const outCentroid = kernel.surfaceCenterOfMass(f.wrapped);
103
+ let bestScore = -Infinity;
104
+ let bestOrigin;
105
+ for (const inp of inputSigs) {
106
+ const dot = outNormal[0] * inp.normal[0] + outNormal[1] * inp.normal[1] + outNormal[2] * inp.normal[2];
107
+ if (dot < 0.707) continue;
108
+ const dx = outCentroid[0] - inp.centroid[0];
109
+ const dy = outCentroid[1] - inp.centroid[1];
110
+ const dz = outCentroid[2] - inp.centroid[2];
111
+ const distSq = dx * dx + dy * dy + dz * dz;
112
+ if (distSq > 100) continue;
113
+ const score = dot - distSq / 100;
114
+ if (score > bestScore) {
115
+ bestScore = score;
116
+ bestOrigin = inp.origin;
117
+ }
118
+ }
119
+ if (bestOrigin !== void 0) {
120
+ resultMap.set(hash, bestOrigin);
121
+ }
122
+ } catch {
123
+ }
124
+ }
125
+ }
126
+ }
127
+ if (resultMap.size > 0) {
128
+ const cache = getOrCreateCache(result);
129
+ cache.faceOrigins = resultMap;
130
+ }
131
+ }
132
+ export {
133
+ propagateOriginsFromEvolution as a,
134
+ getFaceOrigins as g,
135
+ propagateOriginsByHash as p,
136
+ setShapeOrigin as s
137
+ };
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
3
+ const vecOps = require("./vecOps-CjRL1jau.cjs");
4
+ const topologyQueryFns = require("./topologyQueryFns-0IptTUCo.cjs");
5
+ function setShapeOrigin(shape, origin) {
6
+ const cache = topologyQueryFns.getOrCreateCache(shape);
7
+ const map = /* @__PURE__ */ new Map();
8
+ for (const f of topologyQueryFns.getFaces(shape)) {
9
+ map.set(shapeTypes.getKernel().hashCode(f.wrapped, vecOps.HASH_CODE_MAX), origin);
10
+ }
11
+ cache.faceOrigins = map;
12
+ }
13
+ function getFaceOrigins(shape) {
14
+ return topologyQueryFns.getCacheEntry(shape)?.faceOrigins;
15
+ }
16
+ function propagateOriginsFromEvolution(evolution, inputs, result) {
17
+ const inputOrigins = /* @__PURE__ */ new Map();
18
+ for (const input of inputs) {
19
+ const origins = getFaceOrigins(input);
20
+ if (!origins) continue;
21
+ for (const [hash, origin] of origins) {
22
+ inputOrigins.set(hash, origin);
23
+ }
24
+ }
25
+ if (inputOrigins.size === 0) return;
26
+ const resultMap = /* @__PURE__ */ new Map();
27
+ for (const [hash, origin] of inputOrigins) {
28
+ if (evolution.deleted.has(hash)) continue;
29
+ const modifiedHashes = evolution.modified.get(hash);
30
+ if (modifiedHashes && modifiedHashes.length > 0) {
31
+ for (const modHash of modifiedHashes) {
32
+ resultMap.set(modHash, origin);
33
+ }
34
+ } else {
35
+ resultMap.set(hash, origin);
36
+ }
37
+ const generatedHashes = evolution.generated.get(hash);
38
+ if (generatedHashes) {
39
+ for (const genHash of generatedHashes) {
40
+ if (!resultMap.has(genHash)) {
41
+ resultMap.set(genHash, 0);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ if (resultMap.size > 0) {
47
+ const cache = topologyQueryFns.getOrCreateCache(result);
48
+ cache.faceOrigins = resultMap;
49
+ }
50
+ }
51
+ function propagateOriginsByHash(inputs, result) {
52
+ const lookup = /* @__PURE__ */ new Map();
53
+ for (const input of inputs) {
54
+ const origins = getFaceOrigins(input);
55
+ if (!origins) continue;
56
+ for (const [hash, origin] of origins) {
57
+ lookup.set(hash, origin);
58
+ }
59
+ }
60
+ if (lookup.size === 0) return;
61
+ const kernel = shapeTypes.getKernel();
62
+ const resultMap = /* @__PURE__ */ new Map();
63
+ const resultFaces = topologyQueryFns.getFaces(result);
64
+ for (const f of resultFaces) {
65
+ const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
66
+ const origin = lookup.get(hash);
67
+ if (origin !== void 0) {
68
+ resultMap.set(hash, origin);
69
+ }
70
+ }
71
+ if (resultMap.size === 0) {
72
+ const inputSigs = [];
73
+ for (const input of inputs) {
74
+ const origins = getFaceOrigins(input);
75
+ if (!origins) continue;
76
+ for (const f of topologyQueryFns.getFaces(input)) {
77
+ const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
78
+ const origin = origins.get(hash);
79
+ if (origin === void 0) continue;
80
+ try {
81
+ const bounds = kernel.uvBounds(f.wrapped);
82
+ const normal = kernel.surfaceNormal(
83
+ f.wrapped,
84
+ 0.5 * (bounds.uMin + bounds.uMax),
85
+ 0.5 * (bounds.vMin + bounds.vMax)
86
+ );
87
+ const centroid = kernel.surfaceCenterOfMass(f.wrapped);
88
+ inputSigs.push({ origin, normal, centroid });
89
+ } catch {
90
+ }
91
+ }
92
+ }
93
+ if (inputSigs.length > 0) {
94
+ for (const f of resultFaces) {
95
+ const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
96
+ try {
97
+ const outBounds = kernel.uvBounds(f.wrapped);
98
+ const outNormal = kernel.surfaceNormal(
99
+ f.wrapped,
100
+ 0.5 * (outBounds.uMin + outBounds.uMax),
101
+ 0.5 * (outBounds.vMin + outBounds.vMax)
102
+ );
103
+ const outCentroid = kernel.surfaceCenterOfMass(f.wrapped);
104
+ let bestScore = -Infinity;
105
+ let bestOrigin;
106
+ for (const inp of inputSigs) {
107
+ const dot = outNormal[0] * inp.normal[0] + outNormal[1] * inp.normal[1] + outNormal[2] * inp.normal[2];
108
+ if (dot < 0.707) continue;
109
+ const dx = outCentroid[0] - inp.centroid[0];
110
+ const dy = outCentroid[1] - inp.centroid[1];
111
+ const dz = outCentroid[2] - inp.centroid[2];
112
+ const distSq = dx * dx + dy * dy + dz * dz;
113
+ if (distSq > 100) continue;
114
+ const score = dot - distSq / 100;
115
+ if (score > bestScore) {
116
+ bestScore = score;
117
+ bestOrigin = inp.origin;
118
+ }
119
+ }
120
+ if (bestOrigin !== void 0) {
121
+ resultMap.set(hash, bestOrigin);
122
+ }
123
+ } catch {
124
+ }
125
+ }
126
+ }
127
+ }
128
+ if (resultMap.size > 0) {
129
+ const cache = topologyQueryFns.getOrCreateCache(result);
130
+ cache.faceOrigins = resultMap;
131
+ }
132
+ }
133
+ exports.getFaceOrigins = getFaceOrigins;
134
+ exports.propagateOriginsByHash = propagateOriginsByHash;
135
+ exports.propagateOriginsFromEvolution = propagateOriginsFromEvolution;
136
+ exports.setShapeOrigin = setShapeOrigin;
@@ -1,15 +1,5 @@
1
- import { Vec3 } from '../core/types.js';
2
- import { Edge } from '../core/shapeTypes.js';
3
- import { CurveType } from '../core/definitionMaps.js';
4
- import { ShapeFinder } from './finderCore.js';
5
- import { DirectionInput } from './directionUtils.js';
6
- export interface EdgeFinderFn extends ShapeFinder<Edge> {
7
- readonly inDirection: (dir?: DirectionInput, angle?: number) => EdgeFinderFn;
8
- readonly ofLength: (length: number, tolerance?: number) => EdgeFinderFn;
9
- readonly ofCurveType: (curveType: CurveType) => EdgeFinderFn;
10
- readonly parallelTo: (dir?: DirectionInput) => EdgeFinderFn;
11
- readonly atDistance: (distance: number, point?: Vec3) => EdgeFinderFn;
12
- }
13
- /** Create an immutable edge finder. */
14
- export declare function edgeFinder(): EdgeFinderFn;
1
+ /**
2
+ * Re-exports from `./shapeFinders.js` for backward compatibility.
3
+ */
4
+ export { edgeFinder, type EdgeFinderFn } from './shapeFinders.js';
15
5
  //# sourceMappingURL=edgeFinder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edgeFinder.d.ts","sourceRoot":"","sources":["../../src/query/edgeFinder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAKlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAOtE,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACxE,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,YAAY,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AA6CD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
1
+ {"version":3,"file":"edgeFinder.d.ts","sourceRoot":"","sources":["../../src/query/edgeFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,15 +1,5 @@
1
- import { Vec3 } from '../core/types.js';
2
- import { Face } from '../core/shapeTypes.js';
3
- import { SurfaceType } from '../topology/faceFns.js';
4
- import { ShapeFinder } from './finderCore.js';
5
- import { DirectionInput } from './directionUtils.js';
6
- export interface FaceFinderFn extends ShapeFinder<Face> {
7
- readonly inDirection: (dir?: DirectionInput, angle?: number) => FaceFinderFn;
8
- readonly parallelTo: (dir?: DirectionInput) => FaceFinderFn;
9
- readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
10
- readonly ofArea: (area: number, tolerance?: number) => FaceFinderFn;
11
- readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
12
- }
13
- /** Create an immutable face finder. */
14
- export declare function faceFinder(): FaceFinderFn;
1
+ /**
2
+ * Re-exports from `./shapeFinders.js` for backward compatibility.
3
+ */
4
+ export { faceFinder, type FaceFinderFn } from './shapeFinders.js';
15
5
  //# sourceMappingURL=faceFinder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"faceFinder.d.ts","sourceRoot":"","sources":["../../src/query/faceFinder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGpG,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAOtE,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,YAAY,CAAC;IACnE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACpE,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AA0CD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
1
+ {"version":3,"file":"faceFinder.d.ts","sourceRoot":"","sources":["../../src/query/faceFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -17,6 +17,12 @@ export interface ShapeFinder<T extends AnyShape<Dimension>> {
17
17
  readonly findUnique: (shape: AnyShape<Dimension>) => Result<T>;
18
18
  /** Check if an element passes all filters. */
19
19
  readonly shouldKeep: (element: T) => boolean;
20
+ /** Intersect: element must match both this finder AND other. */
21
+ readonly and: (other: ShapeFinder<T>) => ShapeFinder<T>;
22
+ /** Union: element must match this finder OR other. */
23
+ readonly or: (other: ShapeFinder<T>) => ShapeFinder<T>;
24
+ /** Negate: invert all filters on this finder. */
25
+ readonly negate: () => ShapeFinder<T>;
20
26
  readonly _filters: ReadonlyArray<Predicate<T>>;
21
27
  readonly _topoKind: TopoKind;
22
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"finderCore.d.ts","sourceRoot":"","sources":["../../src/query/finderCore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AASjE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAMnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAM3D,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC;IACxD,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnD,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnF,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACpF,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;IAG7C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EACvF,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EACvD,MAAM,EAAE,CACN,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAClC,IAAI,CAAC,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,GACjC,CAAC,CAgFH"}
1
+ {"version":3,"file":"finderCore.d.ts","sourceRoot":"","sources":["../../src/query/finderCore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AASjE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAMnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAM3D,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC;IACxD,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnD,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnF,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACpF,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;IAE7C,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACxD,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACvD,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC;IAGtC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EACvF,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EACvD,MAAM,EAAE,CACN,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAClC,IAAI,CAAC,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,GACjC,CAAC,CA6FH"}