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
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
3
+ const vecOps = require("./vecOps-CjRL1jau.cjs");
4
+ const topologyQueryFns = require("./topologyQueryFns-fz5kz5e1.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,mBAA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;;;;;;;;;;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"}
@@ -0,0 +1,32 @@
1
+ import { Vec3 } from '../core/types.js';
2
+ import { Edge, Face, Wire } from '../core/shapeTypes.js';
3
+ import { SurfaceType } from '../topology/faceFns.js';
4
+ import { CurveType } from '../core/definitionMaps.js';
5
+ import { ShapeFinder } from './finderCore.js';
6
+ import { DirectionInput } from './directionUtils.js';
7
+ export interface EdgeFinderFn extends ShapeFinder<Edge> {
8
+ readonly inDirection: (dir?: DirectionInput, angle?: number) => EdgeFinderFn;
9
+ readonly ofLength: (length: number, tolerance?: number) => EdgeFinderFn;
10
+ readonly ofCurveType: (curveType: CurveType) => EdgeFinderFn;
11
+ readonly parallelTo: (dir?: DirectionInput) => EdgeFinderFn;
12
+ readonly atDistance: (distance: number, point?: Vec3) => EdgeFinderFn;
13
+ }
14
+ /** Create an immutable edge finder. */
15
+ export declare function edgeFinder(): EdgeFinderFn;
16
+ export interface FaceFinderFn extends ShapeFinder<Face> {
17
+ readonly inDirection: (dir?: DirectionInput, angle?: number) => FaceFinderFn;
18
+ readonly parallelTo: (dir?: DirectionInput) => FaceFinderFn;
19
+ readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
20
+ readonly ofArea: (area: number, tolerance?: number) => FaceFinderFn;
21
+ readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
22
+ }
23
+ /** Create an immutable face finder. */
24
+ export declare function faceFinder(): FaceFinderFn;
25
+ export interface WireFinderFn extends ShapeFinder<Wire> {
26
+ readonly isClosed: () => WireFinderFn;
27
+ readonly isOpen: () => WireFinderFn;
28
+ readonly ofEdgeCount: (count: number) => WireFinderFn;
29
+ }
30
+ /** Create an immutable wire finder. */
31
+ export declare function wireFinder(): WireFinderFn;
32
+ //# sourceMappingURL=shapeFinders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shapeFinders.d.ts","sourceRoot":"","sources":["../../src/query/shapeFinders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK9D,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIpG,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;AAqCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,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;AAkCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACvD;AAwBD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
@@ -1,10 +1,5 @@
1
- import { Wire } from '../core/shapeTypes.js';
2
- import { ShapeFinder } from './finderCore.js';
3
- export interface WireFinderFn extends ShapeFinder<Wire> {
4
- readonly isClosed: () => WireFinderFn;
5
- readonly isOpen: () => WireFinderFn;
6
- readonly ofEdgeCount: (count: number) => WireFinderFn;
7
- }
8
- /** Create an immutable wire finder. */
9
- export declare function wireFinder(): WireFinderFn;
1
+ /**
2
+ * Re-exports from `./shapeFinders.js` for backward compatibility.
3
+ */
4
+ export { wireFinder, type WireFinderFn } from './shapeFinders.js';
10
5
  //# sourceMappingURL=wireFinder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AAMtF,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACvD;AA4BD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
1
+ {"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/query.cjs CHANGED
@@ -1,40 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const helpers = require("./helpers-C8NoT0Wu.cjs");
4
- const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
5
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
+ const helpers = require("./helpers-DVdscQxW.cjs");
6
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const curveFns = require("./curveFns-BZngcnQ1.cjs");
8
- function edgeDirectionFilter(dir, angle) {
9
- const d = vecOps.vecNormalize(helpers.resolveDir(dir));
10
- return (edge) => {
11
- const kernel = shapeTypes.getKernel();
12
- const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
13
- const midParam = (firstParam + lastParam) / 2;
14
- const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
15
- const tangent = vecOps.vecNormalize(rawTangent);
16
- const ang = Math.acos(Math.min(1, Math.abs(vecOps.vecDot(tangent, d))));
17
- return Math.abs(ang - vecOps.DEG2RAD * angle) < 1e-6;
18
- };
5
+ const PI_2 = 2 * Math.PI;
6
+ function positiveHalfAngle(angle) {
7
+ const limitedAngle = angle % PI_2;
8
+ const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
9
+ if (coterminalAngle < Math.PI) return coterminalAngle;
10
+ if (coterminalAngle === Math.PI) return 0;
11
+ return Math.abs(coterminalAngle - PI_2);
12
+ }
13
+ function blueprintCorners(blueprint) {
14
+ return blueprint.curves.map((curve, index) => ({
15
+ firstCurve: curve,
16
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
17
+ secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
18
+ point: curve.lastPoint
19
+ }));
19
20
  }
20
- function buildEdgeFinder(filters) {
21
- return helpers.createTypedFinder(
22
- "edge",
23
- filters,
24
- buildEdgeFinder,
25
- (_base, withFilter) => ({
26
- inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
27
- ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveFns.curveLength(edge) - length) < tolerance),
28
- ofCurveType: (curveType) => withFilter((edge) => curveFns.getCurveType(edge) === curveType),
29
- parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
30
- atDistance: (distance, point = [0, 0, 0]) => withFilter(helpers.distanceFromPointFilter(distance, point, 1e-6))
31
- })
32
- );
21
+ function buildCornerFinder(filters) {
22
+ const withFilter = (pred) => buildCornerFinder([...filters, pred]);
23
+ const shouldKeep = (corner) => filters.every((f) => f(corner));
24
+ return {
25
+ shouldKeep,
26
+ when: (pred) => withFilter(pred),
27
+ inList: (points) => withFilter((corner) => points.some((p) => helpers.samePoint(p, corner.point))),
28
+ atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(helpers.distance2d(point, corner.point) - distance) < 1e-9),
29
+ atPoint: (point) => withFilter((corner) => helpers.samePoint(point, corner.point)),
30
+ inBox: (corner1, corner2) => {
31
+ const minX = Math.min(corner1[0], corner2[0]);
32
+ const maxX = Math.max(corner1[0], corner2[0]);
33
+ const minY = Math.min(corner1[1], corner2[1]);
34
+ const maxY = Math.max(corner1[1], corner2[1]);
35
+ return withFilter((corner) => {
36
+ const [x, y] = corner.point;
37
+ return x >= minX && x <= maxX && y >= minY && y <= maxY;
38
+ });
39
+ },
40
+ ofAngle: (angle) => withFilter((corner) => {
41
+ const tgt1 = corner.firstCurve.tangentAt(1);
42
+ const tgt2 = corner.secondCurve.tangentAt(0);
43
+ return Math.abs(positiveHalfAngle(helpers.angle2d(tgt1, tgt2)) - positiveHalfAngle(vecOps.DEG2RAD * angle)) < 1e-9;
44
+ }),
45
+ not: (fn) => {
46
+ const inner = fn(buildCornerFinder([]));
47
+ return withFilter((corner) => !inner.shouldKeep(corner));
48
+ },
49
+ either: (fns) => {
50
+ const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
51
+ return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
52
+ },
53
+ find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
54
+ };
33
55
  }
34
- function edgeFinder() {
35
- return buildEdgeFinder([]);
56
+ function cornerFinder() {
57
+ return buildCornerFinder([]);
36
58
  }
59
+ exports.edgeFinder = helpers.edgeFinder;
37
60
  exports.faceFinder = helpers.faceFinder;
38
61
  exports.getSingleFace = helpers.getSingleFace;
39
- exports.cornerFinder = cornerFinder.cornerFinder;
40
- exports.edgeFinder = edgeFinder;
62
+ exports.cornerFinder = cornerFinder;
package/dist/query.js CHANGED
@@ -1,41 +1,63 @@
1
- import { l as createTypedFinder, n as distanceFromPointFilter, o as resolveDir } from "./helpers-X0juxnwj.js";
2
- import { m, g } from "./helpers-X0juxnwj.js";
3
- import { c } from "./cornerFinder-Ckz-mPHE.js";
4
- import { B as getKernel } from "./shapeTypes-CpSaBLDv.js";
5
- import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
6
- import { l as getCurveType, f as curveLength } from "./curveFns-mROFhiuG.js";
7
- function edgeDirectionFilter(dir, angle) {
8
- const d = vecNormalize(resolveDir(dir));
9
- return (edge) => {
10
- const kernel = getKernel();
11
- const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
12
- const midParam = (firstParam + lastParam) / 2;
13
- const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
14
- const tangent = vecNormalize(rawTangent);
15
- const ang = Math.acos(Math.min(1, Math.abs(vecDot(tangent, d))));
16
- return Math.abs(ang - DEG2RAD * angle) < 1e-6;
17
- };
1
+ import { o as angle2d, s as samePoint, d as distance2d } from "./helpers-sJjnIXDA.js";
2
+ import { l, m, g } from "./helpers-sJjnIXDA.js";
3
+ import { D as DEG2RAD } from "./vecOps-LTN--A58.js";
4
+ const PI_2 = 2 * Math.PI;
5
+ function positiveHalfAngle(angle) {
6
+ const limitedAngle = angle % PI_2;
7
+ const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
8
+ if (coterminalAngle < Math.PI) return coterminalAngle;
9
+ if (coterminalAngle === Math.PI) return 0;
10
+ return Math.abs(coterminalAngle - PI_2);
11
+ }
12
+ function blueprintCorners(blueprint) {
13
+ return blueprint.curves.map((curve, index) => ({
14
+ firstCurve: curve,
15
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
16
+ secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
17
+ point: curve.lastPoint
18
+ }));
18
19
  }
19
- function buildEdgeFinder(filters) {
20
- return createTypedFinder(
21
- "edge",
22
- filters,
23
- buildEdgeFinder,
24
- (_base, withFilter) => ({
25
- inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
26
- ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveLength(edge) - length) < tolerance),
27
- ofCurveType: (curveType) => withFilter((edge) => getCurveType(edge) === curveType),
28
- parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
29
- atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
30
- })
31
- );
20
+ function buildCornerFinder(filters) {
21
+ const withFilter = (pred) => buildCornerFinder([...filters, pred]);
22
+ const shouldKeep = (corner) => filters.every((f) => f(corner));
23
+ return {
24
+ shouldKeep,
25
+ when: (pred) => withFilter(pred),
26
+ inList: (points) => withFilter((corner) => points.some((p) => samePoint(p, corner.point))),
27
+ atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(distance2d(point, corner.point) - distance) < 1e-9),
28
+ atPoint: (point) => withFilter((corner) => samePoint(point, corner.point)),
29
+ inBox: (corner1, corner2) => {
30
+ const minX = Math.min(corner1[0], corner2[0]);
31
+ const maxX = Math.max(corner1[0], corner2[0]);
32
+ const minY = Math.min(corner1[1], corner2[1]);
33
+ const maxY = Math.max(corner1[1], corner2[1]);
34
+ return withFilter((corner) => {
35
+ const [x, y] = corner.point;
36
+ return x >= minX && x <= maxX && y >= minY && y <= maxY;
37
+ });
38
+ },
39
+ ofAngle: (angle) => withFilter((corner) => {
40
+ const tgt1 = corner.firstCurve.tangentAt(1);
41
+ const tgt2 = corner.secondCurve.tangentAt(0);
42
+ return Math.abs(positiveHalfAngle(angle2d(tgt1, tgt2)) - positiveHalfAngle(DEG2RAD * angle)) < 1e-9;
43
+ }),
44
+ not: (fn) => {
45
+ const inner = fn(buildCornerFinder([]));
46
+ return withFilter((corner) => !inner.shouldKeep(corner));
47
+ },
48
+ either: (fns) => {
49
+ const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
50
+ return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
51
+ },
52
+ find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
53
+ };
32
54
  }
33
- function edgeFinder() {
34
- return buildEdgeFinder([]);
55
+ function cornerFinder() {
56
+ return buildCornerFinder([]);
35
57
  }
36
58
  export {
37
- c as cornerFinder,
38
- edgeFinder,
59
+ cornerFinder,
60
+ l as edgeFinder,
39
61
  m as faceFinder,
40
62
  g as getSingleFace
41
63
  };
@@ -47,6 +47,12 @@ function tapErr(result, fn) {
47
47
  if (!result.ok) fn(result.error);
48
48
  return result;
49
49
  }
50
+ function flatten(result) {
51
+ return result.ok ? result.value : result;
52
+ }
53
+ function mapBoth(result, okFn, errFn) {
54
+ return result.ok ? ok(okFn(result.value)) : err(errFn(result.error));
55
+ }
50
56
  function fromNullable(value, errorFn) {
51
57
  if (value === null || value === void 0) return err(errorFn());
52
58
  return ok(value);
@@ -274,64 +280,6 @@ function queryError(code, message, cause, metadata, suggestion) {
274
280
  function unsupportedError(code, message, cause, metadata, suggestion) {
275
281
  return makeError("UNSUPPORTED", code, message, cause, metadata, suggestion);
276
282
  }
277
- const kernel_ERROR_PATTERNS = [
278
- {
279
- pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
280
- translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
281
- },
282
- {
283
- pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
284
- translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
285
- },
286
- {
287
- pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
288
- translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
289
- },
290
- {
291
- pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
292
- translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
293
- },
294
- {
295
- pattern: /shell.*failed|offset.*failed/i,
296
- translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
297
- },
298
- {
299
- pattern: /sweep.*failed|pipe.*failed/i,
300
- translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
301
- },
302
- {
303
- pattern: /loft.*failed/i,
304
- translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
305
- },
306
- {
307
- pattern: /extrude.*failed|prism.*failed/i,
308
- translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
309
- },
310
- {
311
- pattern: /revolve.*failed|revolution.*failed/i,
312
- translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
313
- },
314
- {
315
- pattern: /self.*intersect|self-intersect/i,
316
- translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
317
- },
318
- {
319
- pattern: /degener|degenerat/i,
320
- translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
321
- },
322
- {
323
- pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
324
- translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
325
- }
326
- ];
327
- function translateKernelError(kernelMessage) {
328
- for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
329
- if (pattern.test(kernelMessage)) {
330
- return `${translation} (kernel: ${kernelMessage})`;
331
- }
332
- }
333
- return kernelMessage;
334
- }
335
283
  function safeIndex(arr, index, context) {
336
284
  if (index < 0 || index >= arr.length) {
337
285
  bug(context ?? "safeIndex", `Index ${index} is out of bounds (array length ${arr.length})`);
@@ -348,12 +296,14 @@ exports.collect = collect;
348
296
  exports.computationError = computationError;
349
297
  exports.err = err;
350
298
  exports.flatMap = flatMap;
299
+ exports.flatten = flatten;
351
300
  exports.fromNullable = fromNullable;
352
301
  exports.ioError = ioError;
353
302
  exports.isErr = isErr;
354
303
  exports.isOk = isOk;
355
304
  exports.kernelError = kernelError;
356
305
  exports.map = map;
306
+ exports.mapBoth = mapBoth;
357
307
  exports.mapErr = mapErr;
358
308
  exports.match = match;
359
309
  exports.moduleInitError = moduleInitError;
@@ -366,7 +316,6 @@ exports.safeIndex = safeIndex;
366
316
  exports.sketcherStateError = sketcherStateError;
367
317
  exports.tap = tap;
368
318
  exports.tapErr = tapErr;
369
- exports.translateKernelError = translateKernelError;
370
319
  exports.tryCatch = tryCatch;
371
320
  exports.tryCatchAsync = tryCatchAsync;
372
321
  exports.typeCastError = typeCastError;