brepjs 9.6.0 → 9.6.2

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 (50) hide show
  1. package/dist/2d.cjs +2 -2
  2. package/dist/2d.js +3 -3
  3. package/dist/{Blueprint-DbcEnHcZ.cjs → Blueprint-Buw5NaaN.cjs} +1 -1
  4. package/dist/{Blueprint-CnctMERm.js → Blueprint-Ds7ldEuR.js} +1 -1
  5. package/dist/{boolean2D-NMaXON0W.cjs → boolean2D-BbMqR4ry.cjs} +2 -2
  6. package/dist/{boolean2D-UpAGffcM.js → boolean2D-UIFKiB-z.js} +2 -2
  7. package/dist/{booleanFns-7rIed0u7.js → booleanFns-B7o9xEKN.js} +1 -1
  8. package/dist/{booleanFns-Bv06tE2O.cjs → booleanFns-CicDrf13.cjs} +1 -1
  9. package/dist/brepjs.cjs +65 -40
  10. package/dist/brepjs.js +72 -47
  11. package/dist/{cornerFinder-Ci8VuZvA.cjs → cornerFinder-CmYHAi6y.cjs} +1 -1
  12. package/dist/{cornerFinder-HW6Pd4KN.js → cornerFinder-DRM_mW4S.js} +1 -1
  13. package/dist/{drawFns-C01_zGVe.cjs → drawFns-B3pqmauj.cjs} +6 -6
  14. package/dist/{drawFns-C8U90XIf.js → drawFns-BpL0Hy-d.js} +6 -6
  15. package/dist/{helpers-nNbxhw97.js → helpers-CgYPZtS3.js} +2 -2
  16. package/dist/{helpers-BlW0S8kc.cjs → helpers-ChqDvw7O.cjs} +2 -2
  17. package/dist/io/threemfImportFns.d.ts.map +1 -1
  18. package/dist/io.cjs +2 -2
  19. package/dist/io.js +2 -2
  20. package/dist/kernel/brepkit2d.d.ts +9 -0
  21. package/dist/kernel/brepkit2d.d.ts.map +1 -1
  22. package/dist/kernel/brepkitAdapter.d.ts +23 -3
  23. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  24. package/dist/kernel/brepkitWasmTypes.d.ts +13 -1
  25. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  26. package/dist/measurement/measureFns.d.ts.map +1 -1
  27. package/dist/{measurement-mWRWDA69.cjs → measurement-Be6iBmbY.cjs} +7 -1
  28. package/dist/{measurement-4z0i9NjE.js → measurement-uik4S5rT.js} +7 -1
  29. package/dist/measurement.cjs +1 -1
  30. package/dist/measurement.js +1 -1
  31. package/dist/{meshFns-D2eLJfd6.js → meshFns-DFcXnbUc.js} +1 -1
  32. package/dist/{meshFns-Bl6gXIPd.cjs → meshFns-DYVlvVgv.cjs} +1 -1
  33. package/dist/{operations-JLacBa4V.cjs → operations-BDDi1gRl.cjs} +2 -2
  34. package/dist/{operations-6JJEKei9.js → operations-CbOYvlV9.js} +2 -2
  35. package/dist/operations.cjs +1 -1
  36. package/dist/operations.js +1 -1
  37. package/dist/query.cjs +2 -2
  38. package/dist/query.js +3 -3
  39. package/dist/{shapeFns-DdBZDjVs.cjs → shapeFns-B4JqxpLh.cjs} +61 -2
  40. package/dist/{shapeFns-BO9NK6Oo.js → shapeFns-CAunmBwM.js} +61 -2
  41. package/dist/sketching.cjs +2 -2
  42. package/dist/sketching.js +2 -2
  43. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  44. package/dist/topology/shapeFns.d.ts +2 -1
  45. package/dist/topology/shapeFns.d.ts.map +1 -1
  46. package/dist/{topology-In3-XjPz.cjs → topology-BCIKO1hh.cjs} +3 -3
  47. package/dist/{topology-JKo9WLos.js → topology-cvQCn0CJ.js} +3 -3
  48. package/dist/topology.cjs +4 -4
  49. package/dist/topology.js +4 -4
  50. package/package.json +10 -10
package/dist/2d.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Blueprint = require("./Blueprint-DbcEnHcZ.cjs");
4
- const boolean2D = require("./boolean2D-NMaXON0W.cjs");
3
+ const Blueprint = require("./Blueprint-Buw5NaaN.cjs");
4
+ const boolean2D = require("./boolean2D-BbMqR4ry.cjs");
5
5
  function reverseCurve(curve) {
6
6
  const cloned = curve.clone();
7
7
  cloned.reverse();
package/dist/2d.js CHANGED
@@ -1,6 +1,6 @@
1
- import { B as Blueprint } from "./Blueprint-CnctMERm.js";
2
- import { d, C } from "./Blueprint-CnctMERm.js";
3
- import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-UpAGffcM.js";
1
+ import { B as Blueprint } from "./Blueprint-Ds7ldEuR.js";
2
+ import { d, C } from "./Blueprint-Ds7ldEuR.js";
3
+ import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-UIFKiB-z.js";
4
4
  function reverseCurve(curve) {
5
5
  const cloned = curve.clone();
6
6
  cloned.reverse();
@@ -5,7 +5,7 @@ const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
5
5
  const faceFns = require("./faceFns-BxkKVWoi.cjs");
6
6
  const curveFns = require("./curveFns-NHndvCbT.cjs");
7
7
  const errors = require("./errors-DiTn5EoC.cjs");
8
- const helpers = require("./helpers-BlW0S8kc.cjs");
8
+ const helpers = require("./helpers-ChqDvw7O.cjs");
9
9
  const vecOps = require("./vecOps-CjRL1jau.cjs");
10
10
  const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
11
11
  const result = require("./result.cjs");
@@ -4,7 +4,7 @@ import { q as getKernel, y as getKernel2D, z as registerForCleanup, A as unregis
4
4
  import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-BkJ2_drH.js";
5
5
  import { g as getOrientation } from "./curveFns-DimdPJLf.js";
6
6
  import { o as ok, e as err, b as computationError, u as unwrap, x as validationError } from "./errors-lBwyc8YG.js";
7
- import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-nNbxhw97.js";
7
+ import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-CgYPZtS3.js";
8
8
  import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
9
9
  import { m as makeFace } from "./surfaceBuilders-CX69g8_x.js";
10
10
  import { bug } from "./result.js";
@@ -54,8 +54,8 @@ const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
54
54
  const curveFns = require("./curveFns-NHndvCbT.cjs");
55
55
  const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
56
56
  const result = require("./result.cjs");
57
- const helpers = require("./helpers-BlW0S8kc.cjs");
58
- const Blueprint = require("./Blueprint-DbcEnHcZ.cjs");
57
+ const helpers = require("./helpers-ChqDvw7O.cjs");
58
+ const Blueprint = require("./Blueprint-Buw5NaaN.cjs");
59
59
  const intersectCurves = (first, second, precision = 1e-9) => {
60
60
  if (first.boundingBox.isOut(second.boundingBox))
61
61
  return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
@@ -53,8 +53,8 @@ import { y as getKernel2D, t as createFace, r as createWire, q as getKernel, s a
53
53
  import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-DimdPJLf.js";
54
54
  import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-CX69g8_x.js";
55
55
  import { bug } from "./result.js";
56
- import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-nNbxhw97.js";
57
- import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-CnctMERm.js";
56
+ import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-CgYPZtS3.js";
57
+ import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-Ds7ldEuR.js";
58
58
  const intersectCurves = (first, second, precision = 1e-9) => {
59
59
  if (first.boundingBox.isOut(second.boundingBox))
60
60
  return ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
@@ -2,7 +2,7 @@ import { q as getKernel, c as castShape, j as isShape3D } from "./shapeTypes-Dh_
2
2
  import { o as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, k as kernelError } from "./errors-lBwyc8YG.js";
3
3
  import { r as resolvePlane } from "./vectors-B8RRTytu.js";
4
4
  import { H as HASH_CODE_MAX, n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
5
- import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-BO9NK6Oo.js";
5
+ import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-CAunmBwM.js";
6
6
  import { m as makeFace } from "./surfaceBuilders-CX69g8_x.js";
7
7
  const shapeTagStore = /* @__PURE__ */ new WeakMap();
8
8
  const tagMetadataStore = /* @__PURE__ */ new WeakMap();
@@ -3,7 +3,7 @@ const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
3
3
  const errors = require("./errors-DiTn5EoC.cjs");
4
4
  const vectors = require("./vectors-DqQXtR8s.cjs");
5
5
  const vecOps = require("./vecOps-CjRL1jau.cjs");
6
- const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
6
+ const shapeFns = require("./shapeFns-B4JqxpLh.cjs");
7
7
  const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
8
8
  const shapeTagStore = /* @__PURE__ */ new WeakMap();
9
9
  const tagMetadataStore = /* @__PURE__ */ new WeakMap();
package/dist/brepjs.cjs CHANGED
@@ -48,27 +48,27 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
48
48
  const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
49
49
  const errors = require("./errors-DiTn5EoC.cjs");
50
50
  const vecOps = require("./vecOps-CjRL1jau.cjs");
51
- const Blueprint = require("./Blueprint-DbcEnHcZ.cjs");
51
+ const Blueprint = require("./Blueprint-Buw5NaaN.cjs");
52
52
  const loft$2 = require("./loft-CvTRTIDd.cjs");
53
- const operations = require("./operations-JLacBa4V.cjs");
54
- const boolean2D = require("./boolean2D-NMaXON0W.cjs");
53
+ const operations = require("./operations-BDDi1gRl.cjs");
54
+ const boolean2D = require("./boolean2D-BbMqR4ry.cjs");
55
55
  const _2d = require("./2d.cjs");
56
- const helpers = require("./helpers-BlW0S8kc.cjs");
56
+ const helpers = require("./helpers-ChqDvw7O.cjs");
57
57
  const io = require("./io.cjs");
58
- const drawFns = require("./drawFns-C01_zGVe.cjs");
58
+ const drawFns = require("./drawFns-B3pqmauj.cjs");
59
59
  const types = require("./types-CA_xrgDq.cjs");
60
60
  const vectors = require("./vectors-DqQXtR8s.cjs");
61
- const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
62
- const booleanFns = require("./booleanFns-Bv06tE2O.cjs");
63
- const topology = require("./topology-In3-XjPz.cjs");
61
+ const shapeFns = require("./shapeFns-B4JqxpLh.cjs");
62
+ const booleanFns = require("./booleanFns-CicDrf13.cjs");
63
+ const topology = require("./topology-BCIKO1hh.cjs");
64
64
  const curveFns = require("./curveFns-NHndvCbT.cjs");
65
65
  const faceFns = require("./faceFns-BxkKVWoi.cjs");
66
- const meshFns = require("./meshFns-Bl6gXIPd.cjs");
67
- const measurement = require("./measurement-mWRWDA69.cjs");
66
+ const meshFns = require("./meshFns-DYVlvVgv.cjs");
67
+ const measurement = require("./measurement-Be6iBmbY.cjs");
68
68
  const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
69
69
  const query = require("./query.cjs");
70
70
  const result = require("./result.cjs");
71
- const cornerFinder = require("./cornerFinder-Ci8VuZvA.cjs");
71
+ const cornerFinder = require("./cornerFinder-CmYHAi6y.cjs");
72
72
  const worker = require("./worker.cjs");
73
73
  function supportsProjection(kernel) {
74
74
  return "projectShape" in kernel;
@@ -1707,29 +1707,36 @@ function parseModelXml(xml) {
1707
1707
  }
1708
1708
  function buildSolidFromMesh(mesh2) {
1709
1709
  const kernel = shapeTypes.getKernel();
1710
- const triFaces = [];
1711
- for (const [v1, v2, v3] of mesh2.triangles) {
1712
- const va = mesh2.vertices[v1];
1713
- const vb = mesh2.vertices[v2];
1714
- const vc = mesh2.vertices[v3];
1715
- if (!va || !vb || !vc) continue;
1716
- const triFace = kernel.buildTriFace(va, vb, vc);
1717
- if (triFace !== null) {
1718
- triFaces.push(triFace);
1719
- }
1720
- }
1721
- if (triFaces.length === 0) {
1722
- return errors.err(
1723
- errors.ioError(errors.BrepErrorCode.THREEMF_IMPORT_FAILED, "No valid triangular faces could be built")
1724
- );
1725
- }
1710
+ const points = mesh2.vertices.map(([x, y, z]) => ({ x, y, z }));
1711
+ const faces = mesh2.triangles;
1726
1712
  try {
1727
- return errors.ok(shapeTypes.castShape(kernel.sewAndSolidify(triFaces, 1e-6)));
1713
+ const solid2 = kernel.buildSolidFromFaces(points, faces, 1e-6);
1714
+ return errors.ok(shapeTypes.castShape(solid2));
1728
1715
  } catch {
1716
+ const triFaces = [];
1717
+ for (const [v1, v2, v3] of mesh2.triangles) {
1718
+ const va = mesh2.vertices[v1];
1719
+ const vb = mesh2.vertices[v2];
1720
+ const vc = mesh2.vertices[v3];
1721
+ if (!va || !vb || !vc) continue;
1722
+ const triFace = kernel.buildTriFace(va, vb, vc);
1723
+ if (triFace !== null) {
1724
+ triFaces.push(triFace);
1725
+ }
1726
+ }
1727
+ if (triFaces.length === 0) {
1728
+ return errors.err(
1729
+ errors.ioError(errors.BrepErrorCode.THREEMF_IMPORT_FAILED, "No valid triangular faces could be built")
1730
+ );
1731
+ }
1729
1732
  try {
1730
- return errors.ok(shapeTypes.castShape(kernel.sew(triFaces, 1e-6)));
1733
+ return errors.ok(shapeTypes.castShape(kernel.sewAndSolidify(triFaces, 1e-6)));
1731
1734
  } catch {
1732
- return errors.err(errors.ioError(errors.BrepErrorCode.THREEMF_IMPORT_FAILED, "Failed to sew triangular faces"));
1735
+ try {
1736
+ return errors.ok(shapeTypes.castShape(kernel.sew(triFaces, 1e-6)));
1737
+ } catch {
1738
+ return errors.err(errors.ioError(errors.BrepErrorCode.THREEMF_IMPORT_FAILED, "Failed to sew triangular faces"));
1739
+ }
1733
1740
  }
1734
1741
  }
1735
1742
  }
@@ -2445,17 +2452,35 @@ function drill(shape2, options) {
2445
2452
  }
2446
2453
  const dir = vecOps.vecNormalize(axis);
2447
2454
  const pos = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]];
2448
- let depth = options.depth;
2449
- if (depth === void 0) {
2455
+ let tool;
2456
+ if (options.depth !== void 0) {
2457
+ tool = loft$2.makeCylinder(radius, options.depth, pos, dir);
2458
+ } else {
2450
2459
  const b = shapeFns.getBounds(s);
2451
- const dx = b.xMax - b.xMin;
2452
- const dy = b.yMax - b.yMin;
2453
- const dz = b.zMax - b.zMin;
2454
- depth = Math.sqrt(dx * dx + dy * dy + dz * dz) + 1;
2455
- }
2456
- const cyl = loft$2.makeCylinder(radius, depth, pos, dir);
2457
- const startOffset = options.depth === void 0 ? vecOps.vecScale(dir, -depth / 2) : [0, 0, 0];
2458
- const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ? shapeFns.translate(cyl, startOffset) : cyl;
2460
+ const corners = [
2461
+ [b.xMin, b.yMin, b.zMin],
2462
+ [b.xMax, b.yMin, b.zMin],
2463
+ [b.xMin, b.yMax, b.zMin],
2464
+ [b.xMax, b.yMax, b.zMin],
2465
+ [b.xMin, b.yMin, b.zMax],
2466
+ [b.xMax, b.yMin, b.zMax],
2467
+ [b.xMin, b.yMax, b.zMax],
2468
+ [b.xMax, b.yMax, b.zMax]
2469
+ ];
2470
+ let tMin = Infinity;
2471
+ let tMax = -Infinity;
2472
+ for (const c of corners) {
2473
+ const t = (c[0] - pos[0]) * dir[0] + (c[1] - pos[1]) * dir[1] + (c[2] - pos[2]) * dir[2];
2474
+ if (t < tMin) tMin = t;
2475
+ if (t > tMax) tMax = t;
2476
+ }
2477
+ const overshoot = 1;
2478
+ tMin -= overshoot;
2479
+ tMax += overshoot;
2480
+ const depth = tMax - tMin;
2481
+ const startPos = [pos[0] + dir[0] * tMin, pos[1] + dir[1] * tMin, pos[2] + dir[2] * tMin];
2482
+ tool = loft$2.makeCylinder(radius, depth, startPos, dir);
2483
+ }
2459
2484
  return booleanFns.cut(s, tool);
2460
2485
  }
2461
2486
  function pocket(shape2, options) {
package/dist/brepjs.js CHANGED
@@ -49,39 +49,39 @@ import { o as ok, y as translateKernelError, e as err, p as typeCastError, q as
49
49
  import { O, z, a as a2, c, b as b2, f as f2, A, g as g2, m as m2, h as h2, j, l, C as C2, D, E as E2, s as s2, F as F2, G, t as t2, n, r, v as v2, w as w2, H } from "./errors-lBwyc8YG.js";
50
50
  import { c as vecDistance, D as DEG2RAD, H as HASH_CODE_MAX, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
51
51
  import { R, v as v3, a as a3, b as b3, d, e, g as g3, h as h3, i as i2, k, l as l2, m as m3, o as o2 } from "./vecOps-ZDdZWbwT.js";
52
- import { B as B2, d as d2, C as C3, s as s3 } from "./Blueprint-CnctMERm.js";
52
+ import { B as B2, d as d2, C as C3, s as s3 } from "./Blueprint-Ds7ldEuR.js";
53
53
  import { m as makeCompound, d as makeCone, e as makeCylinder, f as makeEllipsoid, h as makeOffset, w as weldShellsAndFaces, a as makeSolid, i as makeSphere, j as makeTorus, k as makeVertex } from "./loft-C8yS_NS6.js";
54
54
  import { b as b4, g as g4, r as r2 } from "./loft-C8yS_NS6.js";
55
- import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-6JJEKei9.js";
56
- import { a as a4, b as b5, d as d3, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n2, o as o3, p as p2, q, t as t3, u as u2, v as v4, x, y, z as z2, A as A2, B as B3, C as C4, D as D2, E as E3, F as F3, G as G2 } from "./operations-6JJEKei9.js";
57
- import { B as B4, a as a5, e as e2, C as C5, F as F4, S, f as f4, l as l3, g as g6, n as n3, k as k3, q as q2, o as o4, p as p3, r as r3 } from "./boolean2D-UpAGffcM.js";
55
+ import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-CbOYvlV9.js";
56
+ import { a as a4, b as b5, d as d3, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n2, o as o3, p as p2, q, t as t3, u as u2, v as v4, x, y, z as z2, A as A2, B as B3, C as C4, D as D2, E as E3, F as F3, G as G2 } from "./operations-CbOYvlV9.js";
57
+ import { B as B4, a as a5, e as e2, C as C5, F as F4, S, f as f4, l as l3, g as g6, n as n3, k as k3, q as q2, o as o4, p as p3, r as r3 } from "./boolean2D-UIFKiB-z.js";
58
58
  import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
59
- import { l as createTypedFinder, m as faceFinder } from "./helpers-nNbxhw97.js";
60
- import { g as g7 } from "./helpers-nNbxhw97.js";
59
+ import { l as createTypedFinder, m as faceFinder } from "./helpers-CgYPZtS3.js";
60
+ import { g as g7 } from "./helpers-CgYPZtS3.js";
61
61
  import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
62
- import { C as C6, D as D3, a as a6, S as S2, b as b6, X, Y, c as c2, d as d4, e as e3, f as f5, Z, g as g8, h as h5, i as i4, j as j3, k as k4, l as l4, m as m5, n as n4, o as o5, p as p4, q as q3, r as r4, s as s4, t as t4, u as u3, v as v5, w as w3, x as x2, y as y2, z as z3, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E4, a3 as a32, F as F5, G as G3, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-C8U90XIf.js";
62
+ import { C as C6, D as D3, a as a6, S as S2, b as b6, X, Y, c as c2, d as d4, e as e3, f as f5, Z, g as g8, h as h5, i as i4, j as j3, k as k4, l as l4, m as m5, n as n4, o as o5, p as p4, q as q3, r as r4, s as s4, t as t4, u as u3, v as v5, w as w3, x as x2, y as y2, z as z3, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E4, a3 as a32, F as F5, G as G3, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-BpL0Hy-d.js";
63
63
  import { a as toVec3 } from "./types-CWDdqcrq.js";
64
64
  import { r as r5, t as t5 } from "./types-CWDdqcrq.js";
65
65
  import { c as c3, a as a7, p as p5, r as r6, t as t6 } from "./vectors-B8RRTytu.js";
66
- import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, t as translate$1, p as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, q as toBREP$1, u as transformCopy$1, c as getWires } from "./shapeFns-BO9NK6Oo.js";
67
- import { w as w4, f as f6, x as x3, i as i5, y as y3, z as z4, A as A4, B as B6, C as C7, D as D4 } from "./shapeFns-BO9NK6Oo.js";
68
- import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-7rIed0u7.js";
69
- import { l as l5, m as m6, n as n5, o as o6, q as q4, r as r7, t as t7, u as u4, v as v6 } from "./booleanFns-7rIed0u7.js";
70
- import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-JKo9WLos.js";
71
- import { a as a8, b as b7, e as e4, f as f7, d as d5, g as g9, j as j4, s as s5, t as t8, k as k5, l as l6, v as v7, w as w5 } from "./topology-JKo9WLos.js";
66
+ import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, t as translate$1, p as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, q as toBREP$1, u as transformCopy$1, c as getWires } from "./shapeFns-CAunmBwM.js";
67
+ import { w as w4, f as f6, x as x3, i as i5, y as y3, z as z4, A as A4, B as B6, C as C7, D as D4 } from "./shapeFns-CAunmBwM.js";
68
+ import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-B7o9xEKN.js";
69
+ import { l as l5, m as m6, n as n5, o as o6, q as q4, r as r7, t as t7, u as u4, v as v6 } from "./booleanFns-B7o9xEKN.js";
70
+ import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-cvQCn0CJ.js";
71
+ import { a as a8, b as b7, e as e4, f as f7, d as d5, g as g9, j as j4, s as s5, t as t8, k as k5, l as l6, v as v7, w as w5 } from "./topology-cvQCn0CJ.js";
72
72
  import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-DimdPJLf.js";
73
73
  import { j as j5, k as k6, l as l7, f as f8, b as b8, g as g10, m as m7, o as o7 } from "./curveFns-DimdPJLf.js";
74
74
  import { i as iterTopo, e as faceCenter, n as normalAt, j as fromBREP$1, k as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-BkJ2_drH.js";
75
75
  import { l as l8, c as c4, m as m8, d as d6, f as f9, q as q5, r as r8, s as s6, p as p6, t as t9, v as v8, u as u5, h as h6 } from "./faceFns-BkJ2_drH.js";
76
- import { m as mesh$1, a as meshEdges$1 } from "./meshFns-D2eLJfd6.js";
77
- import { c as c5, b as b9, e as e5, d as d7, f as f10 } from "./meshFns-D2eLJfd6.js";
78
- import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-4z0i9NjE.js";
79
- import { d as d8, e as e6, f as f11, g as g11, h as h7, i as i6 } from "./measurement-4z0i9NjE.js";
76
+ import { m as mesh$1, a as meshEdges$1 } from "./meshFns-DFcXnbUc.js";
77
+ import { c as c5, b as b9, e as e5, d as d7, f as f10 } from "./meshFns-DFcXnbUc.js";
78
+ import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-uik4S5rT.js";
79
+ import { d as d8, e as e6, f as f11, g as g11, h as h7, i as i6 } from "./measurement-uik4S5rT.js";
80
80
  import { h as addHolesInFace, g as makeBezierCurve, k as makeBSplineApproximation, i as makeCircle, j as makeEllipse, f as makeEllipseArc, m as makeFace, n as makeNonPlanarFace, c as makeHelix, a as makeLine, o as makePolygon, l as makeNewFaceWithinFace, e as makeTangentArc, d as makeThreePointArc, b as assembleWire } from "./surfaceBuilders-CX69g8_x.js";
81
81
  import { p as p7 } from "./surfaceBuilders-CX69g8_x.js";
82
82
  import { edgeFinder } from "./query.js";
83
83
  import { BrepBugError, bug } from "./result.js";
84
- import { c as c6 } from "./cornerFinder-HW6Pd4KN.js";
84
+ import { c as c6 } from "./cornerFinder-DRM_mW4S.js";
85
85
  import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
86
86
  function supportsProjection(kernel) {
87
87
  return "projectShape" in kernel;
@@ -1720,29 +1720,36 @@ function parseModelXml(xml) {
1720
1720
  }
1721
1721
  function buildSolidFromMesh(mesh2) {
1722
1722
  const kernel = getKernel();
1723
- const triFaces = [];
1724
- for (const [v1, v22, v32] of mesh2.triangles) {
1725
- const va = mesh2.vertices[v1];
1726
- const vb = mesh2.vertices[v22];
1727
- const vc = mesh2.vertices[v32];
1728
- if (!va || !vb || !vc) continue;
1729
- const triFace = kernel.buildTriFace(va, vb, vc);
1730
- if (triFace !== null) {
1731
- triFaces.push(triFace);
1732
- }
1733
- }
1734
- if (triFaces.length === 0) {
1735
- return err(
1736
- ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "No valid triangular faces could be built")
1737
- );
1738
- }
1723
+ const points = mesh2.vertices.map(([x4, y4, z5]) => ({ x: x4, y: y4, z: z5 }));
1724
+ const faces = mesh2.triangles;
1739
1725
  try {
1740
- return ok(castShape(kernel.sewAndSolidify(triFaces, 1e-6)));
1726
+ const solid2 = kernel.buildSolidFromFaces(points, faces, 1e-6);
1727
+ return ok(castShape(solid2));
1741
1728
  } catch {
1729
+ const triFaces = [];
1730
+ for (const [v1, v22, v32] of mesh2.triangles) {
1731
+ const va = mesh2.vertices[v1];
1732
+ const vb = mesh2.vertices[v22];
1733
+ const vc = mesh2.vertices[v32];
1734
+ if (!va || !vb || !vc) continue;
1735
+ const triFace = kernel.buildTriFace(va, vb, vc);
1736
+ if (triFace !== null) {
1737
+ triFaces.push(triFace);
1738
+ }
1739
+ }
1740
+ if (triFaces.length === 0) {
1741
+ return err(
1742
+ ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "No valid triangular faces could be built")
1743
+ );
1744
+ }
1742
1745
  try {
1743
- return ok(castShape(kernel.sew(triFaces, 1e-6)));
1746
+ return ok(castShape(kernel.sewAndSolidify(triFaces, 1e-6)));
1744
1747
  } catch {
1745
- return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "Failed to sew triangular faces"));
1748
+ try {
1749
+ return ok(castShape(kernel.sew(triFaces, 1e-6)));
1750
+ } catch {
1751
+ return err(ioError(BrepErrorCode.THREEMF_IMPORT_FAILED, "Failed to sew triangular faces"));
1752
+ }
1746
1753
  }
1747
1754
  }
1748
1755
  }
@@ -2458,17 +2465,35 @@ function drill(shape2, options) {
2458
2465
  }
2459
2466
  const dir = vecNormalize(axis);
2460
2467
  const pos = at.length === 2 ? [at[0], at[1], 0] : [at[0], at[1], at[2]];
2461
- let depth = options.depth;
2462
- if (depth === void 0) {
2468
+ let tool;
2469
+ if (options.depth !== void 0) {
2470
+ tool = makeCylinder(radius, options.depth, pos, dir);
2471
+ } else {
2463
2472
  const b10 = getBounds(s7);
2464
- const dx = b10.xMax - b10.xMin;
2465
- const dy = b10.yMax - b10.yMin;
2466
- const dz = b10.zMax - b10.zMin;
2467
- depth = Math.sqrt(dx * dx + dy * dy + dz * dz) + 1;
2468
- }
2469
- const cyl = makeCylinder(radius, depth, pos, dir);
2470
- const startOffset = options.depth === void 0 ? vecScale(dir, -depth / 2) : [0, 0, 0];
2471
- const tool = startOffset[0] !== 0 || startOffset[1] !== 0 || startOffset[2] !== 0 ? translate$1(cyl, startOffset) : cyl;
2473
+ const corners = [
2474
+ [b10.xMin, b10.yMin, b10.zMin],
2475
+ [b10.xMax, b10.yMin, b10.zMin],
2476
+ [b10.xMin, b10.yMax, b10.zMin],
2477
+ [b10.xMax, b10.yMax, b10.zMin],
2478
+ [b10.xMin, b10.yMin, b10.zMax],
2479
+ [b10.xMax, b10.yMin, b10.zMax],
2480
+ [b10.xMin, b10.yMax, b10.zMax],
2481
+ [b10.xMax, b10.yMax, b10.zMax]
2482
+ ];
2483
+ let tMin = Infinity;
2484
+ let tMax = -Infinity;
2485
+ for (const c7 of corners) {
2486
+ const t10 = (c7[0] - pos[0]) * dir[0] + (c7[1] - pos[1]) * dir[1] + (c7[2] - pos[2]) * dir[2];
2487
+ if (t10 < tMin) tMin = t10;
2488
+ if (t10 > tMax) tMax = t10;
2489
+ }
2490
+ const overshoot = 1;
2491
+ tMin -= overshoot;
2492
+ tMax += overshoot;
2493
+ const depth = tMax - tMin;
2494
+ const startPos = [pos[0] + dir[0] * tMin, pos[1] + dir[1] * tMin, pos[2] + dir[2] * tMin];
2495
+ tool = makeCylinder(radius, depth, startPos, dir);
2496
+ }
2472
2497
  return cut$1(s7, tool);
2473
2498
  }
2474
2499
  function pocket(shape2, options) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const helpers = require("./helpers-BlW0S8kc.cjs");
2
+ const helpers = require("./helpers-ChqDvw7O.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
4
  const PI_2 = 2 * Math.PI;
5
5
  function positiveHalfAngle(angle) {
@@ -1,4 +1,4 @@
1
- import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-nNbxhw97.js";
1
+ import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-CgYPZtS3.js";
2
2
  import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
3
3
  const PI_2 = 2 * Math.PI;
4
4
  function positiveHalfAngle(angle) {
@@ -48,18 +48,18 @@ const errors = require("./errors-DiTn5EoC.cjs");
48
48
  const vectors = require("./vectors-DqQXtR8s.cjs");
49
49
  const types = require("./types-CA_xrgDq.cjs");
50
50
  const vecOps = require("./vecOps-CjRL1jau.cjs");
51
- const boolean2D = require("./boolean2D-NMaXON0W.cjs");
51
+ const boolean2D = require("./boolean2D-BbMqR4ry.cjs");
52
52
  const faceFns = require("./faceFns-BxkKVWoi.cjs");
53
53
  const curveFns = require("./curveFns-NHndvCbT.cjs");
54
54
  const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
55
55
  const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
56
- const Blueprint = require("./Blueprint-DbcEnHcZ.cjs");
56
+ const Blueprint = require("./Blueprint-Buw5NaaN.cjs");
57
57
  const result = require("./result.cjs");
58
- const helpers = require("./helpers-BlW0S8kc.cjs");
59
- const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
58
+ const helpers = require("./helpers-ChqDvw7O.cjs");
59
+ const shapeFns = require("./shapeFns-B4JqxpLh.cjs");
60
60
  const loft = require("./loft-CvTRTIDd.cjs");
61
61
  const opentype = require("opentype.js");
62
- const cornerFinder = require("./cornerFinder-Ci8VuZvA.cjs");
62
+ const cornerFinder = require("./cornerFinder-CmYHAi6y.cjs");
63
63
  const stitchCurves = (curves, precision = 1e-7) => {
64
64
  const startPoints = new boolean2D.Flatbush(curves.length);
65
65
  curves.forEach((c) => {
@@ -747,7 +747,7 @@ const sketchHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1],
747
747
  const makeBaseBox = (xLength, yLength, zLength) => {
748
748
  return new Sketcher().movePointerTo([-xLength / 2, yLength / 2]).hLine(xLength).vLine(-yLength).hLine(-xLength).close().extrude(zLength);
749
749
  };
750
- const samePoint = (x, y) => helpers.samePoint(x, y, helpers.PRECISION_OFFSET * 10);
750
+ const samePoint = (x, y) => helpers.samePoint(x, y, helpers.PRECISION_OFFSET * 100);
751
751
  const getIntersectionPoint = (line1Start, line1End, line2Start, line2End) => {
752
752
  const dx1 = line1Start[0] - line1End[0];
753
753
  const dy1 = line1Start[1] - line1End[1];
@@ -47,18 +47,18 @@ import { u as unwrap, g as isOk, e as err, x as validationError, o as ok } from
47
47
  import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-B8RRTytu.js";
48
48
  import { a as toVec3 } from "./types-CWDdqcrq.js";
49
49
  import { n as vecScale, j as vecNormalize, v as vecAdd, o as vecSub, b as vecCross, m as vecRotate, R as RAD2DEG, g as vecLength, e as vecEquals, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
50
- import { b as Flatbush, c as convertSvgEllipseParams, d as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, e as Blueprints, C as CompoundBlueprint, f as cut2D, i as intersectCurves, g as fuse2D, m as make2dOffset, h as filletCurves, j as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, k as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-UpAGffcM.js";
50
+ import { b as Flatbush, c as convertSvgEllipseParams, d as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, e as Blueprints, C as CompoundBlueprint, f as cut2D, i as intersectCurves, g as fuse2D, m as make2dOffset, h as filletCurves, j as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, k as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-UIFKiB-z.js";
51
51
  import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-BkJ2_drH.js";
52
52
  import { c as curveTangentAt, a as curveEndPoint, f as flipOrientation, b as getCurveType, o as offsetWire2D } from "./curveFns-DimdPJLf.js";
53
53
  import { a as makeLine, d as makeThreePointArc, e as makeTangentArc, f as makeEllipseArc, g as makeBezierCurve, b as assembleWire, h as addHolesInFace, m as makeFace, i as makeCircle, j as makeEllipse, c as makeHelix, k as makeBSplineApproximation } from "./surfaceBuilders-CX69g8_x.js";
54
54
  import { D as DisposalScope, q as getKernel, r as createWire, t as createFace, e as isFace, c as castShape } from "./shapeTypes-Dh_qy0wO.js";
55
- import { m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, c as approximateAsSvgCompatibleCurve, d as BoundingBox2d, e as edgeToCurve, f as make2dInerpolatedBSplineCurve, g as make2dCircle, h as make2dEllipse, i as deserializeCurve2D } from "./Blueprint-CnctMERm.js";
55
+ import { m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, c as approximateAsSvgCompatibleCurve, d as BoundingBox2d, e as edgeToCurve, f as make2dInerpolatedBSplineCurve, g as make2dCircle, h as make2dEllipse, i as deserializeCurve2D } from "./Blueprint-Ds7ldEuR.js";
56
56
  import { bug } from "./result.js";
57
- import { d as distance2d, p as polarAngle2d, f as polarToCartesian, P as PRECISION_OFFSET, h as squareDistance2d, s as samePoint$1, e as subtract2d, c as add2d } from "./helpers-nNbxhw97.js";
58
- import { d as getEdges } from "./shapeFns-BO9NK6Oo.js";
57
+ import { d as distance2d, p as polarAngle2d, f as polarToCartesian, P as PRECISION_OFFSET, h as squareDistance2d, s as samePoint$1, e as subtract2d, c as add2d } from "./helpers-CgYPZtS3.js";
58
+ import { d as getEdges } from "./shapeFns-CAunmBwM.js";
59
59
  import { m as makeCompound, b as basicFaceExtrusion, r as revolution, a as makeSolid, c as complexExtrude, t as twistExtrude } from "./loft-C8yS_NS6.js";
60
60
  import opentype from "opentype.js";
61
- import { c as cornerFinder } from "./cornerFinder-HW6Pd4KN.js";
61
+ import { c as cornerFinder } from "./cornerFinder-DRM_mW4S.js";
62
62
  const stitchCurves = (curves, precision = 1e-7) => {
63
63
  const startPoints = new Flatbush(curves.length);
64
64
  curves.forEach((c) => {
@@ -746,7 +746,7 @@ const sketchHelix = (pitch, height, radius, center = [0, 0, 0], dir = [0, 0, 1],
746
746
  const makeBaseBox = (xLength, yLength, zLength) => {
747
747
  return new Sketcher().movePointerTo([-xLength / 2, yLength / 2]).hLine(xLength).vLine(-yLength).hLine(-xLength).close().extrude(zLength);
748
748
  };
749
- const samePoint = (x, y) => samePoint$1(x, y, PRECISION_OFFSET * 10);
749
+ const samePoint = (x, y) => samePoint$1(x, y, PRECISION_OFFSET * 100);
750
750
  const getIntersectionPoint = (line1Start, line1End, line2Start, line2End) => {
751
751
  const dx1 = line1Start[0] - line1End[0];
752
752
  const dy1 = line1Start[1] - line1End[1];
@@ -3,8 +3,8 @@ import { c as castShape, q as getKernel, e as isFace } from "./shapeTypes-Dh_qy0
3
3
  import { u as unwrap, e as err, q as queryError, o as ok } from "./errors-lBwyc8YG.js";
4
4
  import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
5
5
  import { i as iterTopo, d as downcast, g as getSurfaceType, n as normalAt } from "./faceFns-BkJ2_drH.js";
6
- import { m as measureArea } from "./measurement-4z0i9NjE.js";
7
- import { f as getHashCode, i as isSameShape } from "./shapeFns-BO9NK6Oo.js";
6
+ import { m as measureArea } from "./measurement-uik4S5rT.js";
7
+ import { f as getHashCode, i as isSameShape } from "./shapeFns-CAunmBwM.js";
8
8
  const PRECISION_INTERSECTION = 1e-9;
9
9
  const PRECISION_OFFSET = 1e-8;
10
10
  const PRECISION_POINT = 1e-6;
@@ -4,8 +4,8 @@ const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
4
4
  const errors = require("./errors-DiTn5EoC.cjs");
5
5
  const vecOps = require("./vecOps-CjRL1jau.cjs");
6
6
  const faceFns = require("./faceFns-BxkKVWoi.cjs");
7
- const measurement = require("./measurement-mWRWDA69.cjs");
8
- const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
7
+ const measurement = require("./measurement-Be6iBmbY.cjs");
8
+ const shapeFns = require("./shapeFns-B4JqxpLh.cjs");
9
9
  const PRECISION_INTERSECTION = 1e-9;
10
10
  const PRECISION_OFFSET = 1e-8;
11
11
  const PRECISION_POINT = 1e-6;
@@ -1 +1 @@
1
- {"version":3,"file":"threemfImportFns.d.ts","sourceRoot":"","sources":["../../src/io/threemfImportFns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAoLzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CA6BzE"}
1
+ {"version":3,"file":"threemfImportFns.d.ts","sourceRoot":"","sources":["../../src/io/threemfImportFns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAiMzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CA6BzE"}
package/dist/io.cjs CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
4
4
  const errors = require("./errors-DiTn5EoC.cjs");
5
- const meshFns = require("./meshFns-Bl6gXIPd.cjs");
6
- const Blueprint = require("./Blueprint-DbcEnHcZ.cjs");
5
+ const meshFns = require("./meshFns-DYVlvVgv.cjs");
6
+ const Blueprint = require("./Blueprint-Buw5NaaN.cjs");
7
7
  function vec3At(arr, i) {
8
8
  const off = i * 3;
9
9
  return [arr[off], arr[off + 1], arr[off + 2]];
package/dist/io.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { q as getKernel, c as castShape } from "./shapeTypes-Dh_qy0wO.js";
2
2
  import { e as err, i as ioError, o as ok } from "./errors-lBwyc8YG.js";
3
- import { e, d, f } from "./meshFns-D2eLJfd6.js";
4
- import { B as Blueprint, a as make2dSegmentCurve, l as make2dThreePointArc, q as make2dBezierCurve } from "./Blueprint-CnctMERm.js";
3
+ import { e, d, f } from "./meshFns-DFcXnbUc.js";
4
+ import { B as Blueprint, a as make2dSegmentCurve, l as make2dThreePointArc, q as make2dBezierCurve } from "./Blueprint-Ds7ldEuR.js";
5
5
  function vec3At(arr, i) {
6
6
  const off = i * 3;
7
7
  return [arr[off], arr[off + 1], arr[off + 2]];
@@ -72,6 +72,15 @@ export declare function rotateCurve2d(c: Curve2dObj, angle: number, cx: number,
72
72
  export declare function scaleCurve2d(c: Curve2dObj, factor: number, cx: number, cy: number): Curve2dObj;
73
73
  export declare function mirrorAtPoint(c: Curve2dObj, cx: number, cy: number): Curve2dObj;
74
74
  export declare function mirrorAcrossAxis(c: Curve2dObj, ox: number, oy: number, dx: number, dy: number): Curve2dObj;
75
+ /**
76
+ * Compute intersection points (and overlapping segments) between two 2D curves.
77
+ * Handles analytic cases (line-line, line-circle, circle-circle) and falls back
78
+ * to numerical sampling + Newton refinement for general curves.
79
+ */
80
+ export declare function intersectCurves2dFn(c1: Curve2dObj, c2: Curve2dObj, tolerance: number): {
81
+ points: [number, number][];
82
+ segments: Curve2dObj[];
83
+ };
75
84
  export declare function serializeCurve2d(c: Curve2dObj): string;
76
85
  export declare function deserializeCurve2d(data: string): Curve2dObj;
77
86
  export declare function createBBox2d(): BBox2d;
@@ -1 +1 @@
1
- {"version":3,"file":"brepkit2d.d.ts","sourceRoot":"","sources":["../../src/kernel/brepkit2d.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAMH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM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