brepjs 8.3.0 → 8.7.4

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 (119) hide show
  1. package/dist/2d/lib/Curve2D.d.ts.map +1 -1
  2. package/dist/2d.cjs +2 -2
  3. package/dist/2d.js +13 -13
  4. package/dist/{Blueprint-a3ukJMG4.cjs → Blueprint-BcbOBF-9.cjs} +17 -102
  5. package/dist/{Blueprint-CdVaHDSx.js → Blueprint-Cmh8lKc4.js} +35 -120
  6. package/dist/{boolean2D-pvPIs21j.cjs → boolean2D-CqacqjME.cjs} +24 -25
  7. package/dist/{boolean2D-DzA0STqC.js → boolean2D-D94Axs3i.js} +23 -24
  8. package/dist/{booleanFns-BcQUqjUu.js → booleanFns-DdjtpcM6.js} +306 -12
  9. package/dist/{booleanFns-Cd414V3l.cjs → booleanFns-NtKxkiXn.cjs} +299 -5
  10. package/dist/brepjs.cjs +1782 -68
  11. package/dist/brepjs.js +2030 -317
  12. package/dist/core/errors.d.ts +25 -0
  13. package/dist/core/errors.d.ts.map +1 -1
  14. package/dist/core.cjs +4 -4
  15. package/dist/core.js +4 -4
  16. package/dist/{cornerFinder-DvPiz-VR.js → cornerFinder-BBOYfsXl.js} +1 -1
  17. package/dist/{cornerFinder-BdKtobgb.cjs → cornerFinder-Bqy8Lw2p.cjs} +1 -1
  18. package/dist/{curveFns-CyHyk29c.js → curveFns-B85Glnfo.js} +19 -17
  19. package/dist/{curveFns-B5EQsSwv.cjs → curveFns-BXCbASW-.cjs} +6 -4
  20. package/dist/{drawFns-CAAE4Z88.js → drawFns-B-gJ2WUc.js} +52 -23
  21. package/dist/{drawFns-Mr2pghU8.cjs → drawFns-CAmFEqd1.cjs} +68 -39
  22. package/dist/{errors-wGhcJMpB.js → errors-Coh_5_19.js} +35 -1
  23. package/dist/{errors-DK1VAdP4.cjs → errors-eRQu29oc.cjs} +35 -1
  24. package/dist/{faceFns-ub3CugDN.js → faceFns-CltrEfOo.js} +109 -12
  25. package/dist/{faceFns-D1Sqnlu6.cjs → faceFns-DcndPHWm.cjs} +103 -6
  26. package/dist/{helpers-CP2KrBZl.cjs → helpers-CC21GeAr.cjs} +8 -9
  27. package/dist/{helpers-r_e-u1JM.js → helpers-SksQIreB.js} +16 -17
  28. package/dist/index.d.ts +20 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/io/dxfImportFns.d.ts +17 -0
  31. package/dist/io/dxfImportFns.d.ts.map +1 -0
  32. package/dist/io/objImportFns.d.ts +19 -0
  33. package/dist/io/objImportFns.d.ts.map +1 -0
  34. package/dist/io/threemfImportFns.d.ts +19 -0
  35. package/dist/io/threemfImportFns.d.ts.map +1 -0
  36. package/dist/io.cjs +5 -5
  37. package/dist/io.js +5 -5
  38. package/dist/kernel/hullOps.d.ts +23 -0
  39. package/dist/kernel/hullOps.d.ts.map +1 -0
  40. package/dist/kernel/occtAdapter.d.ts +11 -0
  41. package/dist/kernel/occtAdapter.d.ts.map +1 -1
  42. package/dist/kernel/solverAdapter.d.ts +39 -0
  43. package/dist/kernel/solverAdapter.d.ts.map +1 -0
  44. package/dist/kernel/types.d.ts +11 -0
  45. package/dist/kernel/types.d.ts.map +1 -1
  46. package/dist/{loft-PMRx9iMG.cjs → loft-BcyyvWCj.cjs} +28 -28
  47. package/dist/{loft-BHn7GKm8.js → loft-CJMPx1NQ.js} +16 -16
  48. package/dist/{measurement-BfhEneUl.js → measurement-ByOztLxb.js} +3 -3
  49. package/dist/{measurement-B06hNs89.cjs → measurement-DU3ry-0Q.cjs} +3 -3
  50. package/dist/measurement.cjs +1 -1
  51. package/dist/measurement.js +1 -1
  52. package/dist/{meshFns-BEvGVcym.js → meshFns-D2gLyLFt.js} +3 -3
  53. package/dist/{meshFns-CJV_k_EQ.cjs → meshFns-DawUwI3W.cjs} +3 -3
  54. package/dist/{occtBoundary-CoXB2xvx.js → occtBoundary-CWzWqBCm.js} +436 -7
  55. package/dist/{occtBoundary-BFAaUtA7.cjs → occtBoundary-DH2VO-rq.cjs} +431 -2
  56. package/dist/operations/assemblyFns.d.ts +1 -0
  57. package/dist/operations/assemblyFns.d.ts.map +1 -1
  58. package/dist/operations/guidedSweepFns.d.ts +25 -0
  59. package/dist/operations/guidedSweepFns.d.ts.map +1 -0
  60. package/dist/operations/mateFns.d.ts +50 -0
  61. package/dist/operations/mateFns.d.ts.map +1 -0
  62. package/dist/operations/multiSweepFns.d.ts +32 -0
  63. package/dist/operations/multiSweepFns.d.ts.map +1 -0
  64. package/dist/operations/roofFns.d.ts +16 -0
  65. package/dist/operations/roofFns.d.ts.map +1 -0
  66. package/dist/operations/straightSkeleton.d.ts +28 -0
  67. package/dist/operations/straightSkeleton.d.ts.map +1 -0
  68. package/dist/{operations-CYGNxn5D.cjs → operations-CdELWxgv.cjs} +7 -7
  69. package/dist/{operations-B314mytX.js → operations-DiXo_4t9.js} +15 -15
  70. package/dist/operations.cjs +2 -2
  71. package/dist/operations.js +13 -13
  72. package/dist/query.cjs +5 -5
  73. package/dist/query.js +7 -7
  74. package/dist/result.cjs +1 -1
  75. package/dist/result.js +1 -1
  76. package/dist/{shapeFns-Z_ScEjmn.cjs → shapeFns-3RYtsUVY.cjs} +54 -21
  77. package/dist/{shapeFns-CWd_ASDV.js → shapeFns-4ioRrhih.js} +52 -19
  78. package/dist/{shapeTypes-UqVCIO_T.cjs → shapeTypes-CMjrTv36.cjs} +1 -1
  79. package/dist/{shapeTypes-BU2LKv2S.js → shapeTypes-D0vfRxWb.js} +13 -13
  80. package/dist/sketching.cjs +2 -2
  81. package/dist/sketching.js +2 -2
  82. package/dist/{curveBuilders-CN72XaIQ.js → surfaceBuilders-B7Jxob8g.js} +106 -13
  83. package/dist/{curveBuilders-Du03_Yyf.cjs → surfaceBuilders-Xx9DRRxs.cjs} +96 -3
  84. package/dist/text/textBlueprints.d.ts +38 -0
  85. package/dist/text/textBlueprints.d.ts.map +1 -1
  86. package/dist/topology/api.d.ts +5 -0
  87. package/dist/topology/api.d.ts.map +1 -1
  88. package/dist/topology/booleanFns.d.ts +10 -1
  89. package/dist/topology/booleanFns.d.ts.map +1 -1
  90. package/dist/topology/colorFns.d.ts +38 -0
  91. package/dist/topology/colorFns.d.ts.map +1 -0
  92. package/dist/topology/curveFns.d.ts +1 -1
  93. package/dist/topology/curveFns.d.ts.map +1 -1
  94. package/dist/topology/faceTagFns.d.ts +44 -0
  95. package/dist/topology/faceTagFns.d.ts.map +1 -0
  96. package/dist/topology/hullFns.d.ts +16 -0
  97. package/dist/topology/hullFns.d.ts.map +1 -0
  98. package/dist/topology/minkowskiFns.d.ts +20 -0
  99. package/dist/topology/minkowskiFns.d.ts.map +1 -0
  100. package/dist/topology/modifierFns.d.ts.map +1 -1
  101. package/dist/topology/polyhedronFns.d.ts +8 -0
  102. package/dist/topology/polyhedronFns.d.ts.map +1 -0
  103. package/dist/topology/shapeFns.d.ts +4 -0
  104. package/dist/topology/shapeFns.d.ts.map +1 -1
  105. package/dist/topology/surfaceBuilders.d.ts +7 -0
  106. package/dist/topology/surfaceBuilders.d.ts.map +1 -1
  107. package/dist/topology/surfaceFns.d.ts +38 -0
  108. package/dist/topology/surfaceFns.d.ts.map +1 -0
  109. package/dist/{topology-A7-jUtHB.cjs → topology-D-nGjCzV.cjs} +19 -20
  110. package/dist/{topology-BupialMm.js → topology-DRP9zreU.js} +8 -9
  111. package/dist/topology.cjs +13 -14
  112. package/dist/topology.js +51 -52
  113. package/dist/{vectors-BhfKwL9J.js → vectors-CZV4ZrTz.js} +2 -2
  114. package/dist/{vectors-t1XG4LpL.cjs → vectors-DwFeX0Ja.cjs} +2 -2
  115. package/dist/vectors.cjs +2 -2
  116. package/dist/vectors.js +2 -2
  117. package/package.json +8 -7
  118. package/dist/cast-C107o5ow.cjs +0 -102
  119. package/dist/cast-D0OhP1nV.js +0 -103
@@ -1042,7 +1042,7 @@ function makeWire(oc, edges) {
1042
1042
  progress.delete();
1043
1043
  return wire;
1044
1044
  }
1045
- function makeFace(oc, wire, planar = true) {
1045
+ function makeFace$1(oc, wire, planar = true) {
1046
1046
  if (planar) {
1047
1047
  const builder2 = new oc.BRepBuilderAPI_MakeFace_15(wire, false);
1048
1048
  const face = builder2.Face();
@@ -1441,6 +1441,416 @@ function approximatePoints(oc, points, options = {}) {
1441
1441
  splineBuilder.delete();
1442
1442
  return edge;
1443
1443
  }
1444
+ function sub(a, b) {
1445
+ return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
1446
+ }
1447
+ function cross(a, b) {
1448
+ return {
1449
+ x: a.y * b.z - a.z * b.y,
1450
+ y: a.z * b.x - a.x * b.z,
1451
+ z: a.x * b.y - a.y * b.x
1452
+ };
1453
+ }
1454
+ function dot(a, b) {
1455
+ return a.x * b.x + a.y * b.y + a.z * b.z;
1456
+ }
1457
+ function lengthVec(v) {
1458
+ return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
1459
+ }
1460
+ function distSq(a, b) {
1461
+ const dx = a.x - b.x;
1462
+ const dy = a.y - b.y;
1463
+ const dz = a.z - b.z;
1464
+ return dx * dx + dy * dy + dz * dz;
1465
+ }
1466
+ function at(arr, i) {
1467
+ const v = arr[i];
1468
+ if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1469
+ return v;
1470
+ }
1471
+ function atN(arr, i) {
1472
+ const v = arr[i];
1473
+ if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1474
+ return v;
1475
+ }
1476
+ function makeFace(points, a, b, c) {
1477
+ const normal = cross(sub(at(points, b), at(points, a)), sub(at(points, c), at(points, a)));
1478
+ const len = lengthVec(normal);
1479
+ const n = len > 1e-14 ? { x: normal.x / len, y: normal.y / len, z: normal.z / len } : normal;
1480
+ return {
1481
+ a,
1482
+ b,
1483
+ c,
1484
+ normal: n,
1485
+ offset: dot(n, at(points, a)),
1486
+ alive: true,
1487
+ outsidePoints: []
1488
+ };
1489
+ }
1490
+ function signedDist(face, point) {
1491
+ return dot(face.normal, point) - face.offset;
1492
+ }
1493
+ function deduplicatePoints(points, tolerance) {
1494
+ const tolSq = tolerance * tolerance;
1495
+ const result = [];
1496
+ for (const p of points) {
1497
+ let isDuplicate = false;
1498
+ for (const q of result) {
1499
+ if (distSq(p, q) < tolSq) {
1500
+ isDuplicate = true;
1501
+ break;
1502
+ }
1503
+ }
1504
+ if (!isDuplicate) result.push(p);
1505
+ }
1506
+ return result;
1507
+ }
1508
+ function findInitialTetrahedron(points) {
1509
+ const n = points.length;
1510
+ if (n < 4) return null;
1511
+ let i0 = 0;
1512
+ let i1 = 1;
1513
+ let maxDist = distSq(at(points, 0), at(points, 1));
1514
+ for (let i = 0; i < n; i++) {
1515
+ for (let j = i + 1; j < n; j++) {
1516
+ const d = distSq(at(points, i), at(points, j));
1517
+ if (d > maxDist) {
1518
+ maxDist = d;
1519
+ i0 = i;
1520
+ i1 = j;
1521
+ }
1522
+ }
1523
+ }
1524
+ if (maxDist < 1e-20) return null;
1525
+ const lineDir = sub(at(points, i1), at(points, i0));
1526
+ let i2 = -1;
1527
+ let maxLineDist = -1;
1528
+ for (let i = 0; i < n; i++) {
1529
+ if (i === i0 || i === i1) continue;
1530
+ const v = sub(at(points, i), at(points, i0));
1531
+ const c = cross(lineDir, v);
1532
+ const d = dot(c, c);
1533
+ if (d > maxLineDist) {
1534
+ maxLineDist = d;
1535
+ i2 = i;
1536
+ }
1537
+ }
1538
+ if (i2 === -1 || maxLineDist < 1e-20) return null;
1539
+ const planeNormal = cross(
1540
+ sub(at(points, i1), at(points, i0)),
1541
+ sub(at(points, i2), at(points, i0))
1542
+ );
1543
+ const planeLen = lengthVec(planeNormal);
1544
+ if (planeLen < 1e-14) return null;
1545
+ const pn = {
1546
+ x: planeNormal.x / planeLen,
1547
+ y: planeNormal.y / planeLen,
1548
+ z: planeNormal.z / planeLen
1549
+ };
1550
+ const planeOffset = dot(pn, at(points, i0));
1551
+ let i3 = -1;
1552
+ let maxPlaneDist = -1;
1553
+ for (let i = 0; i < n; i++) {
1554
+ if (i === i0 || i === i1 || i === i2) continue;
1555
+ const d = Math.abs(dot(pn, at(points, i)) - planeOffset);
1556
+ if (d > maxPlaneDist) {
1557
+ maxPlaneDist = d;
1558
+ i3 = i;
1559
+ }
1560
+ }
1561
+ if (i3 === -1 || maxPlaneDist < 1e-14) return null;
1562
+ const sd = dot(pn, at(points, i3)) - planeOffset;
1563
+ if (sd > 0) {
1564
+ return [i0, i2, i1, i3];
1565
+ }
1566
+ return [i0, i1, i2, i3];
1567
+ }
1568
+ function quickHull(inputPoints, tolerance) {
1569
+ const points = deduplicatePoints(inputPoints, tolerance);
1570
+ if (points.length < 4) {
1571
+ throw new Error(
1572
+ points.length === 0 ? "No points provided for convex hull" : "Fewer than 4 non-coincident points; cannot form a 3D convex hull"
1573
+ );
1574
+ }
1575
+ const tet = findInitialTetrahedron(points);
1576
+ if (tet === null) {
1577
+ throw new Error("All points are coplanar; cannot form a 3D convex hull");
1578
+ }
1579
+ const [t0, t1, t2, t3] = tet;
1580
+ const centroid = {
1581
+ x: (at(points, t0).x + at(points, t1).x + at(points, t2).x + at(points, t3).x) / 4,
1582
+ y: (at(points, t0).y + at(points, t1).y + at(points, t2).y + at(points, t3).y) / 4,
1583
+ z: (at(points, t0).z + at(points, t1).z + at(points, t2).z + at(points, t3).z) / 4
1584
+ };
1585
+ function makeOutwardFace(a, b, c) {
1586
+ const face = makeFace(points, a, b, c);
1587
+ const faceCenter = {
1588
+ x: (at(points, a).x + at(points, b).x + at(points, c).x) / 3,
1589
+ y: (at(points, a).y + at(points, b).y + at(points, c).y) / 3,
1590
+ z: (at(points, a).z + at(points, b).z + at(points, c).z) / 3
1591
+ };
1592
+ const toCentroid = sub(centroid, faceCenter);
1593
+ if (dot(face.normal, toCentroid) > 0) {
1594
+ return makeFace(points, a, c, b);
1595
+ }
1596
+ return face;
1597
+ }
1598
+ const faces = [
1599
+ makeOutwardFace(t0, t1, t2),
1600
+ makeOutwardFace(t0, t2, t3),
1601
+ makeOutwardFace(t0, t3, t1),
1602
+ makeOutwardFace(t1, t3, t2)
1603
+ ];
1604
+ const tetSet = /* @__PURE__ */ new Set([t0, t1, t2, t3]);
1605
+ const epsilon = 1e-10;
1606
+ for (let i = 0; i < points.length; i++) {
1607
+ if (tetSet.has(i)) continue;
1608
+ for (const face of faces) {
1609
+ if (signedDist(face, at(points, i)) > epsilon) {
1610
+ face.outsidePoints.push(i);
1611
+ break;
1612
+ }
1613
+ }
1614
+ }
1615
+ for (let iteration = 0; iteration < points.length * 4; iteration++) {
1616
+ let currentFace = null;
1617
+ for (const face of faces) {
1618
+ if (face.alive && face.outsidePoints.length > 0) {
1619
+ currentFace = face;
1620
+ break;
1621
+ }
1622
+ }
1623
+ if (currentFace === null) break;
1624
+ let furthestIdx = atN(currentFace.outsidePoints, 0);
1625
+ let furthestDist = signedDist(currentFace, at(points, furthestIdx));
1626
+ for (let i = 1; i < currentFace.outsidePoints.length; i++) {
1627
+ const idx = atN(currentFace.outsidePoints, i);
1628
+ const d = signedDist(currentFace, at(points, idx));
1629
+ if (d > furthestDist) {
1630
+ furthestDist = d;
1631
+ furthestIdx = idx;
1632
+ }
1633
+ }
1634
+ const visibleFaces = [];
1635
+ for (const face of faces) {
1636
+ if (face.alive && signedDist(face, at(points, furthestIdx)) > epsilon) {
1637
+ visibleFaces.push(face);
1638
+ }
1639
+ }
1640
+ const edgeCount = /* @__PURE__ */ new Map();
1641
+ for (const face of visibleFaces) {
1642
+ const edges = [
1643
+ [face.a, face.b],
1644
+ [face.b, face.c],
1645
+ [face.c, face.a]
1646
+ ];
1647
+ for (const [ea, eb] of edges) {
1648
+ const key = ea < eb ? `${ea}-${eb}` : `${eb}-${ea}`;
1649
+ const entry = edgeCount.get(key);
1650
+ if (entry) {
1651
+ entry.count++;
1652
+ } else {
1653
+ edgeCount.set(key, { a: ea, b: eb, count: 1 });
1654
+ }
1655
+ }
1656
+ }
1657
+ const horizonEdges = [];
1658
+ for (const entry of edgeCount.values()) {
1659
+ if (entry.count === 1) {
1660
+ horizonEdges.push({ a: entry.a, b: entry.b });
1661
+ }
1662
+ }
1663
+ const orphanedPoints = [];
1664
+ for (const face of visibleFaces) {
1665
+ for (const idx of face.outsidePoints) {
1666
+ if (idx !== furthestIdx) {
1667
+ orphanedPoints.push(idx);
1668
+ }
1669
+ }
1670
+ face.alive = false;
1671
+ face.outsidePoints = [];
1672
+ }
1673
+ const newFaces = [];
1674
+ for (const edge of horizonEdges) {
1675
+ const newFaceObj = makeFace(points, edge.a, edge.b, furthestIdx);
1676
+ newFaces.push(newFaceObj);
1677
+ faces.push(newFaceObj);
1678
+ }
1679
+ for (const idx of orphanedPoints) {
1680
+ for (const face of newFaces) {
1681
+ if (signedDist(face, at(points, idx)) > epsilon) {
1682
+ face.outsidePoints.push(idx);
1683
+ break;
1684
+ }
1685
+ }
1686
+ }
1687
+ }
1688
+ const resultFaces = [];
1689
+ for (const face of faces) {
1690
+ if (face.alive) {
1691
+ resultFaces.push([face.a, face.b, face.c]);
1692
+ }
1693
+ }
1694
+ return { faces: resultFaces, points };
1695
+ }
1696
+ function extractVertices(oc, shapes, tolerance) {
1697
+ const vertices = [];
1698
+ const meshDeflection = Math.max(tolerance, 1);
1699
+ for (const shape of shapes) {
1700
+ const mesh2 = new oc.BRepMesh_IncrementalMesh_2(
1701
+ shape,
1702
+ meshDeflection,
1703
+ false,
1704
+ meshDeflection * 0.5,
1705
+ false
1706
+ );
1707
+ const progress = new oc.Message_ProgressRange_1();
1708
+ mesh2.Perform(progress);
1709
+ progress.delete();
1710
+ mesh2.delete();
1711
+ const explorer = new oc.TopExp_Explorer_2(
1712
+ shape,
1713
+ oc.TopAbs_ShapeEnum.TopAbs_FACE,
1714
+ oc.TopAbs_ShapeEnum.TopAbs_SHAPE
1715
+ );
1716
+ while (explorer.More()) {
1717
+ const face = oc.TopoDS.Face_1(explorer.Current());
1718
+ const location = new oc.TopLoc_Location_1();
1719
+ const tri = oc.BRep_Tool.Triangulation(face, location, 0);
1720
+ if (!tri.IsNull()) {
1721
+ const trsf = location.Transformation();
1722
+ const nbNodes = tri.get().NbNodes();
1723
+ for (let i = 1; i <= nbNodes; i++) {
1724
+ const node = tri.get().Node(i);
1725
+ const transformed = node.Transformed(trsf);
1726
+ vertices.push({
1727
+ x: transformed.X(),
1728
+ y: transformed.Y(),
1729
+ z: transformed.Z()
1730
+ });
1731
+ transformed.delete();
1732
+ node.delete();
1733
+ }
1734
+ trsf.delete();
1735
+ }
1736
+ location.delete();
1737
+ explorer.Next();
1738
+ }
1739
+ explorer.delete();
1740
+ }
1741
+ return vertices;
1742
+ }
1743
+ function buildTriFace(oc, pa, pb, pc) {
1744
+ const gpA = new oc.gp_Pnt_3(pa.x, pa.y, pa.z);
1745
+ const gpB = new oc.gp_Pnt_3(pb.x, pb.y, pb.z);
1746
+ const gpC = new oc.gp_Pnt_3(pc.x, pc.y, pc.z);
1747
+ const e1 = new oc.BRepBuilderAPI_MakeEdge_3(gpA, gpB);
1748
+ const e2 = new oc.BRepBuilderAPI_MakeEdge_3(gpB, gpC);
1749
+ const e3 = new oc.BRepBuilderAPI_MakeEdge_3(gpC, gpA);
1750
+ const wireBuilder = new oc.BRepBuilderAPI_MakeWire_1();
1751
+ wireBuilder.Add_1(e1.Edge());
1752
+ wireBuilder.Add_1(e2.Edge());
1753
+ wireBuilder.Add_1(e3.Edge());
1754
+ let face = null;
1755
+ if (wireBuilder.IsDone()) {
1756
+ const makeFaceBuilder = new oc.BRepBuilderAPI_MakeFace_15(wireBuilder.Wire(), false);
1757
+ if (makeFaceBuilder.IsDone()) {
1758
+ face = makeFaceBuilder.Face();
1759
+ }
1760
+ makeFaceBuilder.delete();
1761
+ }
1762
+ wireBuilder.delete();
1763
+ e1.delete();
1764
+ e2.delete();
1765
+ e3.delete();
1766
+ gpA.delete();
1767
+ gpB.delete();
1768
+ gpC.delete();
1769
+ return face;
1770
+ }
1771
+ function reconstructBrep(oc, hullResult, tolerance) {
1772
+ const { faces: hullFaces, points } = hullResult;
1773
+ const ocFaces = [];
1774
+ for (const [ia, ib, ic] of hullFaces) {
1775
+ const face = buildTriFace(oc, at(points, ia), at(points, ib), at(points, ic));
1776
+ if (face !== null) {
1777
+ ocFaces.push(face);
1778
+ }
1779
+ }
1780
+ if (ocFaces.length < 4) {
1781
+ throw new Error(`hull: only ${ocFaces.length} faces built, need at least 4 for a solid`);
1782
+ }
1783
+ const sewTolerance = Math.max(tolerance, 1e-4);
1784
+ const sewing = new oc.BRepBuilderAPI_Sewing(sewTolerance, true, true, true, false);
1785
+ for (const face of ocFaces) {
1786
+ sewing.Add(face);
1787
+ }
1788
+ const sewProgress = new oc.Message_ProgressRange_1();
1789
+ sewing.Perform(sewProgress);
1790
+ sewProgress.delete();
1791
+ const sewn = sewing.SewedShape();
1792
+ sewing.delete();
1793
+ const shellExplorer = new oc.TopExp_Explorer_2(
1794
+ sewn,
1795
+ oc.TopAbs_ShapeEnum.TopAbs_SHELL,
1796
+ oc.TopAbs_ShapeEnum.TopAbs_SHAPE
1797
+ );
1798
+ if (shellExplorer.More()) {
1799
+ const shell2 = oc.TopoDS.Shell_1(shellExplorer.Current());
1800
+ shellExplorer.delete();
1801
+ const solidMaker = new oc.BRepBuilderAPI_MakeSolid_1();
1802
+ solidMaker.Add(shell2);
1803
+ const solidProgress = new oc.Message_ProgressRange_1();
1804
+ solidMaker.Build(solidProgress);
1805
+ solidProgress.delete();
1806
+ if (solidMaker.IsDone()) {
1807
+ const solid = solidMaker.Solid();
1808
+ solidMaker.delete();
1809
+ shell2.delete();
1810
+ const props = new oc.GProp_GProps_1();
1811
+ oc.BRepGProp.VolumeProperties_1(solid, props, false, false, false);
1812
+ const vol = props.Mass();
1813
+ props.delete();
1814
+ if (vol < 0) {
1815
+ solid.Complement();
1816
+ }
1817
+ return solid;
1818
+ }
1819
+ shell2.delete();
1820
+ solidMaker.delete();
1821
+ return sewn;
1822
+ }
1823
+ shellExplorer.delete();
1824
+ return sewn;
1825
+ }
1826
+ function hull(oc, shapes, tolerance) {
1827
+ if (shapes.length === 0) {
1828
+ throw new Error("hull: no shapes provided");
1829
+ }
1830
+ const vertices = extractVertices(oc, shapes, tolerance);
1831
+ if (vertices.length < 4) {
1832
+ throw new Error("hull: fewer than 4 vertices extracted from input shapes");
1833
+ }
1834
+ const hullResult = quickHull(vertices, tolerance);
1835
+ if (hullResult.faces.length < 4) {
1836
+ throw new Error("hull: degenerate hull (fewer than 4 faces)");
1837
+ }
1838
+ return reconstructBrep(oc, hullResult, tolerance);
1839
+ }
1840
+ function buildSolidFromFaces(oc, points, faces, tolerance) {
1841
+ const hullResult = { points, faces };
1842
+ return reconstructBrep(oc, hullResult, tolerance);
1843
+ }
1844
+ function hullFromPoints(oc, points, tolerance) {
1845
+ if (points.length < 4) {
1846
+ throw new Error("hullFromPoints: fewer than 4 points");
1847
+ }
1848
+ const hullResult = quickHull(points, tolerance);
1849
+ if (hullResult.faces.length < 4) {
1850
+ throw new Error("hullFromPoints: degenerate hull (fewer than 4 faces)");
1851
+ }
1852
+ return reconstructBrep(oc, hullResult, tolerance);
1853
+ }
1444
1854
  class OCCTAdapter {
1445
1855
  oc;
1446
1856
  constructor(oc) {
@@ -1465,6 +1875,25 @@ class OCCTAdapter {
1465
1875
  cutAll(shape, tools, options = {}) {
1466
1876
  return cutAll(this.oc, shape, tools, options);
1467
1877
  }
1878
+ // --- Convex hull ---
1879
+ hull(shapes, tolerance) {
1880
+ return hull(this.oc, shapes, tolerance);
1881
+ }
1882
+ hullFromPoints(points, tolerance) {
1883
+ return hullFromPoints(
1884
+ this.oc,
1885
+ points.map((p) => ({ x: p.x, y: p.y, z: p.z })),
1886
+ tolerance
1887
+ );
1888
+ }
1889
+ buildSolidFromFaces(points, faces, tolerance) {
1890
+ return buildSolidFromFaces(
1891
+ this.oc,
1892
+ points.map((p) => ({ x: p.x, y: p.y, z: p.z })),
1893
+ faces,
1894
+ tolerance
1895
+ );
1896
+ }
1468
1897
  // --- Shape construction (delegates to constructorOps.ts) ---
1469
1898
  makeVertex(x, y, z) {
1470
1899
  return makeVertex(this.oc, x, y, z);
@@ -1476,7 +1905,7 @@ class OCCTAdapter {
1476
1905
  return makeWire(this.oc, edges);
1477
1906
  }
1478
1907
  makeFace(wire, planar = true) {
1479
- return makeFace(this.oc, wire, planar);
1908
+ return makeFace$1(this.oc, wire, planar);
1480
1909
  }
1481
1910
  makeBox(width, height, depth) {
1482
1911
  return makeBox(this.oc, width, height, depth);
@@ -10,6 +10,7 @@ export interface AssemblyNode {
10
10
  };
11
11
  readonly metadata?: Readonly<Record<string, unknown>>;
12
12
  readonly children: ReadonlyArray<AssemblyNode>;
13
+ readonly mates?: readonly unknown[];
13
14
  }
14
15
  export interface AssemblyNodeOptions {
15
16
  shape?: AnyShape;
@@ -1 +1 @@
1
- {"version":3,"file":"assemblyFns.d.ts","sourceRoot":"","sources":["../../src/operations/assemblyFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD,kCAAkC;AAClC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAShG;AAMD,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAEhF;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAMjF;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACpC,YAAY,CAQd;AAMD,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAOnF;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACpD,KAAK,SAAI,GACR,IAAI,CAKN;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAMrD;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,CAM5D"}
1
+ {"version":3,"file":"assemblyFns.d.ts","sourceRoot":"","sources":["../../src/operations/assemblyFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD,kCAAkC;AAClC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAShG;AAMD,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAEhF;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAMjF;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACpC,YAAY,CAQd;AAMD,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAOnF;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACpD,KAAK,SAAI,GACR,IAAI,CAKN;AAED,mCAAmC;AACnC,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAMrD;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE,CAM5D"}
@@ -0,0 +1,25 @@
1
+ import { Wire, Solid, Shell } from '../core/shapeTypes.js';
2
+ import { Result } from '../core/result.js';
3
+ /** Options for guide curve sweep. */
4
+ export interface GuidedSweepOptions {
5
+ /** Transition mode at spine vertices. Defaults to 'transformed'. */
6
+ transition?: 'transformed' | 'round' | 'right';
7
+ /** Produce a solid (true) or shell (false). Defaults to true. */
8
+ solid?: boolean;
9
+ /** Builder tolerance. When set, passed to SetTolerance. */
10
+ tolerance?: number;
11
+ }
12
+ /**
13
+ * Sweep a profile wire along a spine, using guide wires to control shape evolution.
14
+ *
15
+ * The first guide wire is used as an auxiliary spine via `SetMode_5`, which
16
+ * controls how the profile orientation evolves along the path.
17
+ *
18
+ * @param profile - The cross-section wire to sweep.
19
+ * @param spine - The path wire to sweep along.
20
+ * @param guides - Guide wires controlling profile evolution. First guide is used as auxiliary spine.
21
+ * @param options - Sweep configuration.
22
+ * @returns Result containing the swept Solid or Shell.
23
+ */
24
+ export declare function guidedSweep(profile: Wire, spine: Wire, guides: ReadonlyArray<Wire>, options?: GuidedSweepOptions): Result<Solid | Shell>;
25
+ //# sourceMappingURL=guidedSweepFns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidedSweepFns.d.ts","sourceRoot":"","sources":["../../src/operations/guidedSweepFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAGzD,qCAAqC;AACrC,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,UAAU,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;IAC/C,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,EAC3B,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAiDvB"}
@@ -0,0 +1,50 @@
1
+ import { Face, Edge } from '../core/shapeTypes.js';
2
+ import { Vec3 } from '../core/types.js';
3
+ import { Result } from '../core/result.js';
4
+ import { AssemblyNode } from './assemblyFns.js';
5
+ export interface MateEntity {
6
+ node: string;
7
+ face?: Face;
8
+ edge?: Edge;
9
+ point?: Vec3;
10
+ }
11
+ export type MateConstraint = {
12
+ type: 'coincident';
13
+ entityA: MateEntity;
14
+ entityB: MateEntity;
15
+ } | {
16
+ type: 'concentric';
17
+ axisA: MateEntity;
18
+ axisB: MateEntity;
19
+ } | {
20
+ type: 'distance';
21
+ entityA: MateEntity;
22
+ entityB: MateEntity;
23
+ distance: number;
24
+ } | {
25
+ type: 'angle';
26
+ entityA: MateEntity;
27
+ entityB: MateEntity;
28
+ angle: number;
29
+ } | {
30
+ type: 'fixed';
31
+ entity: MateEntity;
32
+ };
33
+ export interface AssemblySolveResult {
34
+ transforms: Map<string, {
35
+ position: Vec3;
36
+ rotation: [number, number, number, number];
37
+ }>;
38
+ dof: number;
39
+ converged: boolean;
40
+ }
41
+ /**
42
+ * Add a mate constraint to an assembly.
43
+ * Returns a new assembly node with the constraint added.
44
+ */
45
+ export declare function addMate(assembly: AssemblyNode, constraint: MateConstraint): AssemblyNode;
46
+ /**
47
+ * Solve all mate constraints and compute part transforms.
48
+ */
49
+ export declare function solveAssembly(assembly: AssemblyNode): Result<AssemblySolveResult>;
50
+ //# sourceMappingURL=mateFns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mateFns.d.ts","sourceRoot":"","sources":["../../src/operations/mateFns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAarD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAChF;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;IACxF,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;CACpB;AAyBD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,GAAG,YAAY,CAGxF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAAC,mBAAmB,CAAC,CA0HjF"}
@@ -0,0 +1,32 @@
1
+ import { Wire, Solid, Shell } from '../core/shapeTypes.js';
2
+ import { Result } from '../core/result.js';
3
+ /** Configuration for a single sweep section (profile wire + optional location). */
4
+ export interface SweepSectionConfig {
5
+ /** The profile wire for this section. */
6
+ wire: Wire;
7
+ /** Location along the spine as a parameter in [0.0, 1.0]. Auto-distributed if omitted. */
8
+ location?: number;
9
+ }
10
+ /** Options for the multi-section sweep operation. */
11
+ export interface MultiSweepOptions {
12
+ /** Produce a solid (true) or shell (false). Defaults to true. */
13
+ solid?: boolean;
14
+ /** Use ruled (straight) interpolation between sections. Defaults to false. */
15
+ ruled?: boolean;
16
+ /** Tolerance for the loft builder. Defaults to 1e-6. */
17
+ tolerance?: number;
18
+ }
19
+ /**
20
+ * Sweep multiple profile sections along a spine wire.
21
+ *
22
+ * Each section wire is positioned at a point along the spine (either at an
23
+ * explicit `location` parameter or auto-distributed evenly). The profiles
24
+ * are then lofted using `BRepOffsetAPI_ThruSections`.
25
+ *
26
+ * @param sections - At least 2 section configs with profile wires.
27
+ * @param spine - The path wire to sweep along.
28
+ * @param options - Sweep configuration.
29
+ * @returns Result containing the swept Solid or Shell.
30
+ */
31
+ export declare function multiSectionSweep(sections: ReadonlyArray<SweepSectionConfig>, spine: Wire, options?: MultiSweepOptions): Result<Solid | Shell>;
32
+ //# sourceMappingURL=multiSweepFns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiSweepFns.d.ts","sourceRoot":"","sources":["../../src/operations/multiSweepFns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGhE,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAGzD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,IAAI,EAAE,IAAI,CAAC;IACX,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAC3C,KAAK,EAAE,IAAI,EACX,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAkFvB"}
@@ -0,0 +1,16 @@
1
+ import { Wire, Solid } from '../core/shapeTypes.js';
2
+ import { Result } from '../core/result.js';
3
+ export interface RoofOptions {
4
+ /** Roof slope angle in degrees (default: 45). */
5
+ readonly angle?: number;
6
+ }
7
+ /**
8
+ * Create a roof solid from a planar wire using the straight skeleton algorithm.
9
+ * Each polygon edge produces a sloped face rising toward the skeleton ridge.
10
+ *
11
+ * @param w - A planar wire defining the roof footprint
12
+ * @param options - Optional angle (degrees) for the roof slope
13
+ * @returns A Result containing the roof Solid, or an error
14
+ */
15
+ export declare function roof(w: Wire, options?: RoofOptions): Result<Solid>;
16
+ //# sourceMappingURL=roofFns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roofFns.d.ts","sourceRoot":"","sources":["../../src/operations/roofFns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAWzD,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAmFD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CA4HlE"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Pure TypeScript straight skeleton algorithm for simple polygons.
3
+ * No OCCT dependency — operates on 2D point arrays.
4
+ */
5
+ export interface SkPoint2D {
6
+ readonly x: number;
7
+ readonly y: number;
8
+ }
9
+ export interface SkeletonNode {
10
+ readonly x: number;
11
+ readonly y: number;
12
+ readonly height: number;
13
+ }
14
+ export interface SkeletonFace {
15
+ readonly vertices: SkPoint2D[];
16
+ readonly heights: number[];
17
+ }
18
+ export interface StraightSkeleton {
19
+ readonly nodes: SkeletonNode[];
20
+ readonly faces: SkeletonFace[];
21
+ }
22
+ /**
23
+ * Compute the straight skeleton of a simple polygon.
24
+ * The polygon vertices must define a simple (non-self-intersecting) polygon.
25
+ * They will be reordered to CCW if necessary.
26
+ */
27
+ export declare function computeStraightSkeleton(polygon: SkPoint2D[]): StraightSkeleton;
28
+ //# sourceMappingURL=straightSkeleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"straightSkeleton.d.ts","sourceRoot":"","sources":["../../src/operations/straightSkeleton.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;CAChC;AA+PD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAiO9E"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
- const occtBoundary = require("./occtBoundary-BFAaUtA7.cjs");
2
+ const occtBoundary = require("./occtBoundary-DH2VO-rq.cjs");
3
3
  const vecOps = require("./vecOps-CjRL1jau.cjs");
4
- const shapeTypes = require("./shapeTypes-UqVCIO_T.cjs");
5
- const cast = require("./cast-C107o5ow.cjs");
6
- const errors = require("./errors-DK1VAdP4.cjs");
7
- const loft = require("./loft-PMRx9iMG.cjs");
8
- const booleanFns = require("./booleanFns-Cd414V3l.cjs");
4
+ const shapeTypes = require("./shapeTypes-CMjrTv36.cjs");
5
+ const faceFns = require("./faceFns-DcndPHWm.cjs");
6
+ const errors = require("./errors-eRQu29oc.cjs");
7
+ const loft = require("./loft-BcyyvWCj.cjs");
8
+ const booleanFns = require("./booleanFns-NtKxkiXn.cjs");
9
9
  function uuidv() {
10
10
  return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
11
11
  /[018]/g,
@@ -117,7 +117,7 @@ function extrude(face, extrusionVec) {
117
117
  const vec = r(occtBoundary.toOcVec(extrusionVec));
118
118
  const builder = r(new oc.BRepPrimAPI_MakePrism_1(face.wrapped, vec, false, true));
119
119
  const shape = builder.Shape();
120
- const downcastResult = cast.downcast(shape);
120
+ const downcastResult = faceFns.downcast(shape);
121
121
  if (errors.isErr(downcastResult)) {
122
122
  return downcastResult;
123
123
  }