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
@@ -44,22 +44,22 @@ var __callDispose = (stack, error, hasError) => {
44
44
  };
45
45
  return next();
46
46
  };
47
- const result = require("./result-fAX0OZzI.cjs");
48
- const vectors = require("./vectors-D_IiZx0q.cjs");
47
+ const result = require("./result-DULetAht.cjs");
48
+ const vectors = require("./vectors-I_0zdD3O.cjs");
49
49
  const types = require("./types-CA_xrgDq.cjs");
50
50
  const vecOps = require("./vecOps-CjRL1jau.cjs");
51
- const boolean2D = require("./boolean2D-0blbVtJ8.cjs");
52
- const faceFns = require("./faceFns-DB1Fc5gy.cjs");
53
- const curveFns = require("./curveFns-BZngcnQ1.cjs");
54
- const surfaceBuilders = require("./surfaceBuilders-5VA34a3_.cjs");
55
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
56
- const Blueprint = require("./Blueprint-CQ28WJhz.cjs");
57
- const helpers = require("./helpers-C8NoT0Wu.cjs");
58
- const shapeFns = require("./shapeFns-C2SnNvdH.cjs");
59
- const solidBuilders = require("./solidBuilders-994_MQwB.cjs");
60
- const loft = require("./loft-hp3pc1M7.cjs");
51
+ const boolean2D = require("./boolean2D-N9Pgumgg.cjs");
52
+ const faceFns = require("./faceFns-CmIrjdt1.cjs");
53
+ const curveFns = require("./curveFns-CWZRuXQ3.cjs");
54
+ const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
55
+ const surfaceBuilders = require("./surfaceBuilders-DYS8AMSS.cjs");
56
+ const Blueprint = require("./Blueprint-BoC0DsDm.cjs");
57
+ const helpers = require("./helpers-mipaxDTy.cjs");
58
+ const topologyQueryFns = require("./topologyQueryFns-0IptTUCo.cjs");
59
+ const solidBuilders = require("./solidBuilders-BEAoLYvr.cjs");
60
+ const sweepFns = require("./sweepFns-COqeYIUp.cjs");
61
61
  const opentype = require("opentype.js");
62
- const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
62
+ const query = require("./query.cjs");
63
63
  const stitchCurves = (curves, precision = 1e-7) => {
64
64
  const startPoints = new boolean2D.Flatbush(curves.length);
65
65
  curves.forEach((c) => {
@@ -175,7 +175,7 @@ class Sketcher extends boolean2D.BaseSketcher2d {
175
175
  const startToEndVector = vecOps.vecNormalize(diff);
176
176
  const normal = vecOps.vecCross(startToEndVector, this.plane.zDir);
177
177
  const clonedWrapped = result.unwrap(faceFns.downcast(wire.wrapped));
178
- const mirroredRaw = Blueprint.mirror(clonedWrapped, normal, pointer3d);
178
+ const mirroredRaw = shapeTypes.getKernel().mirror(clonedWrapped, types.toVec3(pointer3d), types.toVec3(normal));
179
179
  const mirroredWrapped = result.unwrap(faceFns.downcast(mirroredRaw));
180
180
  const mirroredWire = shapeTypes.createWire(mirroredWrapped);
181
181
  const combinedWire = result.unwrap(surfaceBuilders.assembleWire([wire, mirroredWire]));
@@ -288,11 +288,11 @@ class CompoundSketch {
288
288
  const rawVec = extrusionDirection ? types.toVec3(extrusionDirection) : this.outerSketch.defaultDirection;
289
289
  const normVec = vecOps.vecNormalize(rawVec);
290
290
  const extrusionVec = vecOps.vecScale(normVec, extrusionDistance);
291
- let result2;
291
+ let result$1;
292
292
  if (extrusionProfile && !twistAngle) {
293
- result2 = solidFromShellGenerator(
293
+ result$1 = solidFromShellGenerator(
294
294
  this.sketches,
295
- (sketch) => loft.complexExtrude(
295
+ (sketch) => sweepFns.complexExtrude(
296
296
  sketch.wire,
297
297
  origin ? types.toVec3(origin) : this.outerSketch.defaultOrigin,
298
298
  extrusionVec,
@@ -301,9 +301,9 @@ class CompoundSketch {
301
301
  )
302
302
  );
303
303
  } else if (twistAngle) {
304
- result2 = solidFromShellGenerator(
304
+ result$1 = solidFromShellGenerator(
305
305
  this.sketches,
306
- (sketch) => loft.twistExtrude(
306
+ (sketch) => sweepFns.twistExtrude(
307
307
  sketch.wire,
308
308
  twistAngle,
309
309
  origin ? types.toVec3(origin) : this.outerSketch.defaultOrigin,
@@ -313,22 +313,18 @@ class CompoundSketch {
313
313
  )
314
314
  );
315
315
  } else {
316
- result2 = loft.basicFaceExtrusion(this.face(), extrusionVec);
316
+ result$1 = result.unwrap(boolean2D.extrude(this.face(), extrusionVec));
317
317
  }
318
- return result2;
318
+ return result$1;
319
319
  }
320
320
  /**
321
321
  * Revolves the drawing on an axis (defined by its direction and an origin
322
322
  * (defaults to the sketch origin)
323
323
  */
324
324
  revolve(revolutionAxis, { origin } = {}) {
325
- return result.unwrap(
326
- loft.revolution(
327
- this.face(),
328
- origin ? types.toVec3(origin) : this.outerSketch.defaultOrigin,
329
- revolutionAxis
330
- )
331
- );
325
+ const center = origin ? types.toVec3(origin) : this.outerSketch.defaultOrigin;
326
+ const dir = revolutionAxis ? types.toVec3(revolutionAxis) : [0, 0, 1];
327
+ return result.unwrap(boolean2D.revolve(this.face(), center, dir));
332
328
  }
333
329
  /** Loft between this compound sketch and another with matching sub-sketch counts. */
334
330
  loftWith(otherCompound, loftConfig) {
@@ -339,7 +335,9 @@ class CompoundSketch {
339
335
  );
340
336
  const shells = this.sketches.map((base, cIndex) => {
341
337
  const outer = otherCompound.sketches[cIndex];
342
- return base.clone().loftWith(outer.clone(), { ruled: loftConfig.ruled }, true);
338
+ const loftOpts = {};
339
+ if (loftConfig.ruled !== void 0) loftOpts.ruled = loftConfig.ruled;
340
+ return base.clone().loftWith(outer.clone(), loftOpts, true);
343
341
  });
344
342
  const baseFaceRaw = this.face();
345
343
  const baseFace = shapeTypes.createFace(result.unwrap(faceFns.downcast(baseFaceRaw.wrapped)));
@@ -792,7 +790,7 @@ function wrapSketchDataArray(dataArr) {
792
790
  const FONT_REGISTER = {};
793
791
  async function loadFont(fontPath, fontFamily = "default", force = false) {
794
792
  if (!force && FONT_REGISTER[fontFamily]) {
795
- return FONT_REGISTER[fontFamily];
793
+ return result.ok(FONT_REGISTER[fontFamily]);
796
794
  }
797
795
  let fontData;
798
796
  if (typeof fontPath === "string") {
@@ -800,14 +798,20 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
800
798
  try {
801
799
  response = await fetch(fontPath);
802
800
  } catch (e) {
803
- throw new Error(
804
- `Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
805
- { cause: e }
801
+ return result.err(
802
+ result.ioError(
803
+ result.BrepErrorCode.FONT_FETCH_FAILED,
804
+ `Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
805
+ e
806
+ )
806
807
  );
807
808
  }
808
809
  if (!response.ok) {
809
- throw new Error(
810
- `Failed to fetch font from ${fontPath}: HTTP ${response.status} ${response.statusText}`
810
+ return result.err(
811
+ result.ioError(
812
+ result.BrepErrorCode.FONT_FETCH_FAILED,
813
+ `Failed to fetch font from ${fontPath}: HTTP ${response.status} ${response.statusText}`
814
+ )
811
815
  );
812
816
  }
813
817
  fontData = await response.arrayBuffer();
@@ -818,13 +822,17 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
818
822
  try {
819
823
  font = opentype.parse(fontData);
820
824
  } catch (e) {
821
- throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, {
822
- cause: e
823
- });
825
+ return result.err(
826
+ result.ioError(
827
+ result.BrepErrorCode.FONT_PARSE_FAILED,
828
+ `Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`,
829
+ e
830
+ )
831
+ );
824
832
  }
825
833
  FONT_REGISTER[fontFamily] = font;
826
834
  if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = font;
827
- return font;
835
+ return result.ok(font);
828
836
  }
829
837
  const getFont = (fontFamily = "default") => {
830
838
  return FONT_REGISTER[fontFamily];
@@ -884,107 +892,48 @@ function sketchText(text, textConfig, planeConfig = {}) {
884
892
  function textMetrics(text, options) {
885
893
  const fontSize = options?.fontSize ?? 1;
886
894
  const font = getFont(options?.fontFamily);
887
- if (!font) throw new Error("No font loaded. Call loadFont() first.");
895
+ if (!font) {
896
+ return result.err(
897
+ result.validationError(
898
+ result.BrepErrorCode.NO_FONT_LOADED,
899
+ "No font loaded. Call loadFont() first.",
900
+ void 0,
901
+ void 0,
902
+ "Load a font with loadFont() before calling textMetrics()"
903
+ )
904
+ );
905
+ }
888
906
  const width = font.getAdvanceWidth(text, fontSize);
889
907
  const scale = fontSize / font.unitsPerEm;
890
908
  const ascender = font.ascender * scale;
891
909
  const descender = font.descender * scale;
892
- return { width, height: ascender - descender, ascender, descender };
910
+ return result.ok({ width, height: ascender - descender, ascender, descender });
893
911
  }
894
912
  function fontMetrics(options) {
895
913
  const fontSize = options?.fontSize ?? 1;
896
914
  const font = getFont(options?.fontFamily);
897
- if (!font) throw new Error("No font loaded. Call loadFont() first.");
915
+ if (!font) {
916
+ return result.err(
917
+ result.validationError(
918
+ result.BrepErrorCode.NO_FONT_LOADED,
919
+ "No font loaded. Call loadFont() first.",
920
+ void 0,
921
+ void 0,
922
+ "Load a font with loadFont() before calling fontMetrics()"
923
+ )
924
+ );
925
+ }
898
926
  const scale = fontSize / font.unitsPerEm;
899
927
  const ascender = font.ascender * scale;
900
928
  const descender = font.descender * scale;
901
929
  const lineGap = (font.tables?.os2?.sTypoLineGap ?? 0) * scale;
902
- return {
930
+ return result.ok({
903
931
  ascender,
904
932
  descender,
905
933
  unitsPerEm: font.unitsPerEm,
906
934
  lineHeight: ascender - descender + lineGap
907
- };
908
- }
909
- const PROJECTION_PLANES = {
910
- XY: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
911
- XZ: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
912
- YZ: { dir: [1, 0, 0], xAxis: [0, 1, 0] },
913
- YX: { dir: [0, 0, -1], xAxis: [0, 1, 0] },
914
- ZX: { dir: [0, 1, 0], xAxis: [0, 0, 1] },
915
- ZY: { dir: [-1, 0, 0], xAxis: [0, 0, 1] },
916
- front: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
917
- back: { dir: [0, 1, 0], xAxis: [-1, 0, 0] },
918
- right: { dir: [-1, 0, 0], xAxis: [0, -1, 0] },
919
- left: { dir: [1, 0, 0], xAxis: [0, 1, 0] },
920
- bottom: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
921
- top: { dir: [0, 0, -1], xAxis: [1, 0, 0] }
922
- };
923
- function isProjectionPlane(plane) {
924
- return typeof plane === "string" && plane in PROJECTION_PLANES;
925
- }
926
- const getEdgesFromOc = (shape) => {
927
- if (shape.IsNull()) return [];
928
- return shapeFns.getEdges(shapeTypes.castShape(shape));
929
- };
930
- function makeProjectedEdges(shape, camera, withHiddenLines = true) {
931
- const projected = shapeTypes.getKernel().projectEdges(
932
- shape.wrapped,
933
- [...camera.position],
934
- [...camera.direction],
935
- [...camera.xAxis]
936
- );
937
- const visible = [
938
- ...getEdgesFromOc(projected.visible.sharp),
939
- ...getEdgesFromOc(projected.visible.smooth),
940
- ...getEdgesFromOc(projected.visible.outline)
941
- ];
942
- const hidden = withHiddenLines ? [
943
- ...getEdgesFromOc(projected.hidden.sharp),
944
- ...getEdgesFromOc(projected.hidden.smooth),
945
- ...getEdgesFromOc(projected.hidden.outline)
946
- ] : [];
947
- return { visible, hidden };
948
- }
949
- function createCamera(position = [0, 0, 0], direction = [0, 0, 1], xAxis) {
950
- const dirLength = vecOps.vecLength(direction);
951
- if (dirLength < 1e-12) {
952
- return result.err(
953
- result.validationError("CAMERA_ZERO_DIRECTION", "Camera direction cannot be a zero-length vector")
954
- );
955
- }
956
- let resolvedXAxis;
957
- if (xAxis) {
958
- resolvedXAxis = vecOps.vecNormalize(xAxis);
959
- } else {
960
- let cross = vecOps.vecCross([0, 0, 1], direction);
961
- if (vecOps.vecLength(cross) < 1e-12) {
962
- cross = vecOps.vecCross([0, 1, 0], direction);
963
- }
964
- if (vecOps.vecLength(cross) < 1e-12) {
965
- cross = vecOps.vecCross([1, 0, 0], direction);
966
- }
967
- resolvedXAxis = vecOps.vecNormalize(cross);
968
- }
969
- const yAxis = vecOps.vecNormalize(vecOps.vecCross(direction, resolvedXAxis));
970
- return result.ok({
971
- position,
972
- direction: vecOps.vecNormalize(direction),
973
- xAxis: resolvedXAxis,
974
- yAxis
975
935
  });
976
936
  }
977
- function cameraLookAt(camera, target) {
978
- const direction = vecOps.vecNormalize(vecOps.vecSub(camera.position, target));
979
- return createCamera(camera.position, direction);
980
- }
981
- function cameraFromPlane(planeName) {
982
- const config = PROJECTION_PLANES[planeName];
983
- return createCamera([0, 0, 0], config.dir, config.xAxis);
984
- }
985
- function projectEdges(shape, camera, withHiddenLines = true) {
986
- return makeProjectedEdges(shape, camera, withHiddenLines);
987
- }
988
937
  function wrapBlueprintResult(shape, result2) {
989
938
  if (shape instanceof Blueprint.Blueprint) {
990
939
  return wrapSketchData(result2);
@@ -1098,7 +1047,7 @@ class Drawing {
1098
1047
  * @category Drawing Modifications
1099
1048
  */
1100
1049
  fillet(radius, filter) {
1101
- const finder = filter && filter(cornerFinder.cornerFinder());
1050
+ const finder = filter && filter(query.cornerFinder());
1102
1051
  return new Drawing(fillet2D(this.innerShape, radius, finder));
1103
1052
  }
1104
1053
  /**
@@ -1108,7 +1057,7 @@ class Drawing {
1108
1057
  * @category Drawing Modifications
1109
1058
  */
1110
1059
  chamfer(radius, filter) {
1111
- const finder = filter && filter(cornerFinder.cornerFinder());
1060
+ const finder = filter && filter(query.cornerFinder());
1112
1061
  return new Drawing(chamfer2D(this.innerShape, radius, finder));
1113
1062
  }
1114
1063
  sketchOnPlane(inputPlane, origin) {
@@ -1267,6 +1216,85 @@ const drawParametricFunction = (func, { pointsCount = 400, start = 0, stop = 1,
1267
1216
  });
1268
1217
  return drawPointsInterpolation(points, approximationConfig, { closeShape });
1269
1218
  };
1219
+ const PROJECTION_PLANES = {
1220
+ XY: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
1221
+ XZ: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
1222
+ YZ: { dir: [1, 0, 0], xAxis: [0, 1, 0] },
1223
+ YX: { dir: [0, 0, -1], xAxis: [0, 1, 0] },
1224
+ ZX: { dir: [0, 1, 0], xAxis: [0, 0, 1] },
1225
+ ZY: { dir: [-1, 0, 0], xAxis: [0, 0, 1] },
1226
+ front: { dir: [0, -1, 0], xAxis: [1, 0, 0] },
1227
+ back: { dir: [0, 1, 0], xAxis: [-1, 0, 0] },
1228
+ right: { dir: [-1, 0, 0], xAxis: [0, -1, 0] },
1229
+ left: { dir: [1, 0, 0], xAxis: [0, 1, 0] },
1230
+ bottom: { dir: [0, 0, 1], xAxis: [1, 0, 0] },
1231
+ top: { dir: [0, 0, -1], xAxis: [1, 0, 0] }
1232
+ };
1233
+ function isProjectionPlane(plane) {
1234
+ return typeof plane === "string" && plane in PROJECTION_PLANES;
1235
+ }
1236
+ const getEdgesFromOc = (shape) => {
1237
+ if (shape.IsNull()) return [];
1238
+ return topologyQueryFns.getEdges(shapeTypes.castShape(shape));
1239
+ };
1240
+ function makeProjectedEdges(shape, camera, withHiddenLines = true) {
1241
+ const projected = shapeTypes.getKernel().projectEdges(
1242
+ shape.wrapped,
1243
+ [...camera.position],
1244
+ [...camera.direction],
1245
+ [...camera.xAxis]
1246
+ );
1247
+ const visible = [
1248
+ ...getEdgesFromOc(projected.visible.sharp),
1249
+ ...getEdgesFromOc(projected.visible.smooth),
1250
+ ...getEdgesFromOc(projected.visible.outline)
1251
+ ];
1252
+ const hidden = withHiddenLines ? [
1253
+ ...getEdgesFromOc(projected.hidden.sharp),
1254
+ ...getEdgesFromOc(projected.hidden.smooth),
1255
+ ...getEdgesFromOc(projected.hidden.outline)
1256
+ ] : [];
1257
+ return { visible, hidden };
1258
+ }
1259
+ function createCamera(position = [0, 0, 0], direction = [0, 0, 1], xAxis) {
1260
+ const dirLength = vecOps.vecLength(direction);
1261
+ if (dirLength < 1e-12) {
1262
+ return result.err(
1263
+ result.validationError("CAMERA_ZERO_DIRECTION", "Camera direction cannot be a zero-length vector")
1264
+ );
1265
+ }
1266
+ let resolvedXAxis;
1267
+ if (xAxis) {
1268
+ resolvedXAxis = vecOps.vecNormalize(xAxis);
1269
+ } else {
1270
+ let cross = vecOps.vecCross([0, 0, 1], direction);
1271
+ if (vecOps.vecLength(cross) < 1e-12) {
1272
+ cross = vecOps.vecCross([0, 1, 0], direction);
1273
+ }
1274
+ if (vecOps.vecLength(cross) < 1e-12) {
1275
+ cross = vecOps.vecCross([1, 0, 0], direction);
1276
+ }
1277
+ resolvedXAxis = vecOps.vecNormalize(cross);
1278
+ }
1279
+ const yAxis = vecOps.vecNormalize(vecOps.vecCross(direction, resolvedXAxis));
1280
+ return result.ok({
1281
+ position,
1282
+ direction: vecOps.vecNormalize(direction),
1283
+ xAxis: resolvedXAxis,
1284
+ yAxis
1285
+ });
1286
+ }
1287
+ function cameraLookAt(camera, target) {
1288
+ const direction = vecOps.vecNormalize(vecOps.vecSub(camera.position, target));
1289
+ return createCamera(camera.position, direction);
1290
+ }
1291
+ function cameraFromPlane(planeName) {
1292
+ const config = PROJECTION_PLANES[planeName];
1293
+ return createCamera([0, 0, 0], config.dir, config.xAxis);
1294
+ }
1295
+ function projectEdges(shape, camera, withHiddenLines = true) {
1296
+ return makeProjectedEdges(shape, camera, withHiddenLines);
1297
+ }
1270
1298
  const edgesToDrawing = (edges) => {
1271
1299
  var _stack = [];
1272
1300
  try {
@@ -1303,7 +1331,7 @@ function drawFaceOutline(face) {
1303
1331
  const scope = __using(_stack, new shapeTypes.DisposalScope());
1304
1332
  const clonedFace = scope.register(shapeTypes.createFace(result.unwrap(faceFns.downcast(face.wrapped))));
1305
1333
  const faceOuterWire = scope.register(faceFns.outerWire(clonedFace));
1306
- const curves = shapeFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1334
+ const curves = topologyQueryFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1307
1335
  const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
1308
1336
  if (stitchedCurves.length === 0) return new Drawing();
1309
1337
  if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
@@ -1,6 +1,6 @@
1
- import { B as getKernel, c as castShape, p as isShape3D$1, u as isWire$1 } from "./shapeTypes-CpSaBLDv.js";
2
- import { a as toVec3 } from "./types-CWDdqcrq.js";
3
- import { e as err, r as typeCastError, o as ok, v as unwrap } from "./result-BaSD1fqR.js";
1
+ import { g as getKernel, c as castShape } from "./shapeTypes-dhhm-T5A.js";
2
+ import { t as toVec3 } from "./types-CcKqsmd0.js";
3
+ import { e as err, t as typeCastError, o as ok, u as unwrap } from "./result-CoDaWsvc.js";
4
4
  const TOPO_ENUM = {
5
5
  compound: 0,
6
6
  solidCompound: 1,
@@ -55,12 +55,6 @@ function cast(shape) {
55
55
  }
56
56
  return ok(castShape(shape));
57
57
  }
58
- function isShape3D(shape) {
59
- return isShape3D$1(shape);
60
- }
61
- function isWire(shape) {
62
- return isWire$1(shape);
63
- }
64
58
  function isCompSolid(shape) {
65
59
  return getKernel().shapeType(shape.wrapped) === "compsolid";
66
60
  }
@@ -172,27 +166,25 @@ function innerWires(face) {
172
166
  return result;
173
167
  }
174
168
  export {
175
- isShape3D as a,
176
- isWire as b,
169
+ faceCenter as a,
170
+ uvCoordinates as b,
177
171
  cast as c,
178
172
  downcast as d,
179
- faceCenter as e,
173
+ fromBREP as e,
180
174
  faceGeomType as f,
181
175
  getSurfaceType as g,
182
- uvCoordinates as h,
176
+ innerWires as h,
183
177
  iterTopo as i,
184
- fromBREP as j,
185
- innerWires as k,
186
- asTopo as l,
187
- classifyPointOnFace as m,
178
+ asTopo as j,
179
+ classifyPointOnFace as k,
180
+ faceOrientation as l,
181
+ flipFaceOrientation as m,
188
182
  normalAt as n,
189
183
  outerWire as o,
190
184
  pointOnSurface as p,
191
- faceOrientation as q,
192
- flipFaceOrientation as r,
193
- isCompSolid as s,
194
- projectPointOnFace as t,
195
- uvBounds as u,
196
- removeHolesFromFace as v,
197
- shapeType as w
185
+ isCompSolid as q,
186
+ projectPointOnFace as r,
187
+ removeHolesFromFace as s,
188
+ shapeType as t,
189
+ uvBounds as u
198
190
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
2
+ const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
- const result = require("./result-fAX0OZzI.cjs");
4
+ const result = require("./result-DULetAht.cjs");
5
5
  const TOPO_ENUM = {
6
6
  compound: 0,
7
7
  solidCompound: 1,
@@ -56,12 +56,6 @@ function cast(shape) {
56
56
  }
57
57
  return result.ok(shapeTypes.castShape(shape));
58
58
  }
59
- function isShape3D(shape) {
60
- return shapeTypes.isShape3D(shape);
61
- }
62
- function isWire(shape) {
63
- return shapeTypes.isWire(shape);
64
- }
65
59
  function isCompSolid(shape) {
66
60
  return shapeTypes.getKernel().shapeType(shape.wrapped) === "compsolid";
67
61
  }
@@ -184,8 +178,6 @@ exports.fromBREP = fromBREP;
184
178
  exports.getSurfaceType = getSurfaceType;
185
179
  exports.innerWires = innerWires;
186
180
  exports.isCompSolid = isCompSolid;
187
- exports.isShape3D = isShape3D;
188
- exports.isWire = isWire;
189
181
  exports.iterTopo = iterTopo;
190
182
  exports.normalAt = normalAt;
191
183
  exports.outerWire = outerWire;
@@ -1,9 +1,10 @@
1
- import { c as castShape, B as getKernel, k as isFace } from "./shapeTypes-CpSaBLDv.js";
2
- import { v as unwrap, e as err, q as queryError, o as ok } from "./result-BaSD1fqR.js";
3
- import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
4
- import { i as iterTopo, d as downcast, g as getSurfaceType, n as normalAt } from "./faceFns-B8GnxjdY.js";
5
- import { m as measureArea } from "./measurement-D8EJ694A.js";
6
- import { f as getHashCode, i as isSameShape } from "./shapeFns-FDuKkrDR.js";
1
+ import { c as castShape, g as getKernel, o as isFace } from "./shapeTypes-dhhm-T5A.js";
2
+ import { u as unwrap, e as err, q as queryError, o as ok, c as isOk } from "./result-CoDaWsvc.js";
3
+ import { c as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-LTN--A58.js";
4
+ import { g as getCurveType, c as curveLength, a as curveIsClosed } from "./curveFns-OmbtFSG8.js";
5
+ import { i as iterTopo, d as downcast, g as getSurfaceType, n as normalAt } from "./faceFns-Bn2seBfp.js";
6
+ import { m as measureArea } from "./measurement-fJWDEpz0.js";
7
+ import { g as getHashCode, i as isSameShape } from "./shapeFns-BZ6zk7nd.js";
7
8
  const PRECISION_INTERSECTION = 1e-9;
8
9
  const PRECISION_OFFSET = 1e-8;
9
10
  const PRECISION_POINT = 1e-6;
@@ -45,6 +46,10 @@ const rotate2d = (point, angle, center = [0, 0]) => {
45
46
  const ynew = px * sinA + py * cosA;
46
47
  return [xnew + cx, ynew + cy];
47
48
  };
49
+ function normalize2d([x, y]) {
50
+ const l = Math.sqrt(x * x + y * y);
51
+ return l < 1e-12 ? [0, 0] : [x / l, y / l];
52
+ }
48
53
  const polarToCartesian = (r, theta) => {
49
54
  const x = Math.cos(theta) * r;
50
55
  const y = Math.sin(theta) * r;
@@ -116,7 +121,16 @@ function createTypedFinder(topoKind, filters, rebuild, extend) {
116
121
  }
117
122
  return ok(match);
118
123
  },
119
- shouldKeep
124
+ shouldKeep,
125
+ and: (other) => withFilter((el) => other.shouldKeep(el)),
126
+ or: (other) => {
127
+ const selfKeep = shouldKeep;
128
+ return rebuild([(el) => selfKeep(el) || other.shouldKeep(el)]);
129
+ },
130
+ negate: () => {
131
+ const selfKeep = shouldKeep;
132
+ return rebuild([(el) => !selfKeep(el)]);
133
+ }
120
134
  };
121
135
  const extensions = extend(base, withFilter);
122
136
  return { ...base, ...extensions };
@@ -138,6 +152,35 @@ function distanceFromPointFilter(distance, point, tolerance) {
138
152
  return Math.abs(d - distance) < tolerance;
139
153
  };
140
154
  }
155
+ function edgeDirectionFilter(dir, angle) {
156
+ const d = vecNormalize(resolveDir(dir));
157
+ return (edge) => {
158
+ const kernel = getKernel();
159
+ const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
160
+ const midParam = (firstParam + lastParam) / 2;
161
+ const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
162
+ const tangent = vecNormalize(rawTangent);
163
+ const ang = Math.acos(Math.min(1, Math.abs(vecDot(tangent, d))));
164
+ return Math.abs(ang - DEG2RAD * angle) < 1e-6;
165
+ };
166
+ }
167
+ function buildEdgeFinder(filters) {
168
+ return createTypedFinder(
169
+ "edge",
170
+ filters,
171
+ buildEdgeFinder,
172
+ (_base, withFilter) => ({
173
+ inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
174
+ ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveLength(edge) - length) < tolerance),
175
+ ofCurveType: (curveType) => withFilter((edge) => getCurveType(edge) === curveType),
176
+ parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
177
+ atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
178
+ })
179
+ );
180
+ }
181
+ function edgeFinder() {
182
+ return buildEdgeFinder([]);
183
+ }
141
184
  function faceDirectionFilter(dir, angle) {
142
185
  const d = vecNormalize(resolveDir(dir));
143
186
  return (face) => {
@@ -155,7 +198,10 @@ function buildFaceFinder(filters) {
155
198
  inDirection: (dir = "Z", angle = 0) => withFilter(faceDirectionFilter(dir, angle)),
156
199
  parallelTo: (dir = "Z") => buildFaceFinder(filters).inDirection(dir, 0),
157
200
  ofSurfaceType: (surfaceType) => withFilter((face) => unwrap(getSurfaceType(face)) === surfaceType),
158
- ofArea: (area, tolerance = 1e-3) => withFilter((face) => Math.abs(measureArea(face) - area) < tolerance),
201
+ ofArea: (area, tolerance = 1e-3) => withFilter((face) => {
202
+ const r = measureArea(face);
203
+ return isOk(r) && Math.abs(r.value - area) < tolerance;
204
+ }),
159
205
  atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
160
206
  })
161
207
  );
@@ -163,6 +209,27 @@ function buildFaceFinder(filters) {
163
209
  function faceFinder() {
164
210
  return buildFaceFinder([]);
165
211
  }
212
+ function buildWireFinder(filters) {
213
+ return createTypedFinder(
214
+ "wire",
215
+ filters,
216
+ buildWireFinder,
217
+ (_base, withFilter) => ({
218
+ isClosed: () => withFilter((wire) => curveIsClosed(wire)),
219
+ isOpen: () => withFilter((wire) => !curveIsClosed(wire)),
220
+ ofEdgeCount: (count) => withFilter((wire) => {
221
+ let edgeCount = 0;
222
+ for (const _raw of iterTopo(wire.wrapped, "edge")) {
223
+ edgeCount++;
224
+ }
225
+ return edgeCount === count;
226
+ })
227
+ })
228
+ );
229
+ }
230
+ function wireFinder() {
231
+ return buildWireFinder([]);
232
+ }
166
233
  function getSingleFace(f, shape) {
167
234
  if (typeof f === "object" && "_topoKind" in f) {
168
235
  return f.findUnique(shape);
@@ -173,22 +240,23 @@ function getSingleFace(f, shape) {
173
240
  }
174
241
  export {
175
242
  PRECISION_OFFSET as P,
176
- angle2d as a,
177
- scalarMultiply2d as b,
178
- add2d as c,
243
+ scalarMultiply2d as a,
244
+ add2d as b,
245
+ subtract2d as c,
179
246
  distance2d as d,
180
- subtract2d as e,
181
- squareDistance2d as f,
247
+ squareDistance2d as e,
248
+ crossProduct2d as f,
182
249
  getSingleFace as g,
183
- crossProduct2d as h,
184
- cartesianToPolar as i,
185
- polarAngle2d as j,
186
- PRECISION_INTERSECTION as k,
187
- createTypedFinder as l,
250
+ cartesianToPolar as h,
251
+ polarAngle2d as i,
252
+ PRECISION_INTERSECTION as j,
253
+ createTypedFinder as k,
254
+ edgeFinder as l,
188
255
  faceFinder as m,
189
- distanceFromPointFilter as n,
190
- resolveDir as o,
256
+ normalize2d as n,
257
+ angle2d as o,
191
258
  polarToCartesian as p,
192
259
  rotate2d as r,
193
- samePoint as s
260
+ samePoint as s,
261
+ wireFinder as w
194
262
  };