brepjs 18.35.2 → 18.35.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 (88) hide show
  1. package/dist/2d.cjs +6 -6
  2. package/dist/2d.js +6 -6
  3. package/dist/{blueprint-BF0DcVwE.cjs → blueprint-C9feKfjM.cjs} +5 -5
  4. package/dist/{blueprint-KwH2JNPU.js → blueprint-PV2EbBko.js} +5 -5
  5. package/dist/{blueprintFns-X7jVGGUE.js → blueprintFns-CohoA3Ly.js} +2 -2
  6. package/dist/{blueprintFns-CbPsMijw.cjs → blueprintFns-Diu8oFPr.cjs} +2 -2
  7. package/dist/{blueprintSketcher-m18T1U1T.cjs → blueprintSketcher-B1TC4tuf.cjs} +3 -3
  8. package/dist/{blueprintSketcher-BwFpbp0B.js → blueprintSketcher-BC22SEkZ.js} +3 -3
  9. package/dist/{boolean2D-BzlbvCIH.cjs → boolean2D-CHza20uz.cjs} +4 -4
  10. package/dist/{boolean2D-DAq015PP.js → boolean2D-D42Z6h-L.js} +4 -4
  11. package/dist/{booleanFns-D19tR8Gn.cjs → booleanFns-CCJFmZf6.cjs} +4 -4
  12. package/dist/{booleanFns-nHsLqZ7Y.js → booleanFns-D7A-hqSP.js} +4 -4
  13. package/dist/brepjs.cjs +25 -25
  14. package/dist/brepjs.js +25 -25
  15. package/dist/{cameraFns-Bhjy2SuC.js → cameraFns-BvZw_Bje.js} +2 -2
  16. package/dist/{cameraFns-D_8-JO0p.cjs → cameraFns-D79etXJw.cjs} +2 -2
  17. package/dist/core.cjs +1 -1
  18. package/dist/core.js +1 -1
  19. package/dist/{cornerFinder-U6kzoCXY.js → cornerFinder-BPz7nFlt.js} +1 -1
  20. package/dist/{cornerFinder-Bmp3Vm5g.cjs → cornerFinder-D3m1OkXN.cjs} +1 -1
  21. package/dist/{curveFns-rUkX4tEm.js → curveFns-BJNwNm66.js} +1 -1
  22. package/dist/{curveFns-p1YEnmZu.cjs → curveFns-CiI0h04W.cjs} +1 -1
  23. package/dist/{drawFns-BGIQ1IeV.cjs → drawFns-Cx7RJEdL.cjs} +12 -12
  24. package/dist/{drawFns-ZhKR7xa0.js → drawFns-E68sfFlE.js} +12 -12
  25. package/dist/{extrudeFns-Cl_azGgy.js → extrudeFns-D49C5SBL.js} +1 -1
  26. package/dist/{extrudeFns-DpRGUaxD.cjs → extrudeFns-DympFQua.cjs} +1 -1
  27. package/dist/{faceFns-C6qUr_gw.cjs → faceFns-3HqgY1VN.cjs} +2 -2
  28. package/dist/{faceFns-eVWgSIzt.js → faceFns-DLjTsZIu.js} +2 -2
  29. package/dist/{helpers-DNVILwHA.cjs → helpers-BSU8Ilxm.cjs} +6 -6
  30. package/dist/{helpers-BhJOo535.js → helpers-DI2r-O_h.js} +6 -6
  31. package/dist/{historyFns-ByJG4mBP.js → historyFns-D89ZUO18.js} +4 -4
  32. package/dist/{historyFns-C2glA6vu.cjs → historyFns-DoMVl9Wf.cjs} +4 -4
  33. package/dist/{importFns-DuAmdf0Q.js → importFns-CpKXeRz6.js} +2 -2
  34. package/dist/{importFns-CJc5NYJp.cjs → importFns-SQNeOpGa.cjs} +2 -2
  35. package/dist/io.cjs +2 -2
  36. package/dist/io.js +2 -2
  37. package/dist/kernel/hullGeometry.d.ts +22 -0
  38. package/dist/kernel/occt/hullOps.d.ts +1 -6
  39. package/dist/kernel/occtWasm/constructionOps.d.ts +1 -0
  40. package/dist/kernel/occtWasm/hullOps.d.ts +1 -5
  41. package/dist/kernel/occtWasm/ioOps.d.ts +1 -1
  42. package/dist/kernel/occtWasm/kernel2dOps.d.ts +7 -1
  43. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  44. package/dist/kernel/occtWasm/occtWasmAdapter.d.ts +1 -1
  45. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  46. package/dist/kernel/occtWasm/occtWasmTypes.d.ts +7 -2
  47. package/dist/kernel/occtWasm/sweepOps.d.ts +1 -1
  48. package/dist/{measureFns-BiflqrZ_.js → measureFns-BMSt38re.js} +3 -3
  49. package/dist/{measureFns-D7lxkIjt.cjs → measureFns-CG36omJ5.cjs} +3 -3
  50. package/dist/measurement.cjs +1 -1
  51. package/dist/measurement.js +1 -1
  52. package/dist/{meshFns-DM2mLIlu.cjs → meshFns-B08Sq0xg.cjs} +10 -3
  53. package/dist/{meshFns-F9QLm-Bk.js → meshFns-B6dmwjJL.js} +10 -3
  54. package/dist/{occtWasmAdapter-COKB8ItA.js → occtWasmAdapter-DfdUU9UU.js} +395 -171
  55. package/dist/{occtWasmAdapter-CdyaMnBW.cjs → occtWasmAdapter-ZiJfgmS1.cjs} +400 -170
  56. package/dist/operations.cjs +2 -2
  57. package/dist/operations.js +2 -2
  58. package/dist/{primitiveFns-vQh7Lz7B.js → primitiveFns-BD6YZbCJ.js} +7 -7
  59. package/dist/{primitiveFns-CXn9Jl4q.cjs → primitiveFns-DFnQlGVV.cjs} +7 -7
  60. package/dist/projection.cjs +1 -1
  61. package/dist/projection.js +1 -1
  62. package/dist/query.cjs +2 -2
  63. package/dist/query.js +2 -2
  64. package/dist/{shapeFns-BbHQjI5-.js → shapeFns-C8pitNme.js} +2 -2
  65. package/dist/{shapeFns-B3v9_keQ.cjs → shapeFns-CnNKfmw8.cjs} +2 -2
  66. package/dist/shapeRef.cjs +1 -1
  67. package/dist/shapeRef.js +1 -1
  68. package/dist/{shapeRefFns-BOsX8Tim.js → shapeRefFns-BQlYDeCD.js} +4 -4
  69. package/dist/{shapeRefFns-CkafUjdM.cjs → shapeRefFns-DtCBv52A.cjs} +4 -4
  70. package/dist/{shapeTypes-C-MpR5-e.js → shapeTypes-BKeiP62J.js} +3 -241
  71. package/dist/{shapeTypes-Bbh2doYh.cjs → shapeTypes-D5Nua1z1.cjs} +5 -243
  72. package/dist/sketching.cjs +3 -3
  73. package/dist/sketching.js +3 -3
  74. package/dist/{solidBuilders-Ck6gpdQR.cjs → solidBuilders-0ZZGbPt3.cjs} +2 -2
  75. package/dist/{solidBuilders-C44fKbQQ.js → solidBuilders-DjPCyWCd.js} +2 -2
  76. package/dist/{surfaceBuilders-DsISMCwj.cjs → surfaceBuilders-6QimO9vi.cjs} +2 -2
  77. package/dist/{surfaceBuilders-D4p1YPCz.js → surfaceBuilders-d4o4OoWy.js} +2 -2
  78. package/dist/text.cjs +2 -2
  79. package/dist/text.js +2 -2
  80. package/dist/{textBlueprints-C93RophN.cjs → textBlueprints-BUkh-dID.cjs} +7 -7
  81. package/dist/{textBlueprints-BKdQqBn8.js → textBlueprints-DOPJs2t6.js} +7 -7
  82. package/dist/{textMetrics-2vq4PFfz.cjs → textMetrics-DNQplzf7.cjs} +1 -1
  83. package/dist/{textMetrics-DEmVsP5C.js → textMetrics-h6jI-oL_.js} +1 -1
  84. package/dist/topology.cjs +7 -7
  85. package/dist/topology.js +7 -7
  86. package/dist/{topologyQueryFns-C0kAqcn5.cjs → topologyQueryFns-BNv_2PHm.cjs} +1 -1
  87. package/dist/{topologyQueryFns-B81GSST_.js → topologyQueryFns-DhdAOL0M.js} +1 -1
  88. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- const require_shapeTypes = require("./shapeTypes-Bbh2doYh.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Nua1z1.cjs");
2
2
  const require_errors = require("./errors-CXJtc4I7.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-C0kAqcn5.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-BNv_2PHm.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
- const require_faceFns = require("./faceFns-C6qUr_gw.cjs");
6
- const require_shapeFns = require("./shapeFns-B3v9_keQ.cjs");
5
+ const require_faceFns = require("./faceFns-3HqgY1VN.cjs");
6
+ const require_shapeFns = require("./shapeFns-CnNKfmw8.cjs");
7
7
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
8
- const require_surfaceBuilders = require("./surfaceBuilders-DsISMCwj.cjs");
9
- const require_booleanFns = require("./booleanFns-D19tR8Gn.cjs");
10
- const require_solidBuilders = require("./solidBuilders-Ck6gpdQR.cjs");
8
+ const require_surfaceBuilders = require("./surfaceBuilders-6QimO9vi.cjs");
9
+ const require_booleanFns = require("./booleanFns-CCJFmZf6.cjs");
10
+ const require_solidBuilders = require("./solidBuilders-0ZZGbPt3.cjs");
11
11
  //#region src/topology/threeHelpers.ts
12
12
  /**
13
13
  * Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cameraFns = require("./cameraFns-D_8-JO0p.cjs");
2
+ const require_cameraFns = require("./cameraFns-D79etXJw.cjs");
3
3
  exports.PROJECTION_PLANES = require_cameraFns.PROJECTION_PLANES;
4
4
  exports.cameraFromPlane = require_cameraFns.cameraFromPlane;
5
5
  exports.cameraLookAt = require_cameraFns.cameraLookAt;
@@ -1,2 +1,2 @@
1
- import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-Bhjy2SuC.js";
1
+ import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, o as PROJECTION_PLANES, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-BvZw_Bje.js";
2
2
  export { PROJECTION_PLANES, cameraFromPlane, cameraLookAt, createCamera, isProjectionPlane, makeProjectedEdges, projectEdges };
package/dist/query.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_helpers = require("./helpers-DNVILwHA.cjs");
3
- const require_cornerFinder = require("./cornerFinder-Bmp3Vm5g.cjs");
2
+ const require_helpers = require("./helpers-BSU8Ilxm.cjs");
3
+ const require_cornerFinder = require("./cornerFinder-D3m1OkXN.cjs");
4
4
  exports.cornerFinder = require_cornerFinder.cornerFinder;
5
5
  exports.edgeFinder = require_helpers.edgeFinder;
6
6
  exports.faceFinder = require_helpers.faceFinder;
package/dist/query.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-BhJOo535.js";
2
- import { t as cornerFinder } from "./cornerFinder-U6kzoCXY.js";
1
+ import { n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DI2r-O_h.js";
2
+ import { t as cornerFinder } from "./cornerFinder-BPz7nFlt.js";
3
3
  export { cornerFinder, edgeFinder, faceFinder, getSingleFace };
@@ -1,6 +1,6 @@
1
- import { Z as getKernel, t as castShape } from "./shapeTypes-C-MpR5-e.js";
1
+ import { Z as getKernel, t as castShape } from "./shapeTypes-BKeiP62J.js";
2
2
  import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
3
- import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-B81GSST_.js";
3
+ import { C as kernelCall, c as getFaces, l as getOrCreateCache, r as getCacheEntry, w as kernelCallRaw } from "./topologyQueryFns-DhdAOL0M.js";
4
4
  import { n as HASH_CODE_MAX, t as DEG2RAD } from "./constants-ITRzCnCp.js";
5
5
  //#region src/topology/metadata/originTrackingFns.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- const require_shapeTypes = require("./shapeTypes-Bbh2doYh.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Nua1z1.cjs");
2
2
  const require_errors = require("./errors-CXJtc4I7.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-C0kAqcn5.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-BNv_2PHm.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  //#region src/topology/metadata/originTrackingFns.ts
6
6
  /**
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_shapeRefFns = require("./shapeRefFns-CkafUjdM.cjs");
2
+ const require_shapeRefFns = require("./shapeRefFns-DtCBv52A.cjs");
3
3
  exports.assignRoles = require_shapeRefFns.assignRoles;
4
4
  exports.captureHint = require_shapeRefFns.captureHint;
5
5
  exports.createRef = require_shapeRefFns.createRef;
package/dist/shapeRef.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-BOsX8Tim.js";
1
+ import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-BQlYDeCD.js";
2
2
  export { assignRoles, captureHint, createRef, defaultScorer, resolveRef, updateRoles };
@@ -1,8 +1,8 @@
1
1
  import { n as wasmIndex } from "./vec3-Dpha8d5k.js";
2
- import { c as getFaces } from "./topologyQueryFns-B81GSST_.js";
3
- import { c as normalAt, n as faceCenter, r as faceGeomType } from "./faceFns-eVWgSIzt.js";
4
- import { n as getHashCode } from "./shapeFns-BbHQjI5-.js";
5
- import { n as measureArea } from "./measureFns-BiflqrZ_.js";
2
+ import { c as getFaces } from "./topologyQueryFns-DhdAOL0M.js";
3
+ import { c as normalAt, n as faceCenter, r as faceGeomType } from "./faceFns-DLjTsZIu.js";
4
+ import { n as getHashCode } from "./shapeFns-C8pitNme.js";
5
+ import { n as measureArea } from "./measureFns-BMSt38re.js";
6
6
  //#region src/topology/shapeRef/scoring.ts
7
7
  /**
8
8
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,8 +1,8 @@
1
1
  const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
2
- const require_topologyQueryFns = require("./topologyQueryFns-C0kAqcn5.cjs");
3
- const require_faceFns = require("./faceFns-C6qUr_gw.cjs");
4
- const require_shapeFns = require("./shapeFns-B3v9_keQ.cjs");
5
- const require_measureFns = require("./measureFns-D7lxkIjt.cjs");
2
+ const require_topologyQueryFns = require("./topologyQueryFns-BNv_2PHm.cjs");
3
+ const require_faceFns = require("./faceFns-3HqgY1VN.cjs");
4
+ const require_shapeFns = require("./shapeFns-CnNKfmw8.cjs");
5
+ const require_measureFns = require("./measureFns-CG36omJ5.cjs");
6
6
  //#region src/topology/shapeRef/scoring.ts
7
7
  /**
8
8
  * Default face scorer combining surface type, normal alignment, centroid proximity,
@@ -1,5 +1,5 @@
1
1
  import { n as wasmIndex, t as vec3At } from "./vec3-Dpha8d5k.js";
2
- import { _ as serializeCurve2d$2, a as curveTypeName, c as intersectCurves2dFn, d as makeEllipse2d$2, f as makeLine2d$2, g as scaleCurve2d$2, h as rotateCurve2d$2, i as curveBounds, l as makeBezier2d$2, m as mirrorAtPoint, n as addCurveToBBox, o as deserializeCurve2d$2, p as mirrorAcrossAxis, r as createBBox2d, s as evaluateCurve2d$2, u as makeCircle2d$2, v as tangentCurve2d, y as translateCurve2d$2 } from "./occtWasmAdapter-COKB8ItA.js";
2
+ import { _ as serializeCurve2d$2, a as curveTypeName, b as quickHull, c as intersectCurves2dFn, d as makeEllipse2d$2, f as makeLine2d$2, g as scaleCurve2d$2, h as rotateCurve2d$2, i as curveBounds, l as makeBezier2d$2, m as mirrorAtPoint, n as addCurveToBBox, o as deserializeCurve2d$2, p as mirrorAcrossAxis, r as createBBox2d, s as evaluateCurve2d$2, u as makeCircle2d$2, v as tangentCurve2d, y as translateCurve2d$2 } from "./occtWasmAdapter-DfdUU9UU.js";
3
3
  import { A as ok, b as err } from "./errors-DNWJsfVU.js";
4
4
  //#region src/kernel/kernel2dTypes.ts
5
5
  /** Check if the kernel supports 2D geometry operations. */
@@ -866,7 +866,7 @@ function makeWire$1(oc, edges) {
866
866
  * Creates a face from a wire.
867
867
  * If planar is true, creates a planar face. Otherwise creates a non-planar filling surface.
868
868
  */
869
- function makeFace$2(oc, wire, planar = true) {
869
+ function makeFace$1(oc, wire, planar = true) {
870
870
  if (planar) {
871
871
  const builder = new oc.BRepBuilderAPI_MakeFace_15(wire, false);
872
872
  const face = builder.Face();
@@ -1038,7 +1038,7 @@ function makeConstructorOps(oc) {
1038
1038
  makeEdge: (curve, start, end) => makeEdge$1(oc, curve, start, end),
1039
1039
  makeWire: (edges) => makeWire$1(oc, edges),
1040
1040
  makeWireFromMixed: (items) => makeWireFromMixed$1(oc, items),
1041
- makeFace: (wire, planar) => makeFace$2(oc, wire, planar),
1041
+ makeFace: (wire, planar) => makeFace$1(oc, wire, planar),
1042
1042
  makeBox: (w, h, d) => makeBox$1(oc, w, h, d),
1043
1043
  makeCylinder: (radius, height, center, direction) => makeCylinder$1(oc, radius, height, center, direction),
1044
1044
  makeSphere: (radius, center) => makeSphere$1(oc, radius, center),
@@ -1049,250 +1049,12 @@ function makeConstructorOps(oc) {
1049
1049
  }
1050
1050
  //#endregion
1051
1051
  //#region src/kernel/occt/hullOps.ts
1052
- function sub$1(a, b) {
1053
- return {
1054
- x: a.x - b.x,
1055
- y: a.y - b.y,
1056
- z: a.z - b.z
1057
- };
1058
- }
1059
- function cross$1(a, b) {
1060
- return {
1061
- x: a.y * b.z - a.z * b.y,
1062
- y: a.z * b.x - a.x * b.z,
1063
- z: a.x * b.y - a.y * b.x
1064
- };
1065
- }
1066
- function dot$1(a, b) {
1067
- return a.x * b.x + a.y * b.y + a.z * b.z;
1068
- }
1069
- function lengthVec(v) {
1070
- return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
1071
- }
1072
- function distSq(a, b) {
1073
- const dx = a.x - b.x;
1074
- const dy = a.y - b.y;
1075
- const dz = a.z - b.z;
1076
- return dx * dx + dy * dy + dz * dz;
1077
- }
1078
1052
  /** Safe array access — throws on out-of-bounds instead of returning undefined. */
1079
1053
  function at(arr, i) {
1080
1054
  const v = arr[i];
1081
1055
  if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1082
1056
  return v;
1083
1057
  }
1084
- /** Safe number array access. */
1085
- function atN(arr, i) {
1086
- const v = arr[i];
1087
- if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1088
- return v;
1089
- }
1090
- function makeFace$1(points, a, b, c) {
1091
- const normal = cross$1(sub$1(at(points, b), at(points, a)), sub$1(at(points, c), at(points, a)));
1092
- const len = lengthVec(normal);
1093
- const n = len > 1e-14 ? {
1094
- x: normal.x / len,
1095
- y: normal.y / len,
1096
- z: normal.z / len
1097
- } : normal;
1098
- return {
1099
- a,
1100
- b,
1101
- c,
1102
- normal: n,
1103
- offset: dot$1(n, at(points, a)),
1104
- alive: true,
1105
- outsidePoints: []
1106
- };
1107
- }
1108
- function signedDist(face, point) {
1109
- return dot$1(face.normal, point) - face.offset;
1110
- }
1111
- function deduplicatePoints(points, tolerance) {
1112
- const tolSq = tolerance * tolerance;
1113
- const result = [];
1114
- for (const p of points) {
1115
- let isDuplicate = false;
1116
- for (const q of result) if (distSq(p, q) < tolSq) {
1117
- isDuplicate = true;
1118
- break;
1119
- }
1120
- if (!isDuplicate) result.push(p);
1121
- }
1122
- return result;
1123
- }
1124
- function findInitialTetrahedron(points) {
1125
- const n = points.length;
1126
- if (n < 4) return null;
1127
- let i0 = 0;
1128
- let i1 = 1;
1129
- let maxDist = distSq(at(points, 0), at(points, 1));
1130
- for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) {
1131
- const d = distSq(at(points, i), at(points, j));
1132
- if (d > maxDist) {
1133
- maxDist = d;
1134
- i0 = i;
1135
- i1 = j;
1136
- }
1137
- }
1138
- if (maxDist < 1e-20) return null;
1139
- const lineDir = sub$1(at(points, i1), at(points, i0));
1140
- let i2 = -1;
1141
- let maxLineDist = -1;
1142
- for (let i = 0; i < n; i++) {
1143
- if (i === i0 || i === i1) continue;
1144
- const c = cross$1(lineDir, sub$1(at(points, i), at(points, i0)));
1145
- const d = dot$1(c, c);
1146
- if (d > maxLineDist) {
1147
- maxLineDist = d;
1148
- i2 = i;
1149
- }
1150
- }
1151
- if (i2 === -1 || maxLineDist < 1e-20) return null;
1152
- const planeNormal = cross$1(sub$1(at(points, i1), at(points, i0)), sub$1(at(points, i2), at(points, i0)));
1153
- const planeLen = lengthVec(planeNormal);
1154
- if (planeLen < 1e-14) return null;
1155
- const pn = {
1156
- x: planeNormal.x / planeLen,
1157
- y: planeNormal.y / planeLen,
1158
- z: planeNormal.z / planeLen
1159
- };
1160
- const planeOffset = dot$1(pn, at(points, i0));
1161
- let i3 = -1;
1162
- let maxPlaneDist = -1;
1163
- for (let i = 0; i < n; i++) {
1164
- if (i === i0 || i === i1 || i === i2) continue;
1165
- const d = Math.abs(dot$1(pn, at(points, i)) - planeOffset);
1166
- if (d > maxPlaneDist) {
1167
- maxPlaneDist = d;
1168
- i3 = i;
1169
- }
1170
- }
1171
- if (i3 === -1 || maxPlaneDist < 1e-14) return null;
1172
- if (dot$1(pn, at(points, i3)) - planeOffset > 0) return [
1173
- i0,
1174
- i2,
1175
- i1,
1176
- i3
1177
- ];
1178
- return [
1179
- i0,
1180
- i1,
1181
- i2,
1182
- i3
1183
- ];
1184
- }
1185
- function quickHull(inputPoints, tolerance) {
1186
- const points = deduplicatePoints(inputPoints, tolerance);
1187
- if (points.length < 4) throw new Error(points.length === 0 ? "No points provided for convex hull" : "Fewer than 4 non-coincident points; cannot form a 3D convex hull");
1188
- const tet = findInitialTetrahedron(points);
1189
- if (tet === null) throw new Error("All points are coplanar; cannot form a 3D convex hull");
1190
- const [t0, t1, t2, t3] = tet;
1191
- const centroid = {
1192
- x: (at(points, t0).x + at(points, t1).x + at(points, t2).x + at(points, t3).x) / 4,
1193
- y: (at(points, t0).y + at(points, t1).y + at(points, t2).y + at(points, t3).y) / 4,
1194
- z: (at(points, t0).z + at(points, t1).z + at(points, t2).z + at(points, t3).z) / 4
1195
- };
1196
- function makeOutwardFace(a, b, c) {
1197
- const face = makeFace$1(points, a, b, c);
1198
- const toCentroid = sub$1(centroid, {
1199
- x: (at(points, a).x + at(points, b).x + at(points, c).x) / 3,
1200
- y: (at(points, a).y + at(points, b).y + at(points, c).y) / 3,
1201
- z: (at(points, a).z + at(points, b).z + at(points, c).z) / 3
1202
- });
1203
- if (dot$1(face.normal, toCentroid) > 0) return makeFace$1(points, a, c, b);
1204
- return face;
1205
- }
1206
- const faces = [
1207
- makeOutwardFace(t0, t1, t2),
1208
- makeOutwardFace(t0, t2, t3),
1209
- makeOutwardFace(t0, t3, t1),
1210
- makeOutwardFace(t1, t3, t2)
1211
- ];
1212
- const tetSet = new Set([
1213
- t0,
1214
- t1,
1215
- t2,
1216
- t3
1217
- ]);
1218
- const epsilon = 1e-10;
1219
- for (let i = 0; i < points.length; i++) {
1220
- if (tetSet.has(i)) continue;
1221
- for (const face of faces) if (signedDist(face, at(points, i)) > epsilon) {
1222
- face.outsidePoints.push(i);
1223
- break;
1224
- }
1225
- }
1226
- for (let iteration = 0; iteration < points.length * 4; iteration++) {
1227
- let currentFace = null;
1228
- for (const face of faces) if (face.alive && face.outsidePoints.length > 0) {
1229
- currentFace = face;
1230
- break;
1231
- }
1232
- if (currentFace === null) break;
1233
- let furthestIdx = atN(currentFace.outsidePoints, 0);
1234
- let furthestDist = signedDist(currentFace, at(points, furthestIdx));
1235
- for (let i = 1; i < currentFace.outsidePoints.length; i++) {
1236
- const idx = atN(currentFace.outsidePoints, i);
1237
- const d = signedDist(currentFace, at(points, idx));
1238
- if (d > furthestDist) {
1239
- furthestDist = d;
1240
- furthestIdx = idx;
1241
- }
1242
- }
1243
- const visibleFaces = [];
1244
- for (const face of faces) if (face.alive && signedDist(face, at(points, furthestIdx)) > epsilon) visibleFaces.push(face);
1245
- const edgeCount = /* @__PURE__ */ new Map();
1246
- for (const face of visibleFaces) {
1247
- const edges = [
1248
- [face.a, face.b],
1249
- [face.b, face.c],
1250
- [face.c, face.a]
1251
- ];
1252
- for (const [ea, eb] of edges) {
1253
- const key = ea < eb ? `${ea}-${eb}` : `${eb}-${ea}`;
1254
- const entry = edgeCount.get(key);
1255
- if (entry) entry.count++;
1256
- else edgeCount.set(key, {
1257
- a: ea,
1258
- b: eb,
1259
- count: 1
1260
- });
1261
- }
1262
- }
1263
- const horizonEdges = [];
1264
- for (const entry of edgeCount.values()) if (entry.count === 1) horizonEdges.push({
1265
- a: entry.a,
1266
- b: entry.b
1267
- });
1268
- const orphanedPoints = [];
1269
- for (const face of visibleFaces) {
1270
- for (const idx of face.outsidePoints) if (idx !== furthestIdx) orphanedPoints.push(idx);
1271
- face.alive = false;
1272
- face.outsidePoints = [];
1273
- }
1274
- const newFaces = [];
1275
- for (const edge of horizonEdges) {
1276
- const newFaceObj = makeFace$1(points, edge.a, edge.b, furthestIdx);
1277
- newFaces.push(newFaceObj);
1278
- faces.push(newFaceObj);
1279
- }
1280
- for (const idx of orphanedPoints) for (const face of newFaces) if (signedDist(face, at(points, idx)) > epsilon) {
1281
- face.outsidePoints.push(idx);
1282
- break;
1283
- }
1284
- }
1285
- const resultFaces = [];
1286
- for (const face of faces) if (face.alive) resultFaces.push([
1287
- face.a,
1288
- face.b,
1289
- face.c
1290
- ]);
1291
- return {
1292
- faces: resultFaces,
1293
- points
1294
- };
1295
- }
1296
1058
  function extractVertices(oc, shapes, tolerance) {
1297
1059
  const vertices = [];
1298
1060
  const meshDeflection = Math.max(tolerance, 1);
@@ -1,5 +1,5 @@
1
1
  const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
2
- const require_occtWasmAdapter = require("./occtWasmAdapter-CdyaMnBW.cjs");
2
+ const require_occtWasmAdapter = require("./occtWasmAdapter-ZiJfgmS1.cjs");
3
3
  const require_errors = require("./errors-CXJtc4I7.cjs");
4
4
  //#region src/kernel/kernel2dTypes.ts
5
5
  /** Check if the kernel supports 2D geometry operations. */
@@ -866,7 +866,7 @@ function makeWire$1(oc, edges) {
866
866
  * Creates a face from a wire.
867
867
  * If planar is true, creates a planar face. Otherwise creates a non-planar filling surface.
868
868
  */
869
- function makeFace$2(oc, wire, planar = true) {
869
+ function makeFace$1(oc, wire, planar = true) {
870
870
  if (planar) {
871
871
  const builder = new oc.BRepBuilderAPI_MakeFace_15(wire, false);
872
872
  const face = builder.Face();
@@ -1038,7 +1038,7 @@ function makeConstructorOps(oc) {
1038
1038
  makeEdge: (curve, start, end) => makeEdge$1(oc, curve, start, end),
1039
1039
  makeWire: (edges) => makeWire$1(oc, edges),
1040
1040
  makeWireFromMixed: (items) => makeWireFromMixed$1(oc, items),
1041
- makeFace: (wire, planar) => makeFace$2(oc, wire, planar),
1041
+ makeFace: (wire, planar) => makeFace$1(oc, wire, planar),
1042
1042
  makeBox: (w, h, d) => makeBox$1(oc, w, h, d),
1043
1043
  makeCylinder: (radius, height, center, direction) => makeCylinder$1(oc, radius, height, center, direction),
1044
1044
  makeSphere: (radius, center) => makeSphere$1(oc, radius, center),
@@ -1049,250 +1049,12 @@ function makeConstructorOps(oc) {
1049
1049
  }
1050
1050
  //#endregion
1051
1051
  //#region src/kernel/occt/hullOps.ts
1052
- function sub$1(a, b) {
1053
- return {
1054
- x: a.x - b.x,
1055
- y: a.y - b.y,
1056
- z: a.z - b.z
1057
- };
1058
- }
1059
- function cross$1(a, b) {
1060
- return {
1061
- x: a.y * b.z - a.z * b.y,
1062
- y: a.z * b.x - a.x * b.z,
1063
- z: a.x * b.y - a.y * b.x
1064
- };
1065
- }
1066
- function dot$1(a, b) {
1067
- return a.x * b.x + a.y * b.y + a.z * b.z;
1068
- }
1069
- function lengthVec(v) {
1070
- return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
1071
- }
1072
- function distSq(a, b) {
1073
- const dx = a.x - b.x;
1074
- const dy = a.y - b.y;
1075
- const dz = a.z - b.z;
1076
- return dx * dx + dy * dy + dz * dz;
1077
- }
1078
1052
  /** Safe array access — throws on out-of-bounds instead of returning undefined. */
1079
1053
  function at(arr, i) {
1080
1054
  const v = arr[i];
1081
1055
  if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1082
1056
  return v;
1083
1057
  }
1084
- /** Safe number array access. */
1085
- function atN(arr, i) {
1086
- const v = arr[i];
1087
- if (v === void 0) throw new Error(`Index ${i} out of bounds`);
1088
- return v;
1089
- }
1090
- function makeFace$1(points, a, b, c) {
1091
- const normal = cross$1(sub$1(at(points, b), at(points, a)), sub$1(at(points, c), at(points, a)));
1092
- const len = lengthVec(normal);
1093
- const n = len > 1e-14 ? {
1094
- x: normal.x / len,
1095
- y: normal.y / len,
1096
- z: normal.z / len
1097
- } : normal;
1098
- return {
1099
- a,
1100
- b,
1101
- c,
1102
- normal: n,
1103
- offset: dot$1(n, at(points, a)),
1104
- alive: true,
1105
- outsidePoints: []
1106
- };
1107
- }
1108
- function signedDist(face, point) {
1109
- return dot$1(face.normal, point) - face.offset;
1110
- }
1111
- function deduplicatePoints(points, tolerance) {
1112
- const tolSq = tolerance * tolerance;
1113
- const result = [];
1114
- for (const p of points) {
1115
- let isDuplicate = false;
1116
- for (const q of result) if (distSq(p, q) < tolSq) {
1117
- isDuplicate = true;
1118
- break;
1119
- }
1120
- if (!isDuplicate) result.push(p);
1121
- }
1122
- return result;
1123
- }
1124
- function findInitialTetrahedron(points) {
1125
- const n = points.length;
1126
- if (n < 4) return null;
1127
- let i0 = 0;
1128
- let i1 = 1;
1129
- let maxDist = distSq(at(points, 0), at(points, 1));
1130
- for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) {
1131
- const d = distSq(at(points, i), at(points, j));
1132
- if (d > maxDist) {
1133
- maxDist = d;
1134
- i0 = i;
1135
- i1 = j;
1136
- }
1137
- }
1138
- if (maxDist < 1e-20) return null;
1139
- const lineDir = sub$1(at(points, i1), at(points, i0));
1140
- let i2 = -1;
1141
- let maxLineDist = -1;
1142
- for (let i = 0; i < n; i++) {
1143
- if (i === i0 || i === i1) continue;
1144
- const c = cross$1(lineDir, sub$1(at(points, i), at(points, i0)));
1145
- const d = dot$1(c, c);
1146
- if (d > maxLineDist) {
1147
- maxLineDist = d;
1148
- i2 = i;
1149
- }
1150
- }
1151
- if (i2 === -1 || maxLineDist < 1e-20) return null;
1152
- const planeNormal = cross$1(sub$1(at(points, i1), at(points, i0)), sub$1(at(points, i2), at(points, i0)));
1153
- const planeLen = lengthVec(planeNormal);
1154
- if (planeLen < 1e-14) return null;
1155
- const pn = {
1156
- x: planeNormal.x / planeLen,
1157
- y: planeNormal.y / planeLen,
1158
- z: planeNormal.z / planeLen
1159
- };
1160
- const planeOffset = dot$1(pn, at(points, i0));
1161
- let i3 = -1;
1162
- let maxPlaneDist = -1;
1163
- for (let i = 0; i < n; i++) {
1164
- if (i === i0 || i === i1 || i === i2) continue;
1165
- const d = Math.abs(dot$1(pn, at(points, i)) - planeOffset);
1166
- if (d > maxPlaneDist) {
1167
- maxPlaneDist = d;
1168
- i3 = i;
1169
- }
1170
- }
1171
- if (i3 === -1 || maxPlaneDist < 1e-14) return null;
1172
- if (dot$1(pn, at(points, i3)) - planeOffset > 0) return [
1173
- i0,
1174
- i2,
1175
- i1,
1176
- i3
1177
- ];
1178
- return [
1179
- i0,
1180
- i1,
1181
- i2,
1182
- i3
1183
- ];
1184
- }
1185
- function quickHull(inputPoints, tolerance) {
1186
- const points = deduplicatePoints(inputPoints, tolerance);
1187
- if (points.length < 4) throw new Error(points.length === 0 ? "No points provided for convex hull" : "Fewer than 4 non-coincident points; cannot form a 3D convex hull");
1188
- const tet = findInitialTetrahedron(points);
1189
- if (tet === null) throw new Error("All points are coplanar; cannot form a 3D convex hull");
1190
- const [t0, t1, t2, t3] = tet;
1191
- const centroid = {
1192
- x: (at(points, t0).x + at(points, t1).x + at(points, t2).x + at(points, t3).x) / 4,
1193
- y: (at(points, t0).y + at(points, t1).y + at(points, t2).y + at(points, t3).y) / 4,
1194
- z: (at(points, t0).z + at(points, t1).z + at(points, t2).z + at(points, t3).z) / 4
1195
- };
1196
- function makeOutwardFace(a, b, c) {
1197
- const face = makeFace$1(points, a, b, c);
1198
- const toCentroid = sub$1(centroid, {
1199
- x: (at(points, a).x + at(points, b).x + at(points, c).x) / 3,
1200
- y: (at(points, a).y + at(points, b).y + at(points, c).y) / 3,
1201
- z: (at(points, a).z + at(points, b).z + at(points, c).z) / 3
1202
- });
1203
- if (dot$1(face.normal, toCentroid) > 0) return makeFace$1(points, a, c, b);
1204
- return face;
1205
- }
1206
- const faces = [
1207
- makeOutwardFace(t0, t1, t2),
1208
- makeOutwardFace(t0, t2, t3),
1209
- makeOutwardFace(t0, t3, t1),
1210
- makeOutwardFace(t1, t3, t2)
1211
- ];
1212
- const tetSet = new Set([
1213
- t0,
1214
- t1,
1215
- t2,
1216
- t3
1217
- ]);
1218
- const epsilon = 1e-10;
1219
- for (let i = 0; i < points.length; i++) {
1220
- if (tetSet.has(i)) continue;
1221
- for (const face of faces) if (signedDist(face, at(points, i)) > epsilon) {
1222
- face.outsidePoints.push(i);
1223
- break;
1224
- }
1225
- }
1226
- for (let iteration = 0; iteration < points.length * 4; iteration++) {
1227
- let currentFace = null;
1228
- for (const face of faces) if (face.alive && face.outsidePoints.length > 0) {
1229
- currentFace = face;
1230
- break;
1231
- }
1232
- if (currentFace === null) break;
1233
- let furthestIdx = atN(currentFace.outsidePoints, 0);
1234
- let furthestDist = signedDist(currentFace, at(points, furthestIdx));
1235
- for (let i = 1; i < currentFace.outsidePoints.length; i++) {
1236
- const idx = atN(currentFace.outsidePoints, i);
1237
- const d = signedDist(currentFace, at(points, idx));
1238
- if (d > furthestDist) {
1239
- furthestDist = d;
1240
- furthestIdx = idx;
1241
- }
1242
- }
1243
- const visibleFaces = [];
1244
- for (const face of faces) if (face.alive && signedDist(face, at(points, furthestIdx)) > epsilon) visibleFaces.push(face);
1245
- const edgeCount = /* @__PURE__ */ new Map();
1246
- for (const face of visibleFaces) {
1247
- const edges = [
1248
- [face.a, face.b],
1249
- [face.b, face.c],
1250
- [face.c, face.a]
1251
- ];
1252
- for (const [ea, eb] of edges) {
1253
- const key = ea < eb ? `${ea}-${eb}` : `${eb}-${ea}`;
1254
- const entry = edgeCount.get(key);
1255
- if (entry) entry.count++;
1256
- else edgeCount.set(key, {
1257
- a: ea,
1258
- b: eb,
1259
- count: 1
1260
- });
1261
- }
1262
- }
1263
- const horizonEdges = [];
1264
- for (const entry of edgeCount.values()) if (entry.count === 1) horizonEdges.push({
1265
- a: entry.a,
1266
- b: entry.b
1267
- });
1268
- const orphanedPoints = [];
1269
- for (const face of visibleFaces) {
1270
- for (const idx of face.outsidePoints) if (idx !== furthestIdx) orphanedPoints.push(idx);
1271
- face.alive = false;
1272
- face.outsidePoints = [];
1273
- }
1274
- const newFaces = [];
1275
- for (const edge of horizonEdges) {
1276
- const newFaceObj = makeFace$1(points, edge.a, edge.b, furthestIdx);
1277
- newFaces.push(newFaceObj);
1278
- faces.push(newFaceObj);
1279
- }
1280
- for (const idx of orphanedPoints) for (const face of newFaces) if (signedDist(face, at(points, idx)) > epsilon) {
1281
- face.outsidePoints.push(idx);
1282
- break;
1283
- }
1284
- }
1285
- const resultFaces = [];
1286
- for (const face of faces) if (face.alive) resultFaces.push([
1287
- face.a,
1288
- face.b,
1289
- face.c
1290
- ]);
1291
- return {
1292
- faces: resultFaces,
1293
- points
1294
- };
1295
- }
1296
1058
  function extractVertices(oc, shapes, tolerance) {
1297
1059
  const vertices = [];
1298
1060
  const meshDeflection = Math.max(tolerance, 1);
@@ -1392,7 +1154,7 @@ function hull$1(oc, shapes, tolerance) {
1392
1154
  if (shapes.length === 0) throw new Error("hull: no shapes provided");
1393
1155
  const vertices = extractVertices(oc, shapes, tolerance);
1394
1156
  if (vertices.length < 4) throw new Error("hull: fewer than 4 vertices extracted from input shapes");
1395
- const hullResult = quickHull(vertices, tolerance);
1157
+ const hullResult = require_occtWasmAdapter.quickHull(vertices, tolerance);
1396
1158
  if (hullResult.faces.length < 4) throw new Error("hull: degenerate hull (fewer than 4 faces)");
1397
1159
  return reconstructBrep(oc, hullResult, tolerance);
1398
1160
  }
@@ -1410,7 +1172,7 @@ function buildSolidFromFaces$1(oc, points, faces, tolerance) {
1410
1172
  }
1411
1173
  function hullFromPoints$1(oc, points, tolerance) {
1412
1174
  if (points.length < 4) throw new Error("hullFromPoints: fewer than 4 points");
1413
- const hullResult = quickHull(points, tolerance);
1175
+ const hullResult = require_occtWasmAdapter.quickHull(points, tolerance);
1414
1176
  if (hullResult.faces.length < 4) throw new Error("hullFromPoints: degenerate hull (fewer than 4 faces)");
1415
1177
  return reconstructBrep(oc, hullResult, tolerance);
1416
1178
  }