brepjs 8.0.1 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/2d/blueprints/booleanHelpers.d.ts +32 -0
  2. package/dist/2d/blueprints/booleanHelpers.d.ts.map +1 -0
  3. package/dist/2d/blueprints/booleanOperations.d.ts +5 -3
  4. package/dist/2d/blueprints/booleanOperations.d.ts.map +1 -1
  5. package/dist/2d/blueprints/intersectionSegments.d.ts +12 -0
  6. package/dist/2d/blueprints/intersectionSegments.d.ts.map +1 -0
  7. package/dist/2d/blueprints/segmentAssembly.d.ts +31 -0
  8. package/dist/2d/blueprints/segmentAssembly.d.ts.map +1 -0
  9. package/dist/2d.cjs +2 -2
  10. package/dist/2d.js +8 -8
  11. package/dist/{Blueprint-D3JfGJTz.js → Blueprint-DnAO3gr5.js} +116 -30
  12. package/dist/{Blueprint-CVctc41Z.cjs → Blueprint-FxmMji4s.cjs} +110 -24
  13. package/dist/{boolean2D-hOw5Qay5.js → boolean2D-BnZKKBWU.js} +391 -310
  14. package/dist/{boolean2D-BdZATaHs.cjs → boolean2D-BrjHZfWn.cjs} +426 -345
  15. package/dist/{booleanFns-CqehfzcK.js → booleanFns-Ct3wDnhc.js} +14 -18
  16. package/dist/{booleanFns-BBSVKhL2.cjs → booleanFns-ND7sZvhu.cjs} +12 -16
  17. package/dist/brepjs.cjs +171 -101
  18. package/dist/brepjs.js +315 -244
  19. package/dist/{cast-DQaUibmm.js → cast-BEg1mN7n.js} +2 -2
  20. package/dist/{cast-DkB0GKmQ.cjs → cast-CqDc8oFW.cjs} +2 -2
  21. package/dist/core/disposal.d.ts +1 -1
  22. package/dist/core/disposal.d.ts.map +1 -1
  23. package/dist/core.cjs +3 -3
  24. package/dist/core.js +3 -3
  25. package/dist/cornerFinder-89obDwGi.js +59 -0
  26. package/dist/cornerFinder-BKsCkrXd.cjs +58 -0
  27. package/dist/curveBuilders-BjtdNw1B.cjs +196 -0
  28. package/dist/curveBuilders-U26XDfxg.js +197 -0
  29. package/dist/curveFns-BoG_iA07.cjs +375 -0
  30. package/dist/curveFns-Cg99XKe2.js +376 -0
  31. package/dist/{drawFns-CUyx50gi.cjs → drawFns-C-MCkYj6.cjs} +60 -62
  32. package/dist/{drawFns-921SkhDL.js → drawFns-DJV-nOox.js} +12 -14
  33. package/dist/{faceFns-DHu-2JpA.js → faceFns-CyokaCDr.js} +3 -3
  34. package/dist/{faceFns-BwK7FP7N.cjs → faceFns-DcSCjDG0.cjs} +3 -3
  35. package/dist/helpers--iZxPeJg.cjs +203 -0
  36. package/dist/helpers-CRx_ks-u.js +204 -0
  37. package/dist/io.cjs +4 -4
  38. package/dist/io.js +4 -4
  39. package/dist/kernel/curveOps.d.ts.map +1 -1
  40. package/dist/kernel/meshOps.d.ts.map +1 -1
  41. package/dist/kernel/modifierOps.d.ts.map +1 -1
  42. package/dist/kernel/occtAdapter.d.ts +1 -0
  43. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  44. package/dist/kernel/sweepOps.d.ts +8 -0
  45. package/dist/kernel/sweepOps.d.ts.map +1 -1
  46. package/dist/kernel/types.d.ts +1 -0
  47. package/dist/kernel/types.d.ts.map +1 -1
  48. package/dist/loft-8asn63t4.cjs +372 -0
  49. package/dist/loft-jIkZRqHm.js +373 -0
  50. package/dist/{measurement-C5JGCuUP.js → measurement-DWv8kK6J.js} +3 -3
  51. package/dist/{measurement-fxm_pW7x.cjs → measurement-lRLwaoqD.cjs} +3 -3
  52. package/dist/measurement.cjs +1 -1
  53. package/dist/measurement.js +1 -1
  54. package/dist/{meshFns-BhrZGi6w.cjs → meshFns-DWuLC3fk.cjs} +29 -9
  55. package/dist/{meshFns-AqAjTTVl.js → meshFns-DgAIL1B-.js} +29 -9
  56. package/dist/{occtBoundary-du8_ex-p.cjs → occtBoundary-DHtzU4tz.cjs} +93 -61
  57. package/dist/{occtBoundary-CwegMzqc.js → occtBoundary-DYsksDtE.js} +98 -66
  58. package/dist/operations/extrude.d.ts.map +1 -1
  59. package/dist/operations/extrudeFns.d.ts.map +1 -1
  60. package/dist/operations/extrudeUtils.d.ts +17 -0
  61. package/dist/operations/extrudeUtils.d.ts.map +1 -1
  62. package/dist/operations/patternFns.d.ts.map +1 -1
  63. package/dist/{operations-C1rWoba2.js → operations-B8FHVC22.js} +54 -9
  64. package/dist/{operations-BP1wVDw0.cjs → operations-CCFPvtd-.cjs} +54 -9
  65. package/dist/operations.cjs +2 -2
  66. package/dist/operations.js +4 -4
  67. package/dist/query/cornerFinder.d.ts +48 -0
  68. package/dist/query/cornerFinder.d.ts.map +1 -0
  69. package/dist/query/directionUtils.d.ts +6 -0
  70. package/dist/query/directionUtils.d.ts.map +1 -0
  71. package/dist/query/edgeFinder.d.ts +15 -0
  72. package/dist/query/edgeFinder.d.ts.map +1 -0
  73. package/dist/query/faceFinder.d.ts +15 -0
  74. package/dist/query/faceFinder.d.ts.map +1 -0
  75. package/dist/query/finderCore.d.ts +35 -0
  76. package/dist/query/finderCore.d.ts.map +1 -0
  77. package/dist/query/finderFns.d.ts +21 -106
  78. package/dist/query/finderFns.d.ts.map +1 -1
  79. package/dist/query/shapeDistanceFilter.d.ts +11 -0
  80. package/dist/query/shapeDistanceFilter.d.ts.map +1 -0
  81. package/dist/query/vertexFinder.d.ts +16 -0
  82. package/dist/query/vertexFinder.d.ts.map +1 -0
  83. package/dist/query/wireFinder.d.ts +10 -0
  84. package/dist/query/wireFinder.d.ts.map +1 -0
  85. package/dist/query.cjs +42 -5
  86. package/dist/query.js +40 -2
  87. package/dist/{shapeTypes-DKhwEnUM.cjs → shapeTypes-b_lhwQB7.cjs} +24 -20
  88. package/dist/{shapeTypes-BlSElW8z.js → shapeTypes-i7VwMRwc.js} +32 -28
  89. package/dist/sketching/Sketcher.d.ts.map +1 -1
  90. package/dist/sketching/Sketcher2d.d.ts +12 -4
  91. package/dist/sketching/Sketcher2d.d.ts.map +1 -1
  92. package/dist/sketching/ellipseUtils.d.ts +29 -0
  93. package/dist/sketching/ellipseUtils.d.ts.map +1 -0
  94. package/dist/sketching.cjs +2 -2
  95. package/dist/sketching.js +2 -2
  96. package/dist/topology/booleanFns.d.ts.map +1 -1
  97. package/dist/topology/curveBuilders.d.ts +75 -0
  98. package/dist/topology/curveBuilders.d.ts.map +1 -0
  99. package/dist/topology/curveFns.d.ts.map +1 -1
  100. package/dist/topology/meshFns.d.ts.map +1 -1
  101. package/dist/topology/primitiveFns.d.ts.map +1 -1
  102. package/dist/topology/shapeFns.d.ts.map +1 -1
  103. package/dist/topology/shapeHelpers.d.ts +6 -173
  104. package/dist/topology/shapeHelpers.d.ts.map +1 -1
  105. package/dist/topology/shapeUtils.d.ts +13 -0
  106. package/dist/topology/shapeUtils.d.ts.map +1 -0
  107. package/dist/topology/solidBuilders.d.ts +70 -0
  108. package/dist/topology/solidBuilders.d.ts.map +1 -0
  109. package/dist/topology/surfaceBuilders.d.ts +35 -0
  110. package/dist/topology/surfaceBuilders.d.ts.map +1 -0
  111. package/dist/topology/wrapperFns.d.ts +1 -0
  112. package/dist/topology/wrapperFns.d.ts.map +1 -1
  113. package/dist/{topology-tFzqSrGH.js → topology-Bh-aPIxA.js} +7 -8
  114. package/dist/{topology-CIooytHH.cjs → topology-ByOn_z3E.cjs} +12 -13
  115. package/dist/topology.cjs +33 -34
  116. package/dist/topology.js +54 -55
  117. package/dist/{vectors-CBuaMeZv.js → vectors-DWLjb9-P.js} +1 -1
  118. package/dist/{vectors-ChWEZPwy.cjs → vectors-aQBZK0Sb.cjs} +1 -1
  119. package/dist/vectors.cjs +2 -2
  120. package/dist/vectors.js +2 -2
  121. package/package.json +1 -1
  122. package/dist/curveFns-BilyYL_s.cjs +0 -190
  123. package/dist/curveFns-CdVE4da7.js +0 -191
  124. package/dist/loft-BzWFokmC.cjs +0 -178
  125. package/dist/loft-CtG5nMq5.js +0 -179
  126. package/dist/query-V6nV-VfL.js +0 -396
  127. package/dist/query-hMSmOWJP.cjs +0 -395
  128. package/dist/shapeFns-BrF97sKt.js +0 -204
  129. package/dist/shapeFns-BvOndshS.cjs +0 -203
  130. package/dist/shapeHelpers-B2SXz1p4.cjs +0 -488
  131. package/dist/shapeHelpers-BcoZf2N9.js +0 -489
@@ -0,0 +1,376 @@
1
+ import { g as getKernel, c as toOcVec, m as makeOcAx2, e as makeOcAx1, b as toOcPnt } from "./occtBoundary-DYsksDtE.js";
2
+ import { c as castShape, g as getShapeKind, p as gcWithScope, d as isEdge, m as isWire } from "./shapeTypes-i7VwMRwc.js";
3
+ import { H as HASH_CODE_MAX, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
4
+ import { i as iterTopo, d as downcast } from "./cast-BEg1mN7n.js";
5
+ import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-wGhcJMpB.js";
6
+ let CURVE_TYPES_MAP = null;
7
+ const getCurveTypesMap = (refresh) => {
8
+ if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
9
+ const oc = getKernel().oc;
10
+ const ga = oc.GeomAbs_CurveType;
11
+ CURVE_TYPES_MAP = /* @__PURE__ */ new Map([
12
+ [ga.GeomAbs_Line, "LINE"],
13
+ [ga.GeomAbs_Circle, "CIRCLE"],
14
+ [ga.GeomAbs_Ellipse, "ELLIPSE"],
15
+ [ga.GeomAbs_Hyperbola, "HYPERBOLA"],
16
+ [ga.GeomAbs_Parabola, "PARABOLA"],
17
+ [ga.GeomAbs_BezierCurve, "BEZIER_CURVE"],
18
+ [ga.GeomAbs_BSplineCurve, "BSPLINE_CURVE"],
19
+ [ga.GeomAbs_OffsetCurve, "OFFSET_CURVE"],
20
+ [ga.GeomAbs_OtherCurve, "OTHER_CURVE"]
21
+ ]);
22
+ return CURVE_TYPES_MAP;
23
+ };
24
+ const findCurveType = (type) => {
25
+ let shapeType = getCurveTypesMap().get(type);
26
+ if (!shapeType) shapeType = getCurveTypesMap(true).get(type);
27
+ if (!shapeType) return err(typeCastError("UNKNOWN_CURVE_TYPE", "Unknown curve type"));
28
+ return ok(shapeType);
29
+ };
30
+ function clone(shape) {
31
+ return castShape(unwrap(downcast(shape.wrapped)));
32
+ }
33
+ function toBREP(shape) {
34
+ const oc = getKernel().oc;
35
+ return oc.BRepToolsWrapper.Write(shape.wrapped);
36
+ }
37
+ function getHashCode(shape) {
38
+ return shape.wrapped.HashCode(HASH_CODE_MAX);
39
+ }
40
+ function isEmpty(shape) {
41
+ return shape.wrapped.IsNull();
42
+ }
43
+ function isSameShape(a, b) {
44
+ return a.wrapped.IsSame(b.wrapped);
45
+ }
46
+ function isEqualShape(a, b) {
47
+ return a.wrapped.IsEqual(b.wrapped);
48
+ }
49
+ function simplify(shape) {
50
+ const oc = getKernel().oc;
51
+ const r = gcWithScope();
52
+ const upgrader = r(new oc.ShapeUpgrade_UnifySameDomain_2(shape.wrapped, true, true, false));
53
+ upgrader.Build();
54
+ return castShape(upgrader.Shape());
55
+ }
56
+ function translate(shape, v) {
57
+ const oc = getKernel().oc;
58
+ const trsf = new oc.gp_Trsf_1();
59
+ const vec = toOcVec(v);
60
+ trsf.SetTranslation_1(vec);
61
+ const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
62
+ const result = castShape(transformer.Shape());
63
+ transformer.delete();
64
+ trsf.delete();
65
+ vec.delete();
66
+ return result;
67
+ }
68
+ function rotate(shape, angle, position = [0, 0, 0], direction = [0, 0, 1]) {
69
+ const oc = getKernel().oc;
70
+ const trsf = new oc.gp_Trsf_1();
71
+ const ax1 = makeOcAx1(position, direction);
72
+ trsf.SetRotation_1(ax1, angle * DEG2RAD);
73
+ const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
74
+ const result = castShape(transformer.Shape());
75
+ transformer.delete();
76
+ trsf.delete();
77
+ ax1.delete();
78
+ return result;
79
+ }
80
+ function mirror(shape, planeNormal = [0, 1, 0], planeOrigin = [0, 0, 0]) {
81
+ const oc = getKernel().oc;
82
+ const trsf = new oc.gp_Trsf_1();
83
+ const ax2 = makeOcAx2(planeOrigin, planeNormal);
84
+ trsf.SetMirror_3(ax2);
85
+ const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
86
+ const result = castShape(transformer.Shape());
87
+ transformer.delete();
88
+ trsf.delete();
89
+ ax2.delete();
90
+ return result;
91
+ }
92
+ function scale(shape, factor, center = [0, 0, 0]) {
93
+ const oc = getKernel().oc;
94
+ const trsf = new oc.gp_Trsf_1();
95
+ const pnt = toOcPnt(center);
96
+ trsf.SetScale(pnt, factor);
97
+ const transformer = new oc.BRepBuilderAPI_Transform_2(shape.wrapped, trsf, true);
98
+ const result = castShape(transformer.Shape());
99
+ transformer.delete();
100
+ trsf.delete();
101
+ pnt.delete();
102
+ return result;
103
+ }
104
+ const topoCache = /* @__PURE__ */ new WeakMap();
105
+ function getOrCreateCache(shape) {
106
+ let entry = topoCache.get(shape.wrapped);
107
+ if (!entry) {
108
+ entry = {};
109
+ topoCache.set(shape.wrapped, entry);
110
+ }
111
+ return entry;
112
+ }
113
+ function getEdges(shape) {
114
+ const cache = getOrCreateCache(shape);
115
+ if (cache.edges) return cache.edges;
116
+ const edges = Array.from(iterTopo(shape.wrapped, "edge")).map(
117
+ (e) => castShape(unwrap(downcast(e)))
118
+ );
119
+ cache.edges = edges;
120
+ return edges;
121
+ }
122
+ function getFaces(shape) {
123
+ const cache = getOrCreateCache(shape);
124
+ if (cache.faces) return cache.faces;
125
+ const faces = Array.from(iterTopo(shape.wrapped, "face")).map(
126
+ (e) => castShape(unwrap(downcast(e)))
127
+ );
128
+ cache.faces = faces;
129
+ return faces;
130
+ }
131
+ function getWires(shape) {
132
+ const cache = getOrCreateCache(shape);
133
+ if (cache.wires) return cache.wires;
134
+ const wires = Array.from(iterTopo(shape.wrapped, "wire")).map(
135
+ (e) => castShape(unwrap(downcast(e)))
136
+ );
137
+ cache.wires = wires;
138
+ return wires;
139
+ }
140
+ function getVertices(shape) {
141
+ return Array.from(iterTopo(shape.wrapped, "vertex")).map(
142
+ (e) => castShape(unwrap(downcast(e)))
143
+ );
144
+ }
145
+ function* iterEdges(shape) {
146
+ for (const e of iterTopo(shape.wrapped, "edge")) {
147
+ yield castShape(unwrap(downcast(e)));
148
+ }
149
+ }
150
+ function* iterFaces(shape) {
151
+ for (const f of iterTopo(shape.wrapped, "face")) {
152
+ yield castShape(unwrap(downcast(f)));
153
+ }
154
+ }
155
+ function* iterWires(shape) {
156
+ for (const w of iterTopo(shape.wrapped, "wire")) {
157
+ yield castShape(unwrap(downcast(w)));
158
+ }
159
+ }
160
+ function* iterVertices(shape) {
161
+ for (const v of iterTopo(shape.wrapped, "vertex")) {
162
+ yield castShape(unwrap(downcast(v)));
163
+ }
164
+ }
165
+ function getBounds(shape) {
166
+ const oc = getKernel().oc;
167
+ const bbox = new oc.Bnd_Box_1();
168
+ oc.BRepBndLib.Add(shape.wrapped, bbox, true);
169
+ const xMin = { current: 0 };
170
+ const yMin = { current: 0 };
171
+ const zMin = { current: 0 };
172
+ const xMax = { current: 0 };
173
+ const yMax = { current: 0 };
174
+ const zMax = { current: 0 };
175
+ bbox.Get(xMin, yMin, zMin, xMax, yMax, zMax);
176
+ bbox.delete();
177
+ return {
178
+ xMin: xMin.current,
179
+ xMax: xMax.current,
180
+ yMin: yMin.current,
181
+ yMax: yMax.current,
182
+ zMin: zMin.current,
183
+ zMax: zMax.current
184
+ };
185
+ }
186
+ function describe(shape) {
187
+ return {
188
+ kind: getShapeKind(shape),
189
+ faceCount: getFaces(shape).length,
190
+ edgeCount: getEdges(shape).length,
191
+ wireCount: getWires(shape).length,
192
+ vertexCount: getVertices(shape).length,
193
+ valid: getKernel().isValid(shape.wrapped),
194
+ bounds: getBounds(shape)
195
+ };
196
+ }
197
+ function vertexPosition(vertex) {
198
+ const oc = getKernel().oc;
199
+ const pnt = oc.BRep_Tool.Pnt(vertex.wrapped);
200
+ const result = [pnt.X(), pnt.Y(), pnt.Z()];
201
+ pnt.delete();
202
+ return result;
203
+ }
204
+ function getAdaptor(shape) {
205
+ const oc = getKernel().oc;
206
+ const st = shape.wrapped.ShapeType();
207
+ const e = oc.TopAbs_ShapeEnum;
208
+ if (st === e.TopAbs_WIRE) {
209
+ return new oc.BRepAdaptor_CompCurve_2(shape.wrapped, false);
210
+ }
211
+ return new oc.BRepAdaptor_Curve_2(shape.wrapped);
212
+ }
213
+ function mapParam(adaptor, t) {
214
+ const first = Number(adaptor.FirstParameter());
215
+ const last = Number(adaptor.LastParameter());
216
+ return first + (last - first) * t;
217
+ }
218
+ function getCurveType(shape) {
219
+ const r = gcWithScope();
220
+ const adaptor = r(getAdaptor(shape));
221
+ const technicalType = adaptor.GetType && adaptor.GetType();
222
+ return unwrap(findCurveType(technicalType));
223
+ }
224
+ function curveStartPoint(shape) {
225
+ const r = gcWithScope();
226
+ const adaptor = r(getAdaptor(shape));
227
+ const pnt = r(adaptor.Value(adaptor.FirstParameter()));
228
+ return [pnt.X(), pnt.Y(), pnt.Z()];
229
+ }
230
+ function curveEndPoint(shape) {
231
+ const r = gcWithScope();
232
+ const adaptor = r(getAdaptor(shape));
233
+ const pnt = r(adaptor.Value(adaptor.LastParameter()));
234
+ return [pnt.X(), pnt.Y(), pnt.Z()];
235
+ }
236
+ function curvePointAt(shape, position = 0.5) {
237
+ const r = gcWithScope();
238
+ const adaptor = r(getAdaptor(shape));
239
+ const pnt = r(adaptor.Value(mapParam(adaptor, position)));
240
+ return [pnt.X(), pnt.Y(), pnt.Z()];
241
+ }
242
+ function curveTangentAt(shape, position = 0.5) {
243
+ const oc = getKernel().oc;
244
+ const r = gcWithScope();
245
+ const adaptor = r(getAdaptor(shape));
246
+ const param = mapParam(adaptor, position);
247
+ const tmpPnt = r(new oc.gp_Pnt_1());
248
+ const tmpVec = r(new oc.gp_Vec_1());
249
+ adaptor.D1(param, tmpPnt, tmpVec);
250
+ return [tmpVec.X(), tmpVec.Y(), tmpVec.Z()];
251
+ }
252
+ function curveLength(shape) {
253
+ const oc = getKernel().oc;
254
+ const r = gcWithScope();
255
+ const props = r(new oc.GProp_GProps_1());
256
+ oc.BRepGProp.LinearProperties(shape.wrapped, props, true, false);
257
+ return props.Mass();
258
+ }
259
+ function curveIsClosed(shape) {
260
+ const r = gcWithScope();
261
+ const adaptor = r(getAdaptor(shape));
262
+ return adaptor.IsClosed();
263
+ }
264
+ function curveIsPeriodic(shape) {
265
+ const r = gcWithScope();
266
+ const adaptor = r(getAdaptor(shape));
267
+ return adaptor.IsPeriodic();
268
+ }
269
+ function curvePeriod(shape) {
270
+ const adaptor = getAdaptor(shape);
271
+ const result = adaptor.Period();
272
+ adaptor.delete();
273
+ return result;
274
+ }
275
+ function getOrientation(shape) {
276
+ const oc = getKernel().oc;
277
+ const orient = shape.wrapped.Orientation_1();
278
+ return orient === oc.TopAbs_Orientation.TopAbs_FORWARD ? "forward" : "backward";
279
+ }
280
+ function flipOrientation(shape) {
281
+ return castShape(shape.wrapped.Reversed());
282
+ }
283
+ function interpolateCurve(points, options = {}) {
284
+ if (points.length < 2) {
285
+ return err(typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
286
+ }
287
+ try {
288
+ const result = getKernel().interpolatePoints(points, options);
289
+ const cast = castShape(result);
290
+ if (!isEdge(cast)) {
291
+ return err(typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
292
+ }
293
+ return ok(cast);
294
+ } catch (e) {
295
+ return err(
296
+ typeCastError(
297
+ "INTERPOLATE_FAILED",
298
+ `Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
299
+ )
300
+ );
301
+ }
302
+ }
303
+ function approximateCurve(points, options = {}) {
304
+ if (points.length < 2) {
305
+ return err(typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
306
+ }
307
+ try {
308
+ const result = getKernel().approximatePoints(points, options);
309
+ const cast = castShape(result);
310
+ if (!isEdge(cast)) {
311
+ return err(typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
312
+ }
313
+ return ok(cast);
314
+ } catch (e) {
315
+ return err(
316
+ typeCastError(
317
+ "APPROXIMATE_FAILED",
318
+ `Approximation failed: ${e instanceof Error ? e.message : String(e)}`
319
+ )
320
+ );
321
+ }
322
+ }
323
+ function offsetWire2D(wire, offset, kind = "arc") {
324
+ const oc = getKernel().oc;
325
+ const joinTypes = {
326
+ arc: oc.GeomAbs_JoinType.GeomAbs_Arc,
327
+ intersection: oc.GeomAbs_JoinType.GeomAbs_Intersection,
328
+ tangent: oc.GeomAbs_JoinType.GeomAbs_Tangent
329
+ };
330
+ const resultShape = getKernel().offsetWire2D(wire.wrapped, offset, joinTypes[kind]);
331
+ const wrapped = castShape(resultShape);
332
+ if (!isWire(wrapped)) {
333
+ wrapped[Symbol.dispose]();
334
+ return err(typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
335
+ }
336
+ return ok(wrapped);
337
+ }
338
+ export {
339
+ findCurveType as A,
340
+ flipOrientation as B,
341
+ getCurveType as C,
342
+ getOrientation as D,
343
+ interpolateCurve as E,
344
+ isEqualShape as F,
345
+ iterEdges as G,
346
+ iterFaces as H,
347
+ iterVertices as I,
348
+ iterWires as J,
349
+ offsetWire2D as K,
350
+ getEdges as a,
351
+ clone as b,
352
+ curveIsClosed as c,
353
+ describe as d,
354
+ isEmpty as e,
355
+ simplify as f,
356
+ getHashCode as g,
357
+ toBREP as h,
358
+ isSameShape as i,
359
+ getBounds as j,
360
+ getFaces as k,
361
+ curveTangentAt as l,
362
+ mirror as m,
363
+ curvePointAt as n,
364
+ curveEndPoint as o,
365
+ curveStartPoint as p,
366
+ curveLength as q,
367
+ rotate as r,
368
+ scale as s,
369
+ translate as t,
370
+ getVertices as u,
371
+ vertexPosition as v,
372
+ getWires as w,
373
+ approximateCurve as x,
374
+ curveIsPeriodic as y,
375
+ curvePeriod as z
376
+ };