brepjs 12.8.2 → 12.9.1

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 (225) hide show
  1. package/dist/2d/lib/svgPath.d.ts.map +1 -1
  2. package/dist/2d/lib/vectorOperations.d.ts +4 -1
  3. package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
  4. package/dist/2d.cjs +2 -2
  5. package/dist/2d.js +5 -5
  6. package/dist/{Blueprint-DbVaf6k7.js → Blueprint-1HGbugaC.js} +33 -63
  7. package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-CUyXM6CV.cjs} +15 -45
  8. package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-9OnbotKT.cjs} +9 -9
  9. package/dist/{boolean2D-y3E92F0u.js → boolean2D-CR4efa35.js} +11 -11
  10. package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-BBd2oTvv.cjs} +43 -40
  11. package/dist/{booleanFns-BCTjYZAg.js → booleanFns-Br2KdGJq.js} +53 -50
  12. package/dist/brepjs.cjs +379 -284
  13. package/dist/brepjs.js +1437 -1341
  14. package/dist/core/definitionMaps.d.ts +2 -7
  15. package/dist/core/definitionMaps.d.ts.map +1 -1
  16. package/dist/core/dimensionTypes.d.ts +52 -0
  17. package/dist/core/dimensionTypes.d.ts.map +1 -0
  18. package/dist/core/disposal.d.ts +18 -0
  19. package/dist/core/disposal.d.ts.map +1 -1
  20. package/dist/core/errors.d.ts +1 -8
  21. package/dist/core/errors.d.ts.map +1 -1
  22. package/dist/core/kernelErrorTranslation.d.ts +15 -0
  23. package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
  24. package/dist/core/planeOps.d.ts +14 -0
  25. package/dist/core/planeOps.d.ts.map +1 -1
  26. package/dist/core/result.d.ts +4 -0
  27. package/dist/core/result.d.ts.map +1 -1
  28. package/dist/core/shapeTypes.d.ts +14 -146
  29. package/dist/core/shapeTypes.d.ts.map +1 -1
  30. package/dist/core/typeDiscriminants.d.ts +14 -0
  31. package/dist/core/typeDiscriminants.d.ts.map +1 -0
  32. package/dist/core/validityTypes.d.ts +100 -0
  33. package/dist/core/validityTypes.d.ts.map +1 -0
  34. package/dist/core.cjs +52 -11
  35. package/dist/core.d.ts +1 -1
  36. package/dist/core.d.ts.map +1 -1
  37. package/dist/core.js +118 -75
  38. package/dist/{curveFns-mROFhiuG.js → curveFns-1u0oZ0u0.js} +14 -14
  39. package/dist/{curveFns-BZngcnQ1.cjs → curveFns-BwLvO_Ia.cjs} +2 -2
  40. package/dist/{drawFns-Bwakrq7w.js → drawFns-B0na6sbo.js} +16 -16
  41. package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-CzlEePor.cjs} +18 -18
  42. package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-BAKkZG6D.cjs} +2 -2
  43. package/dist/{faceFns-B8GnxjdY.js → faceFns-DGMp47Os.js} +3 -3
  44. package/dist/{helpers-C8NoT0Wu.cjs → helpers-DVdscQxW.cjs} +73 -8
  45. package/dist/{helpers-X0juxnwj.js → helpers-sJjnIXDA.js} +85 -20
  46. package/dist/index.d.ts +10 -11
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/io.cjs +4 -4
  49. package/dist/io.js +4 -4
  50. package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
  51. package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
  52. package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
  53. package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
  54. package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
  55. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
  56. package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
  57. package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
  58. package/dist/kernel/brepkit/helpers.d.ts +84 -0
  59. package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
  60. package/dist/kernel/brepkit/internalOps.d.ts +28 -0
  61. package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
  62. package/dist/kernel/brepkit/ioOps.d.ts +43 -0
  63. package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
  64. package/dist/kernel/brepkit/measureOps.d.ts +30 -0
  65. package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
  66. package/dist/kernel/brepkit/meshOps.d.ts +7 -0
  67. package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
  68. package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
  69. package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
  70. package/dist/kernel/brepkit/repairOps.d.ts +14 -0
  71. package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
  72. package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
  73. package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
  74. package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
  75. package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
  76. package/dist/kernel/brepkit/transformOps.d.ts +14 -0
  77. package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
  78. package/dist/kernel/brepkitAdapter.d.ts +1 -1
  79. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  80. package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
  81. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  82. package/dist/kernel/defaultAdapter.d.ts.map +1 -1
  83. package/dist/kernel/extendedConstructorOps.d.ts +9 -1
  84. package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
  85. package/dist/kernel/index.d.ts +1 -0
  86. package/dist/kernel/index.d.ts.map +1 -1
  87. package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
  88. package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
  89. package/dist/kernel/interfaces/construction-ops.d.ts +76 -0
  90. package/dist/kernel/interfaces/construction-ops.d.ts.map +1 -0
  91. package/dist/kernel/interfaces/core.d.ts +45 -0
  92. package/dist/kernel/interfaces/core.d.ts.map +1 -0
  93. package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
  94. package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
  95. package/dist/kernel/interfaces/geometry-ops.d.ts +77 -0
  96. package/dist/kernel/interfaces/geometry-ops.d.ts.map +1 -0
  97. package/dist/kernel/interfaces/index.d.ts +29 -0
  98. package/dist/kernel/interfaces/index.d.ts.map +1 -0
  99. package/dist/kernel/interfaces/io-ops.d.ts +66 -0
  100. package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
  101. package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
  102. package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
  103. package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
  104. package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
  105. package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
  106. package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
  107. package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
  108. package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
  109. package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
  110. package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
  111. package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
  112. package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
  113. package/dist/kernel/interfaces/transform-ops.d.ts +20 -0
  114. package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
  115. package/dist/kernel/modifierOps.d.ts +2 -2
  116. package/dist/kernel/modifierOps.d.ts.map +1 -1
  117. package/dist/kernel/types.d.ts +2 -446
  118. package/dist/kernel/types.d.ts.map +1 -1
  119. package/dist/{loft-hp3pc1M7.cjs → loft-BNvBZzqe.cjs} +5 -5
  120. package/dist/{loft-Bhw-FMoL.js → loft-D0aCZRaB.js} +7 -7
  121. package/dist/measurement/measureFns.d.ts +2 -2
  122. package/dist/measurement/measureFns.d.ts.map +1 -1
  123. package/dist/{measurement-D8EJ694A.js → measurement-C7o5jE6G.js} +2 -2
  124. package/dist/{measurement-BoNTUBAp.cjs → measurement-DZcaxo1A.cjs} +2 -2
  125. package/dist/measurement.cjs +1 -1
  126. package/dist/measurement.js +1 -1
  127. package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-7dgZgNYK.cjs} +4 -4
  128. package/dist/{meshFns-nQjK38EC.js → meshFns-CtUl9fGY.js} +3 -3
  129. package/dist/operations/compoundOpsFns.d.ts +38 -0
  130. package/dist/operations/compoundOpsFns.d.ts.map +1 -0
  131. package/dist/operations/extrude.d.ts +2 -12
  132. package/dist/operations/extrude.d.ts.map +1 -1
  133. package/dist/operations/extrudeFns.d.ts +2 -93
  134. package/dist/operations/extrudeFns.d.ts.map +1 -1
  135. package/dist/operations/guidedSweepFns.d.ts +3 -22
  136. package/dist/operations/guidedSweepFns.d.ts.map +1 -1
  137. package/dist/operations/loft.d.ts +2 -16
  138. package/dist/operations/loft.d.ts.map +1 -1
  139. package/dist/operations/multiSweepFns.d.ts +3 -29
  140. package/dist/operations/multiSweepFns.d.ts.map +1 -1
  141. package/dist/operations/roofFns.d.ts +2 -2
  142. package/dist/operations/roofFns.d.ts.map +1 -1
  143. package/dist/operations/sweepFns.d.ts +121 -0
  144. package/dist/operations/sweepFns.d.ts.map +1 -0
  145. package/dist/{operations-BfbkK6DU.js → operations-DisJ5F8s.js} +110 -57
  146. package/dist/{operations-CYpmLSC4.cjs → operations-DwZ-RBO1.cjs} +97 -44
  147. package/dist/operations.cjs +2 -2
  148. package/dist/operations.js +14 -14
  149. package/dist/originTrackingFns-NJ1dWoiF.js +137 -0
  150. package/dist/originTrackingFns-dhaCe8Yb.cjs +136 -0
  151. package/dist/query/edgeFinder.d.ts +4 -14
  152. package/dist/query/edgeFinder.d.ts.map +1 -1
  153. package/dist/query/faceFinder.d.ts +4 -14
  154. package/dist/query/faceFinder.d.ts.map +1 -1
  155. package/dist/query/finderCore.d.ts +6 -0
  156. package/dist/query/finderCore.d.ts.map +1 -1
  157. package/dist/query/shapeFinders.d.ts +32 -0
  158. package/dist/query/shapeFinders.d.ts.map +1 -0
  159. package/dist/query/wireFinder.d.ts +4 -9
  160. package/dist/query/wireFinder.d.ts.map +1 -1
  161. package/dist/query.cjs +54 -32
  162. package/dist/query.js +56 -34
  163. package/dist/{result-fAX0OZzI.cjs → result-DJAAj1yb.cjs} +8 -59
  164. package/dist/{result-BaSD1fqR.js → result-DtuwWSUD.js} +38 -89
  165. package/dist/result.cjs +1 -1
  166. package/dist/result.js +22 -22
  167. package/dist/shapeFns-BJbua5kT.js +34 -0
  168. package/dist/shapeFns-w9tWELHX.cjs +33 -0
  169. package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-CAEAyk8j.js} +233 -172
  170. package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-owrg2MNK.cjs} +421 -360
  171. package/dist/sketching/Sketcher.d.ts.map +1 -1
  172. package/dist/sketching.cjs +2 -2
  173. package/dist/sketching.js +2 -2
  174. package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BLQ4I6Ig.cjs} +3 -3
  175. package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-BS-1220W.js} +3 -3
  176. package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dj6AjhOv.js} +7 -7
  177. package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-KU_7OD2q.cjs} +3 -3
  178. package/dist/topology/booleanFns.d.ts.map +1 -1
  179. package/dist/topology/compoundOpsFns.d.ts +3 -35
  180. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  181. package/dist/topology/index.d.ts +0 -1
  182. package/dist/topology/index.d.ts.map +1 -1
  183. package/dist/topology/metadataPropagation.d.ts +30 -0
  184. package/dist/topology/metadataPropagation.d.ts.map +1 -0
  185. package/dist/topology/modifierFns.d.ts.map +1 -1
  186. package/dist/topology/originTrackingFns.d.ts +23 -0
  187. package/dist/topology/originTrackingFns.d.ts.map +1 -0
  188. package/dist/topology/shapeFns.d.ts +6 -120
  189. package/dist/topology/shapeFns.d.ts.map +1 -1
  190. package/dist/topology/topologyQueryFns.d.ts +67 -0
  191. package/dist/topology/topologyQueryFns.d.ts.map +1 -0
  192. package/dist/topology/transformFns.d.ts +49 -0
  193. package/dist/topology/transformFns.d.ts.map +1 -0
  194. package/dist/topology/wrapperFns.d.ts.map +1 -1
  195. package/dist/{topology-ANwCzGL8.cjs → topology-CyPHYYjV.cjs} +205 -20
  196. package/dist/{topology-C7x98OVn.js → topology-D6LeuhI_.js} +235 -50
  197. package/dist/topology.cjs +18 -17
  198. package/dist/topology.js +92 -91
  199. package/dist/topologyQueryFns-De439iBP.js +119 -0
  200. package/dist/topologyQueryFns-fz5kz5e1.cjs +118 -0
  201. package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
  202. package/dist/utils/precisionRound.d.ts +4 -0
  203. package/dist/utils/precisionRound.d.ts.map +1 -1
  204. package/dist/utils/vec2d.d.ts +5 -0
  205. package/dist/utils/vec2d.d.ts.map +1 -1
  206. package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
  207. package/dist/{vectors-D_IiZx0q.cjs → vectors-C8N_QeEX.cjs} +9 -1
  208. package/dist/{vectors-Bx8wkNui.js → vectors-DTREgnVp.js} +15 -7
  209. package/dist/vectors.cjs +1 -1
  210. package/dist/vectors.js +23 -23
  211. package/package.json +3 -3
  212. package/dist/core/geometryHelpers.d.ts +0 -30
  213. package/dist/core/geometryHelpers.d.ts.map +0 -1
  214. package/dist/core/memory.d.ts +0 -6
  215. package/dist/core/memory.d.ts.map +0 -1
  216. package/dist/core/typeErrors.d.ts +0 -17
  217. package/dist/core/typeErrors.d.ts.map +0 -1
  218. package/dist/cornerFinder-Ckz-mPHE.js +0 -59
  219. package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
  220. package/dist/shapeFns-C2SnNvdH.cjs +0 -468
  221. package/dist/shapeFns-FDuKkrDR.js +0 -469
  222. package/dist/utils/round2.d.ts +0 -3
  223. package/dist/utils/round2.d.ts.map +0 -1
  224. package/dist/utils/round5.d.ts +0 -3
  225. package/dist/utils/round5.d.ts.map +0 -1
package/dist/core.cjs CHANGED
@@ -2,9 +2,50 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
5
- const result = require("./result-fAX0OZzI.cjs");
6
- const vectors = require("./vectors-D_IiZx0q.cjs");
7
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
5
+ const result = require("./result-DJAAj1yb.cjs");
6
+ const vectors = require("./vectors-C8N_QeEX.cjs");
7
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
8
+ function isClosedWire(wire) {
9
+ return shapeTypes.getKernel().curveIsClosed(wire.wrapped);
10
+ }
11
+ function isOrientedFace(face) {
12
+ return shapeTypes.getKernel().isValid(face.wrapped);
13
+ }
14
+ function isManifoldShell(shell) {
15
+ const kernel = shapeTypes.getKernel();
16
+ if (!kernel.isValid(shell.wrapped)) return false;
17
+ const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
18
+ try {
19
+ const solid = kernel.solidFromShell(shell.wrapped);
20
+ const valid = validate(solid);
21
+ try {
22
+ kernel.dispose(solid);
23
+ } catch {
24
+ }
25
+ return valid;
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+ function isValidSolid(solid) {
31
+ return shapeTypes.getKernel().isValid(solid.wrapped);
32
+ }
33
+ function closedWire(wire) {
34
+ if (isClosedWire(wire)) return result.ok(wire);
35
+ return result.err("Wire is not closed: start and end points do not coincide");
36
+ }
37
+ function orientedFace(face) {
38
+ if (isOrientedFace(face)) return result.ok(face);
39
+ return result.err("Face orientation is inconsistent or face is invalid");
40
+ }
41
+ function manifoldShell(shell) {
42
+ if (isManifoldShell(shell)) return result.ok(shell);
43
+ return result.err("Shell is not manifold: has free edges or is invalid");
44
+ }
45
+ function validSolid(solid) {
46
+ if (isValidSolid(solid)) return result.ok(solid);
47
+ return result.err("Solid failed BRepCheck validation");
48
+ }
8
49
  exports.resolveDirection = types.resolveDirection;
9
50
  exports.toVec2 = types.toVec2;
10
51
  exports.toVec3 = types.toVec3;
@@ -62,29 +103,29 @@ exports.resolvePlane = vectors.resolvePlane;
62
103
  exports.translatePlane = vectors.translatePlane;
63
104
  exports.DisposalScope = shapeTypes.DisposalScope;
64
105
  exports.castShape = shapeTypes.castShape;
65
- exports.closedWire = shapeTypes.closedWire;
66
106
  exports.createHandle = shapeTypes.createHandle;
67
107
  exports.createKernelHandle = shapeTypes.createKernelHandle;
68
108
  exports.getShapeKind = shapeTypes.getShapeKind;
69
109
  exports.is2D = shapeTypes.is2D;
70
110
  exports.is3D = shapeTypes.is3D;
71
- exports.isClosedWire = shapeTypes.isClosedWire;
72
111
  exports.isCompound = shapeTypes.isCompound;
73
112
  exports.isEdge = shapeTypes.isEdge;
74
113
  exports.isFace = shapeTypes.isFace;
75
114
  exports.isLive = shapeTypes.isLive;
76
- exports.isManifoldShell = shapeTypes.isManifoldShell;
77
- exports.isOrientedFace = shapeTypes.isOrientedFace;
78
115
  exports.isShape1D = shapeTypes.isShape1D;
79
116
  exports.isShape3D = shapeTypes.isShape3D;
80
117
  exports.isShell = shapeTypes.isShell;
81
118
  exports.isSolid = shapeTypes.isSolid;
82
- exports.isValidSolid = shapeTypes.isValidSolid;
83
119
  exports.isVertex = shapeTypes.isVertex;
84
120
  exports.isWire = shapeTypes.isWire;
85
- exports.manifoldShell = shapeTypes.manifoldShell;
86
- exports.orientedFace = shapeTypes.orientedFace;
87
- exports.validSolid = shapeTypes.validSolid;
88
121
  exports.withScope = shapeTypes.withScope;
89
122
  exports.withScopeResult = shapeTypes.withScopeResult;
90
123
  exports.withScopeResultAsync = shapeTypes.withScopeResultAsync;
124
+ exports.closedWire = closedWire;
125
+ exports.isClosedWire = isClosedWire;
126
+ exports.isManifoldShell = isManifoldShell;
127
+ exports.isOrientedFace = isOrientedFace;
128
+ exports.isValidSolid = isValidSolid;
129
+ exports.manifoldShell = manifoldShell;
130
+ exports.orientedFace = orientedFace;
131
+ exports.validSolid = validSolid;
package/dist/core.d.ts CHANGED
@@ -10,7 +10,7 @@ export { type BrepError, type BrepErrorKind, kernelError, validationError, typeC
10
10
  export { DEG2RAD, RAD2DEG, HASH_CODE_MAX } from './core/constants.js';
11
11
  export type { Plane as FnPlane, PlaneName as FnPlaneName, PlaneInput } from './core/planeTypes.js';
12
12
  export { createPlane, createNamedPlane, resolvePlane, translatePlane, pivotPlane, } from './core/planeOps.js';
13
- export type { Dimension, ShapeKind, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound, AnyShape, Shape1D, Shape3D, ClosedWire, OrientedFace, ManifoldShell, ValidSolid, ValidityResult, } from './core/shapeTypes.js';
13
+ export type { Dimension, ShapeKind, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound, AnyShape, Shape1D, Shape3D, ClosedWire, OrientedFace, ManifoldShell, ValidSolid, } from './core/shapeTypes.js';
14
14
  export { castShape, getShapeKind, isVertex, isEdge, isWire, isFace, isShell, isSolid, isCompound, isShape3D, isShape1D, is3D, is2D, closedWire, orientedFace, manifoldShell, validSolid, isClosedWire, isOrientedFace, isManifoldShell, isValidSolid, } from './core/shapeTypes.js';
15
15
  export type { ShapeHandle, KernelHandle } from './core/disposal.js';
16
16
  export { createHandle, createKernelHandle, DisposalScope, withScope, withScopeResult, withScopeResultAsync, isLive, } from './core/disposal.js';
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,EAAE,EACF,GAAG,EACH,EAAE,EACF,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,MAAM,GACP,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,EAAE,EACF,GAAG,EACH,EAAE,EACF,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,MAAM,GACP,MAAM,oBAAoB,CAAC"}
package/dist/core.js CHANGED
@@ -1,90 +1,133 @@
1
- import { r, t, a } from "./types-CWDdqcrq.js";
2
- import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
3
- import { B, O, a as a3, b as b2, c as c2, d as d2, e as e2, f as f2, i as i2, g as g2, h as h2, k as k2, m as m2, j as j2, l as l2, n as n2, o as o2, q, s, t as t2, p, r as r2, u, v as v2, w, x, y, z } from "./result-BaSD1fqR.js";
4
- import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-Bx8wkNui.js";
5
- import { D as D2, c as c4, a as a5, b as b3, d as d3, g as g3, i as i3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, o as o3, p as p3, q as q2, r as r4, s as s2, t as t4, u as u2, v as v3, w as w2, x as x2, y as y2, z as z2, A } from "./shapeTypes-CpSaBLDv.js";
1
+ import { r, a, t } from "./types-CcKqsmd0.js";
2
+ import { D, H, R, a as a2, j, e, h, d, k, i, v, l, m, c, n, o, g, b, f } from "./vecOps-LTN--A58.js";
3
+ import { o as ok, e as err } from "./result-DtuwWSUD.js";
4
+ import { g as g2, O, a as a3, c as c2, j as j2, d as d2, l as l2, i as i2, b as b2, f as f2, k as k2, p, w, x, y, q, D as D2, G, H as H2, t as t2, I, u, J, K, L, v as v2 } from "./result-DtuwWSUD.js";
5
+ import { a as a4, c as c3, b as b3, r as r2, t as t3 } from "./vectors-DTREgnVp.js";
6
+ import { g as getKernel } from "./shapeTypes-CAEAyk8j.js";
7
+ import { D as D3, c as c4, v as v3, w as w2, a as a5, B, C, E, i as i3, o as o2, F, G as G2, j as j3, d as d3, k as k3, H as H3, b as b4, L as L2, M, N } from "./shapeTypes-CAEAyk8j.js";
8
+ function isClosedWire(wire) {
9
+ return getKernel().curveIsClosed(wire.wrapped);
10
+ }
11
+ function isOrientedFace(face) {
12
+ return getKernel().isValid(face.wrapped);
13
+ }
14
+ function isManifoldShell(shell) {
15
+ const kernel = getKernel();
16
+ if (!kernel.isValid(shell.wrapped)) return false;
17
+ const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
18
+ try {
19
+ const solid = kernel.solidFromShell(shell.wrapped);
20
+ const valid = validate(solid);
21
+ try {
22
+ kernel.dispose(solid);
23
+ } catch {
24
+ }
25
+ return valid;
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+ function isValidSolid(solid) {
31
+ return getKernel().isValid(solid.wrapped);
32
+ }
33
+ function closedWire(wire) {
34
+ if (isClosedWire(wire)) return ok(wire);
35
+ return err("Wire is not closed: start and end points do not coincide");
36
+ }
37
+ function orientedFace(face) {
38
+ if (isOrientedFace(face)) return ok(face);
39
+ return err("Face orientation is inconsistent or face is invalid");
40
+ }
41
+ function manifoldShell(shell) {
42
+ if (isManifoldShell(shell)) return ok(shell);
43
+ return err("Shell is not manifold: has free edges or is invalid");
44
+ }
45
+ function validSolid(solid) {
46
+ if (isValidSolid(solid)) return ok(solid);
47
+ return err("Solid failed BRepCheck validation");
48
+ }
6
49
  export {
7
- B as BrepBugError,
50
+ g2 as BrepBugError,
8
51
  D as DEG2RAD,
9
- D2 as DisposalScope,
52
+ D3 as DisposalScope,
10
53
  H as HASH_CODE_MAX,
11
54
  O as OK,
12
55
  R as RAD2DEG,
13
56
  a3 as andThen,
14
- b2 as bug,
57
+ c2 as bug,
15
58
  c4 as castShape,
16
- a5 as closedWire,
17
- c2 as collect,
59
+ closedWire,
60
+ j2 as collect,
18
61
  d2 as computationError,
19
- b3 as createHandle,
20
- d3 as createKernelHandle,
21
- c3 as createNamedPlane,
22
- a4 as createPlane,
23
- e2 as err,
24
- f2 as flatMap,
25
- g3 as getShapeKind,
62
+ v3 as createHandle,
63
+ w2 as createKernelHandle,
64
+ a4 as createNamedPlane,
65
+ c3 as createPlane,
66
+ err,
67
+ l2 as flatMap,
68
+ a5 as getShapeKind,
26
69
  i2 as ioError,
27
- i3 as is2D,
28
- e3 as is3D,
29
- f3 as isClosedWire,
30
- h3 as isCompound,
31
- j3 as isEdge,
32
- g2 as isErr,
33
- k3 as isFace,
34
- l3 as isLive,
35
- m3 as isManifoldShell,
36
- h2 as isOk,
37
- n3 as isOrientedFace,
38
- o3 as isShape1D,
39
- p3 as isShape3D,
40
- q2 as isShell,
41
- r4 as isSolid,
42
- s2 as isValidSolid,
43
- t4 as isVertex,
44
- u2 as isWire,
70
+ B as is2D,
71
+ C as is3D,
72
+ isClosedWire,
73
+ E as isCompound,
74
+ i3 as isEdge,
75
+ b2 as isErr,
76
+ o2 as isFace,
77
+ F as isLive,
78
+ isManifoldShell,
79
+ f2 as isOk,
80
+ isOrientedFace,
81
+ G2 as isShape1D,
82
+ j3 as isShape3D,
83
+ d3 as isShell,
84
+ k3 as isSolid,
85
+ isValidSolid,
86
+ H3 as isVertex,
87
+ b4 as isWire,
45
88
  k2 as kernelError,
46
- v3 as manifoldShell,
47
- m2 as map,
48
- j2 as mapErr,
49
- l2 as match,
50
- n2 as moduleInitError,
51
- o2 as ok,
52
- w2 as orientedFace,
53
- p2 as pivotPlane,
89
+ manifoldShell,
90
+ p as map,
91
+ w as mapErr,
92
+ x as match,
93
+ y as moduleInitError,
94
+ ok,
95
+ orientedFace,
96
+ b3 as pivotPlane,
54
97
  q as queryError,
55
98
  r as resolveDirection,
56
- r3 as resolvePlane,
57
- s as sketcherStateError,
58
- t as toVec2,
59
- a as toVec3,
99
+ r2 as resolvePlane,
100
+ D2 as sketcherStateError,
101
+ a as toVec2,
102
+ t as toVec3,
60
103
  t3 as translatePlane,
61
- t2 as tryCatch,
62
- p as tryCatchAsync,
63
- r2 as typeCastError,
64
- u as unsupportedError,
65
- v2 as unwrap,
66
- w as unwrapErr,
67
- x as unwrapOr,
68
- y as unwrapOrElse,
69
- x2 as validSolid,
70
- z as validationError,
71
- v as vecAdd,
72
- a2 as vecAngle,
73
- b as vecCross,
74
- c as vecDistance,
104
+ G as tryCatch,
105
+ H2 as tryCatchAsync,
106
+ t2 as typeCastError,
107
+ I as unsupportedError,
108
+ u as unwrap,
109
+ J as unwrapErr,
110
+ K as unwrapOr,
111
+ L as unwrapOrElse,
112
+ validSolid,
113
+ v2 as validationError,
114
+ a2 as vecAdd,
115
+ j as vecAngle,
116
+ e as vecCross,
117
+ h as vecDistance,
75
118
  d as vecDot,
76
- e as vecEquals,
77
- f as vecIsZero,
78
- g as vecLength,
79
- h as vecLengthSq,
80
- i as vecNegate,
81
- j as vecNormalize,
82
- k as vecProjectToPlane,
83
- l as vecRepr,
84
- m as vecRotate,
85
- n as vecScale,
86
- o as vecSub,
87
- y2 as withScope,
88
- z2 as withScopeResult,
89
- A as withScopeResultAsync
119
+ k as vecEquals,
120
+ i as vecIsZero,
121
+ v as vecLength,
122
+ l as vecLengthSq,
123
+ m as vecNegate,
124
+ c as vecNormalize,
125
+ n as vecProjectToPlane,
126
+ o as vecRepr,
127
+ g as vecRotate,
128
+ b as vecScale,
129
+ f as vecSub,
130
+ L2 as withScope,
131
+ M as withScopeResult,
132
+ N as withScopeResultAsync
90
133
  };
@@ -1,5 +1,5 @@
1
- import { B as getKernel, c as castShape, j as isEdge, u as isWire } from "./shapeTypes-CpSaBLDv.js";
2
- import { e as err, r as typeCastError, o as ok } from "./result-BaSD1fqR.js";
1
+ import { g as getKernel, c as castShape, i as isEdge, b as isWire } from "./shapeTypes-CAEAyk8j.js";
2
+ import { e as err, t as typeCastError, o as ok } from "./result-DtuwWSUD.js";
3
3
  function getCurveType(shape) {
4
4
  return getKernel().curveType(shape.wrapped);
5
5
  }
@@ -97,18 +97,18 @@ function offsetWire2D(wire, offset, kind = "arc") {
97
97
  return ok(wrapped);
98
98
  }
99
99
  export {
100
- curveTangentAt as a,
101
- curveIsClosed as b,
102
- curveStartPoint as c,
103
- curvePointAt as d,
104
- curveEndPoint as e,
105
- curveLength as f,
106
- getOrientation as g,
107
- approximateCurve as h,
108
- curveIsPeriodic as i,
109
- curvePeriod as j,
110
- flipOrientation as k,
111
- getCurveType as l,
100
+ curveIsClosed as a,
101
+ getOrientation as b,
102
+ curveLength as c,
103
+ curveStartPoint as d,
104
+ curveTangentAt as e,
105
+ curvePointAt as f,
106
+ getCurveType as g,
107
+ curveEndPoint as h,
108
+ approximateCurve as i,
109
+ curveIsPeriodic as j,
110
+ curvePeriod as k,
111
+ flipOrientation as l,
112
112
  interpolateCurve as m,
113
113
  offsetWire2D as o
114
114
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
- const result = require("./result-fAX0OZzI.cjs");
2
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
3
+ const result = require("./result-DJAAj1yb.cjs");
4
4
  function getCurveType(shape) {
5
5
  return shapeTypes.getKernel().curveType(shape.wrapped);
6
6
  }
@@ -43,22 +43,22 @@ var __callDispose = (stack, error, hasError) => {
43
43
  };
44
44
  return next();
45
45
  };
46
- import { b as bug, v as unwrap, h as isOk, C as safeIndex, e as err, z as validationError, o as ok } from "./result-BaSD1fqR.js";
47
- import { r as resolvePlane, b as planeToWorld } from "./vectors-Bx8wkNui.js";
48
- import { a as toVec3 } from "./types-CWDdqcrq.js";
49
- import { j as vecNormalize, b as vecCross, o as vecSub, n as vecScale, m as vecRotate, D as DEG2RAD, g as vecLength } from "./vecOps-ZDdZWbwT.js";
50
- import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-y3E92F0u.js";
51
- import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-B8GnxjdY.js";
52
- import { o as offsetWire2D } from "./curveFns-mROFhiuG.js";
53
- import { b as assembleWire, d as addHolesInFace, m as makeFace, e as makeCircle, f as makeEllipse, c as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-nQdJ56fe.js";
54
- import { D as DisposalScope, G as createWire, I as createFace, B as getKernel, k as isFace, c as castShape } from "./shapeTypes-CpSaBLDv.js";
55
- import { c as curvesAsEdgesOnPlane, m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, d as approximateAsSvgCompatibleCurve, e as BoundingBox2d, f as edgeToCurve, g as make2dInerpolatedBSplineCurve, h as make2dCircle, i as make2dEllipse, j as deserializeCurve2D } from "./Blueprint-DbVaf6k7.js";
56
- import { s as samePoint$1, P as PRECISION_OFFSET, f as squareDistance2d, e as subtract2d, c as add2d } from "./helpers-X0juxnwj.js";
57
- import { d as getEdges } from "./shapeFns-FDuKkrDR.js";
58
- import { a as makeCompound, b as makeSolid } from "./solidBuilders-DmwhTCCd.js";
59
- import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-Bhw-FMoL.js";
46
+ import { c as bug, u as unwrap, f as isOk, s as safeIndex, e as err, v as validationError, o as ok } from "./result-DtuwWSUD.js";
47
+ import { r as resolvePlane, p as planeToWorld } from "./vectors-DTREgnVp.js";
48
+ import { t as toVec3 } from "./types-CcKqsmd0.js";
49
+ import { c as vecNormalize, e as vecCross, f as vecSub, b as vecScale, g as vecRotate, D as DEG2RAD, v as vecLength } from "./vecOps-LTN--A58.js";
50
+ import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-CR4efa35.js";
51
+ import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-DGMp47Os.js";
52
+ import { o as offsetWire2D } from "./curveFns-1u0oZ0u0.js";
53
+ import { D as DisposalScope, g as getKernel, l as createWire, n as createFace, o as isFace, c as castShape } from "./shapeTypes-CAEAyk8j.js";
54
+ import { a as assembleWire, d as addHolesInFace, c as makeFace, e as makeCircle, f as makeEllipse, b as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-Dj6AjhOv.js";
55
+ import { c as curvesAsEdgesOnPlane, B as Blueprint, C as Curve2D, m as make2dSegmentCurve, a as make2dArcFromCenter, b as approximateAsSvgCompatibleCurve, d as BoundingBox2d, e as edgeToCurve, f as make2dInerpolatedBSplineCurve, g as make2dCircle, h as make2dEllipse, i as deserializeCurve2D } from "./Blueprint-1HGbugaC.js";
56
+ import { s as samePoint$1, P as PRECISION_OFFSET, e as squareDistance2d, c as subtract2d, b as add2d } from "./helpers-sJjnIXDA.js";
57
+ import { a as makeCompound, b as makeSolid } from "./solidBuilders-BS-1220W.js";
58
+ import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-D0aCZRaB.js";
60
59
  import opentype from "opentype.js";
61
- import { c as cornerFinder } from "./cornerFinder-Ckz-mPHE.js";
60
+ import { d as getEdges } from "./topologyQueryFns-De439iBP.js";
61
+ import { cornerFinder } from "./query.js";
62
62
  const stitchCurves = (curves, precision = 1e-7) => {
63
63
  const startPoints = new Flatbush(curves.length);
64
64
  curves.forEach((c) => {
@@ -174,7 +174,7 @@ class Sketcher extends BaseSketcher2d {
174
174
  const startToEndVector = vecNormalize(diff);
175
175
  const normal = vecCross(startToEndVector, this.plane.zDir);
176
176
  const clonedWrapped = unwrap(downcast(wire.wrapped));
177
- const mirroredRaw = mirror(clonedWrapped, normal, pointer3d);
177
+ const mirroredRaw = getKernel().mirror(clonedWrapped, toVec3(pointer3d), toVec3(normal));
178
178
  const mirroredWrapped = unwrap(downcast(mirroredRaw));
179
179
  const mirroredWire = createWire(mirroredWrapped);
180
180
  const combinedWire = unwrap(assembleWire([wire, mirroredWire]));
@@ -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-DJAAj1yb.cjs");
48
+ const vectors = require("./vectors-C8N_QeEX.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-9OnbotKT.cjs");
52
+ const faceFns = require("./faceFns-BAKkZG6D.cjs");
53
+ const curveFns = require("./curveFns-BwLvO_Ia.cjs");
54
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
55
+ const surfaceBuilders = require("./surfaceBuilders-KU_7OD2q.cjs");
56
+ const Blueprint = require("./Blueprint-CUyXM6CV.cjs");
57
+ const helpers = require("./helpers-DVdscQxW.cjs");
58
+ const solidBuilders = require("./solidBuilders-BLQ4I6Ig.cjs");
59
+ const loft = require("./loft-BNvBZzqe.cjs");
61
60
  const opentype = require("opentype.js");
62
- const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
61
+ const topologyQueryFns = require("./topologyQueryFns-fz5kz5e1.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]));
@@ -925,7 +925,7 @@ function isProjectionPlane(plane) {
925
925
  }
926
926
  const getEdgesFromOc = (shape) => {
927
927
  if (shape.IsNull()) return [];
928
- return shapeFns.getEdges(shapeTypes.castShape(shape));
928
+ return topologyQueryFns.getEdges(shapeTypes.castShape(shape));
929
929
  };
930
930
  function makeProjectedEdges(shape, camera, withHiddenLines = true) {
931
931
  const projected = shapeTypes.getKernel().projectEdges(
@@ -1098,7 +1098,7 @@ class Drawing {
1098
1098
  * @category Drawing Modifications
1099
1099
  */
1100
1100
  fillet(radius, filter) {
1101
- const finder = filter && filter(cornerFinder.cornerFinder());
1101
+ const finder = filter && filter(query.cornerFinder());
1102
1102
  return new Drawing(fillet2D(this.innerShape, radius, finder));
1103
1103
  }
1104
1104
  /**
@@ -1108,7 +1108,7 @@ class Drawing {
1108
1108
  * @category Drawing Modifications
1109
1109
  */
1110
1110
  chamfer(radius, filter) {
1111
- const finder = filter && filter(cornerFinder.cornerFinder());
1111
+ const finder = filter && filter(query.cornerFinder());
1112
1112
  return new Drawing(chamfer2D(this.innerShape, radius, finder));
1113
1113
  }
1114
1114
  sketchOnPlane(inputPlane, origin) {
@@ -1303,7 +1303,7 @@ function drawFaceOutline(face) {
1303
1303
  const scope = __using(_stack, new shapeTypes.DisposalScope());
1304
1304
  const clonedFace = scope.register(shapeTypes.createFace(result.unwrap(faceFns.downcast(face.wrapped))));
1305
1305
  const faceOuterWire = scope.register(faceFns.outerWire(clonedFace));
1306
- const curves = shapeFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1306
+ const curves = topologyQueryFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
1307
1307
  const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
1308
1308
  if (stitchedCurves.length === 0) return new Drawing();
1309
1309
  if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
2
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
3
3
  const types = require("./types-CA_xrgDq.cjs");
4
- const result = require("./result-fAX0OZzI.cjs");
4
+ const result = require("./result-DJAAj1yb.cjs");
5
5
  const TOPO_ENUM = {
6
6
  compound: 0,
7
7
  solidCompound: 1,
@@ -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, j as isShape3D$1, b as isWire$1 } from "./shapeTypes-CAEAyk8j.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-DtuwWSUD.js";
4
4
  const TOPO_ENUM = {
5
5
  compound: 0,
6
6
  solidCompound: 1,
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
- const result = require("./result-fAX0OZzI.cjs");
2
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
3
+ const result = require("./result-DJAAj1yb.cjs");
4
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
5
- const faceFns = require("./faceFns-DB1Fc5gy.cjs");
6
- const measurement = require("./measurement-BoNTUBAp.cjs");
7
- const shapeFns = require("./shapeFns-C2SnNvdH.cjs");
5
+ const curveFns = require("./curveFns-BwLvO_Ia.cjs");
6
+ const faceFns = require("./faceFns-BAKkZG6D.cjs");
7
+ const measurement = require("./measurement-DZcaxo1A.cjs");
8
+ const shapeFns = require("./shapeFns-w9tWELHX.cjs");
8
9
  const PRECISION_INTERSECTION = 1e-9;
9
10
  const PRECISION_OFFSET = 1e-8;
10
11
  const PRECISION_POINT = 1e-6;
@@ -46,6 +47,10 @@ const rotate2d = (point, angle, center = [0, 0]) => {
46
47
  const ynew = px * sinA + py * cosA;
47
48
  return [xnew + cx, ynew + cy];
48
49
  };
50
+ function normalize2d([x, y]) {
51
+ const l = Math.sqrt(x * x + y * y);
52
+ return l < 1e-12 ? [0, 0] : [x / l, y / l];
53
+ }
49
54
  const polarToCartesian = (r, theta) => {
50
55
  const x = Math.cos(theta) * r;
51
56
  const y = Math.sin(theta) * r;
@@ -117,7 +122,16 @@ function createTypedFinder(topoKind, filters, rebuild, extend) {
117
122
  }
118
123
  return result.ok(match);
119
124
  },
120
- shouldKeep
125
+ shouldKeep,
126
+ and: (other) => withFilter((el) => other.shouldKeep(el)),
127
+ or: (other) => {
128
+ const selfKeep = shouldKeep;
129
+ return rebuild([(el) => selfKeep(el) || other.shouldKeep(el)]);
130
+ },
131
+ negate: () => {
132
+ const selfKeep = shouldKeep;
133
+ return rebuild([(el) => !selfKeep(el)]);
134
+ }
121
135
  };
122
136
  const extensions = extend(base, withFilter);
123
137
  return { ...base, ...extensions };
@@ -139,6 +153,35 @@ function distanceFromPointFilter(distance, point, tolerance) {
139
153
  return Math.abs(d - distance) < tolerance;
140
154
  };
141
155
  }
156
+ function edgeDirectionFilter(dir, angle) {
157
+ const d = vecOps.vecNormalize(resolveDir(dir));
158
+ return (edge) => {
159
+ const kernel = shapeTypes.getKernel();
160
+ const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
161
+ const midParam = (firstParam + lastParam) / 2;
162
+ const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
163
+ const tangent = vecOps.vecNormalize(rawTangent);
164
+ const ang = Math.acos(Math.min(1, Math.abs(vecOps.vecDot(tangent, d))));
165
+ return Math.abs(ang - vecOps.DEG2RAD * angle) < 1e-6;
166
+ };
167
+ }
168
+ function buildEdgeFinder(filters) {
169
+ return createTypedFinder(
170
+ "edge",
171
+ filters,
172
+ buildEdgeFinder,
173
+ (_base, withFilter) => ({
174
+ inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
175
+ ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveFns.curveLength(edge) - length) < tolerance),
176
+ ofCurveType: (curveType) => withFilter((edge) => curveFns.getCurveType(edge) === curveType),
177
+ parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
178
+ atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
179
+ })
180
+ );
181
+ }
182
+ function edgeFinder() {
183
+ return buildEdgeFinder([]);
184
+ }
142
185
  function faceDirectionFilter(dir, angle) {
143
186
  const d = vecOps.vecNormalize(resolveDir(dir));
144
187
  return (face) => {
@@ -164,6 +207,27 @@ function buildFaceFinder(filters) {
164
207
  function faceFinder() {
165
208
  return buildFaceFinder([]);
166
209
  }
210
+ function buildWireFinder(filters) {
211
+ return createTypedFinder(
212
+ "wire",
213
+ filters,
214
+ buildWireFinder,
215
+ (_base, withFilter) => ({
216
+ isClosed: () => withFilter((wire) => curveFns.curveIsClosed(wire)),
217
+ isOpen: () => withFilter((wire) => !curveFns.curveIsClosed(wire)),
218
+ ofEdgeCount: (count) => withFilter((wire) => {
219
+ let edgeCount = 0;
220
+ for (const _raw of faceFns.iterTopo(wire.wrapped, "edge")) {
221
+ edgeCount++;
222
+ }
223
+ return edgeCount === count;
224
+ })
225
+ })
226
+ );
227
+ }
228
+ function wireFinder() {
229
+ return buildWireFinder([]);
230
+ }
167
231
  function getSingleFace(f, shape) {
168
232
  if (typeof f === "object" && "_topoKind" in f) {
169
233
  return f.findUnique(shape);
@@ -180,14 +244,15 @@ exports.cartesianToPolar = cartesianToPolar;
180
244
  exports.createTypedFinder = createTypedFinder;
181
245
  exports.crossProduct2d = crossProduct2d;
182
246
  exports.distance2d = distance2d;
183
- exports.distanceFromPointFilter = distanceFromPointFilter;
247
+ exports.edgeFinder = edgeFinder;
184
248
  exports.faceFinder = faceFinder;
185
249
  exports.getSingleFace = getSingleFace;
250
+ exports.normalize2d = normalize2d;
186
251
  exports.polarAngle2d = polarAngle2d;
187
252
  exports.polarToCartesian = polarToCartesian;
188
- exports.resolveDir = resolveDir;
189
253
  exports.rotate2d = rotate2d;
190
254
  exports.samePoint = samePoint;
191
255
  exports.scalarMultiply2d = scalarMultiply2d;
192
256
  exports.squareDistance2d = squareDistance2d;
193
257
  exports.subtract2d = subtract2d;
258
+ exports.wireFinder = wireFinder;