brepjs 13.2.0 → 14.1.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.
- package/dist/2d/curve2dGeometryFns.d.ts +107 -0
- package/dist/2d/curve2dGeometryFns.d.ts.map +1 -0
- package/dist/2d.cjs +230 -3
- package/dist/2d.d.ts +2 -0
- package/dist/2d.d.ts.map +1 -1
- package/dist/2d.js +207 -4
- package/dist/arrayAccess-CmulMesb.cjs +40 -0
- package/dist/arrayAccess-xxcB3YNq.js +23 -0
- package/dist/{blueprint-DYCdRlW5.js → blueprint-B3A5x7P9.js} +10 -10
- package/dist/{blueprint-PLJan-W5.cjs → blueprint-D0XChcek.cjs} +14 -14
- package/dist/{blueprintFns-eWh7NpZx.js → blueprintFns-BwAMXY3t.js} +3 -3
- package/dist/{blueprintFns-Bsx25BG7.cjs → blueprintFns-COrEYX29.cjs} +3 -3
- package/dist/{boolean2D-CtB21ajK.cjs → boolean2D-BPsyKImE.cjs} +20 -19
- package/dist/{boolean2D-52qVCooY.js → boolean2D-D_Te-6N6.js} +13 -12
- package/dist/{booleanFns-BrptUFkP.cjs → booleanFns-B6M6Lm0V.cjs} +24 -22
- package/dist/{booleanFns-iM6UPb8e.js → booleanFns-CgsaJFBf.js} +8 -6
- package/dist/brepjs.cjs +304 -211
- package/dist/brepjs.js +188 -145
- package/dist/constants-B9u763C3.js +9 -0
- package/dist/constants-unWN8k4c.cjs +26 -0
- package/dist/core/curve2dHandle.d.ts +27 -0
- package/dist/core/curve2dHandle.d.ts.map +1 -0
- package/dist/core/errors.d.ts +11 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelCall.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +2 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -1
- package/dist/core.cjs +9 -8
- package/dist/core.js +6 -5
- package/dist/{cornerFinder-C7aDyYLJ.js → cornerFinder-AEFnAxt4.js} +3 -3
- package/dist/{cornerFinder-SF-xmMO1.cjs → cornerFinder-DTt_SvtC.cjs} +4 -4
- package/dist/{curveFns-C-jU1_Y_.js → curveFns-CcInoOEA.js} +2 -2
- package/dist/{curveFns-ywh7Ctyk.cjs → curveFns-DCEcwcpd.cjs} +2 -2
- package/dist/{drawFns-DknEB-Qs.cjs → drawFns-BOwBIzPa.cjs} +35 -18
- package/dist/{drawFns-D-0p86Lf.js → drawFns-n9qif7QN.js} +17 -15
- package/dist/{errors-DupKEMqI.cjs → errors-9zQcQK1H.cjs} +34 -0
- package/dist/{errors-B_T0aMQF.js → errors-C-cgQA3w.js} +29 -1
- package/dist/{extrudeFns-LsH1rDMa.js → extrudeFns-DrDr9-nU.js} +3 -3
- package/dist/{extrudeFns-CGCIbydL.cjs → extrudeFns-Rcut7h8S.cjs} +3 -3
- package/dist/{faceFns-EnGcKFAr.js → faceFns-TSH54pPQ.js} +94 -4
- package/dist/{faceFns-8dGb8q3J.cjs → faceFns-cE2WxY6I.cjs} +111 -3
- package/dist/{helpers-pQpV9Mwh.cjs → helpers-DZje6XWE.cjs} +18 -17
- package/dist/{helpers-Rf0vhX6I.js → helpers-XrXlKm8D.js} +8 -7
- package/dist/{historyFns-XkjLAQyu.js → historyFns-2hCWrX_X.js} +10 -10
- package/dist/{historyFns-lNalnOdR.cjs → historyFns-BiQ9dmzp.cjs} +10 -10
- package/dist/{importFns-BSH9cGIp.cjs → importFns-DGE5nCSW.cjs} +4 -4
- package/dist/{importFns-Bgs-FYAP.js → importFns-m0xyj0Zt.js} +4 -4
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/brepkit/brepkitAdapter.d.ts +150 -241
- package/dist/kernel/brepkit/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkit/evolutionOps.d.ts +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -1
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/curveOps.d.ts +3 -1
- package/dist/kernel/interfaces/curveOps.d.ts.map +1 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts +3 -1
- package/dist/kernel/interfaces/surfaceOps.d.ts.map +1 -1
- package/dist/kernel/occt/defaultAdapter.d.ts +3 -1
- package/dist/kernel/occt/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/occt/nurbsQueryOps.d.ts +12 -0
- package/dist/kernel/occt/nurbsQueryOps.d.ts.map +1 -0
- package/dist/kernel/types.d.ts +26 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{measureFns-D7J6qUY_.js → measureFns-DHByqdmn.js} +9 -16
- package/dist/{measureFns-CFdHa_fj.cjs → measureFns-D_QKZ5yg.cjs} +9 -16
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-2XnDXgIh.cjs → meshFns-CVe3Kc77.cjs} +4 -4
- package/dist/{meshFns-B7uklc4M.js → meshFns-DL4Djz3w.js} +3 -3
- package/dist/ns/booleans.d.ts +10 -0
- package/dist/ns/booleans.d.ts.map +1 -0
- package/dist/ns/construction.d.ts +10 -0
- package/dist/ns/construction.d.ts.map +1 -0
- package/dist/ns/ioNs.d.ts +18 -0
- package/dist/ns/ioNs.d.ts.map +1 -0
- package/dist/ns/measurement.d.ts +6 -0
- package/dist/ns/measurement.d.ts.map +1 -0
- package/dist/ns/modifiers.d.ts +6 -0
- package/dist/ns/modifiers.d.ts.map +1 -0
- package/dist/ns/patterns.d.ts +5 -0
- package/dist/ns/patterns.d.ts.map +1 -0
- package/dist/ns/primitives.d.ts +7 -0
- package/dist/ns/primitives.d.ts.map +1 -0
- package/dist/ns/query.d.ts +6 -0
- package/dist/ns/query.d.ts.map +1 -0
- package/dist/ns/transforms.d.ts +5 -0
- package/dist/ns/transforms.d.ts.map +1 -0
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{planeOps-cTxDywpG.cjs → planeOps-6Wu7dMDN.cjs} +5 -4
- package/dist/{planeOps-BuBXTLBr.js → planeOps-gTOEarV2.js} +4 -3
- package/dist/{primitiveFns-DKtvEA0i.cjs → primitiveFns-CRPGjIFg.cjs} +101 -69
- package/dist/{primitiveFns-CASk8g16.js → primitiveFns-CeKiYSSW.js} +28 -8
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{arrayAccess-Dps31ERU.js → shapeFns-DCi9O27X.js} +8 -30
- package/dist/{arrayAccess-peFKE9Ob.cjs → shapeFns-aEeSHNqX.cjs} +24 -64
- package/dist/shapeRef.cjs +8 -0
- package/dist/shapeRef.d.ts +5 -0
- package/dist/shapeRef.d.ts.map +1 -0
- package/dist/shapeRef.js +2 -0
- package/dist/shapeRefFns-B1TODUMl.js +194 -0
- package/dist/shapeRefFns-CVdS6jWS.cjs +229 -0
- package/dist/{shapeTypes-CYb8Byqj.js → shapeTypes-BO1aiDhi.js} +3937 -3697
- package/dist/{shapeTypes-CElaawp7.cjs → shapeTypes-BqWQlrYE.cjs} +3937 -3697
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-Cs4XyL58.cjs → solidBuilders-0iVdiZUw.cjs} +3 -3
- package/dist/{solidBuilders-ClJxiUa3.js → solidBuilders-jk7HfWs8.js} +3 -3
- package/dist/{surfaceBuilders-ZUTb3z6i.cjs → surfaceBuilders-C_8rs79F.cjs} +3 -3
- package/dist/{surfaceBuilders-DnGdDW8i.js → surfaceBuilders-DE5e6bp8.js} +3 -3
- package/dist/topology/api.d.ts +3 -3
- package/dist/topology/api.d.ts.map +1 -1
- package/dist/topology/nurbsFns.d.ts +13 -0
- package/dist/topology/nurbsFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +4 -3
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/shapeRef/index.d.ts +7 -0
- package/dist/topology/shapeRef/index.d.ts.map +1 -0
- package/dist/topology/shapeRef/scoring.d.ts +16 -0
- package/dist/topology/shapeRef/scoring.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts +47 -0
- package/dist/topology/shapeRef/shapeRefFns.d.ts.map +1 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts +40 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts.map +1 -0
- package/dist/topology.cjs +22 -20
- package/dist/topology.d.ts +1 -0
- package/dist/topology.d.ts.map +1 -1
- package/dist/topology.js +7 -7
- package/dist/{vecOps-4iBMiet9.cjs → vecOps-BXvBYIor.cjs} +0 -26
- package/dist/{vecOps-B9-MTeC8.js → vecOps-D9etjPgV.js} +1 -9
- package/dist/vectors.cjs +6 -5
- package/dist/vectors.js +4 -3
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +14 -4
- /package/dist/{types-Bb4KK_iG.js → types-BWBlwp6w.js} +0 -0
- /package/dist/{types-BD-VVaWB.cjs → types-BjDcsS7l.cjs} +0 -0
- /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
- /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/utils/arrayAccess.ts
|
|
2
|
+
/**
|
|
3
|
+
* Safe array access utilities.
|
|
4
|
+
* Replaces `arr[i]!` patterns where TypeScript's `noUncheckedIndexedAccess` requires
|
|
5
|
+
* a non-null assertion but bounds are proven by surrounding code.
|
|
6
|
+
*/
|
|
7
|
+
/** Access element by index, throwing if out of bounds. Use when bounds are logically guaranteed. */
|
|
8
|
+
function getAtOrThrow(arr, index, msg) {
|
|
9
|
+
if (index < 0 || index >= arr.length) throw new Error(msg ?? `Index ${index} out of bounds (length ${arr.length})`);
|
|
10
|
+
return arr[index];
|
|
11
|
+
}
|
|
12
|
+
/** Get the first element of a non-empty array, throwing if empty. */
|
|
13
|
+
function firstOrThrow(arr, msg) {
|
|
14
|
+
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
15
|
+
return arr[0];
|
|
16
|
+
}
|
|
17
|
+
/** Get the last element of a non-empty array, throwing if empty. */
|
|
18
|
+
function lastOrThrow(arr, msg) {
|
|
19
|
+
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
20
|
+
return arr[arr.length - 1];
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "firstOrThrow", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return firstOrThrow;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "getAtOrThrow", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function() {
|
|
32
|
+
return getAtOrThrow;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "lastOrThrow", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function() {
|
|
38
|
+
return lastOrThrow;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/utils/arrayAccess.ts
|
|
2
|
+
/**
|
|
3
|
+
* Safe array access utilities.
|
|
4
|
+
* Replaces `arr[i]!` patterns where TypeScript's `noUncheckedIndexedAccess` requires
|
|
5
|
+
* a non-null assertion but bounds are proven by surrounding code.
|
|
6
|
+
*/
|
|
7
|
+
/** Access element by index, throwing if out of bounds. Use when bounds are logically guaranteed. */
|
|
8
|
+
function getAtOrThrow(arr, index, msg) {
|
|
9
|
+
if (index < 0 || index >= arr.length) throw new Error(msg ?? `Index ${index} out of bounds (length ${arr.length})`);
|
|
10
|
+
return arr[index];
|
|
11
|
+
}
|
|
12
|
+
/** Get the first element of a non-empty array, throwing if empty. */
|
|
13
|
+
function firstOrThrow(arr, msg) {
|
|
14
|
+
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
15
|
+
return arr[0];
|
|
16
|
+
}
|
|
17
|
+
/** Get the last element of a non-empty array, throwing if empty. */
|
|
18
|
+
function lastOrThrow(arr, msg) {
|
|
19
|
+
if (arr.length === 0) throw new Error(msg ?? "Expected non-empty array");
|
|
20
|
+
return arr[arr.length - 1];
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getAtOrThrow as n, lastOrThrow as r, firstOrThrow as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { H as registerForCleanup, W as unregisterFromCleanup, X as getKernel2D, Y as getKernel, a as createEdge, u as createWire } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
import { r as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { r as makeFace } from "./surfaceBuilders-
|
|
10
|
-
import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-
|
|
1
|
+
import { H as registerForCleanup, W as unregisterFromCleanup, X as getKernel2D, Y as getKernel, a as createEdge, u as createWire } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, R as unwrap, b as err, d as validationError, h as bug, n as computationError } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { g as cast, m as uvCoordinates, n as faceCenter, p as uvBounds, r as faceGeomType } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { r as RAD2DEG, t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
5
|
+
import { r as toVec3 } from "./types-BWBlwp6w.js";
|
|
6
|
+
import { r as makePlane } from "./planeOps-gTOEarV2.js";
|
|
7
|
+
import { f as getOrientation } from "./curveFns-CcInoOEA.js";
|
|
8
|
+
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
|
|
9
|
+
import { r as makeFace } from "./surfaceBuilders-DE5e6bp8.js";
|
|
10
|
+
import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-XrXlKm8D.js";
|
|
11
11
|
//#region src/2d/lib/definitions.ts
|
|
12
12
|
/** Type guard that checks whether a value is a `Point2D`. */
|
|
13
13
|
function isPoint2D(point) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
-
const require_helpers = require("./helpers-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
|
|
4
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
5
|
+
const require_types = require("./types-BjDcsS7l.cjs");
|
|
6
|
+
const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
|
|
7
|
+
const require_curveFns = require("./curveFns-DCEcwcpd.cjs");
|
|
8
|
+
const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
|
|
9
|
+
const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
|
|
10
|
+
const require_helpers = require("./helpers-DZje6XWE.cjs");
|
|
11
11
|
//#region src/2d/lib/definitions.ts
|
|
12
12
|
/** Type guard that checks whether a value is a `Point2D`. */
|
|
13
13
|
function isPoint2D(point) {
|
|
@@ -528,7 +528,7 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
|
|
|
528
528
|
if (!circleData) require_errors.bug("adaptedCurveToPathElem", "Expected circle data");
|
|
529
529
|
const { radius, isDirect } = circleData;
|
|
530
530
|
const bounds = k2d.getCurve2dBounds(curve.wrapped);
|
|
531
|
-
const paramAngle = (bounds.last - bounds.first) *
|
|
531
|
+
const paramAngle = (bounds.last - bounds.first) * require_constants.RAD2DEG;
|
|
532
532
|
const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
|
|
533
533
|
return `A ${radius} ${radius} 0 ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
|
|
534
534
|
}
|
|
@@ -537,9 +537,9 @@ var adaptedCurveToPathElem = (curve, lastPoint) => {
|
|
|
537
537
|
if (!ellipseData) require_errors.bug("adaptedCurveToPathElem", "Expected ellipse data");
|
|
538
538
|
const { majorRadius: rx, minorRadius: ry, xAxisAngle, isDirect } = ellipseData;
|
|
539
539
|
const bounds = k2d.getCurve2dBounds(curve.wrapped);
|
|
540
|
-
const paramAngle = (bounds.last - bounds.first) *
|
|
540
|
+
const paramAngle = (bounds.last - bounds.first) * require_constants.RAD2DEG;
|
|
541
541
|
const end = paramAngle !== 360 ? endpoint : `${round5(endX)} ${round5(endY + 1e-4)}`;
|
|
542
|
-
const angle = 180 - xAxisAngle *
|
|
542
|
+
const angle = 180 - xAxisAngle * require_constants.RAD2DEG;
|
|
543
543
|
return `A ${round5(rx)} ${round5(ry)} ${round5(angle)} ${Math.abs(paramAngle) > 180 ? "1" : "0"} ${isDirect ? "1" : "0"} ${end}`;
|
|
544
544
|
}
|
|
545
545
|
require_errors.bug("adaptedCurveToPathElem", `Unsupported curve type: ${curveType}`);
|
|
@@ -807,7 +807,7 @@ var Blueprint = class Blueprint {
|
|
|
807
807
|
* @returns A new rotated Blueprint.
|
|
808
808
|
*/
|
|
809
809
|
rotate(angle, center) {
|
|
810
|
-
return new Blueprint(transformCurves(this.curves, rotateTransform2d(angle *
|
|
810
|
+
return new Blueprint(transformCurves(this.curves, rotateTransform2d(angle * require_constants.DEG2RAD, center)));
|
|
811
811
|
}
|
|
812
812
|
translate(xDistOrPoint, yDist = 0) {
|
|
813
813
|
const translationVector = isPoint2D(xDistOrPoint) ? xDistOrPoint : [xDistOrPoint, yDist];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as CompoundBlueprint } from "./boolean2D-
|
|
3
|
-
import { t as Blueprint } from "./blueprint-
|
|
1
|
+
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
|
|
2
|
+
import { h as CompoundBlueprint } from "./boolean2D-D_Te-6N6.js";
|
|
3
|
+
import { t as Blueprint } from "./blueprint-B3A5x7P9.js";
|
|
4
4
|
//#region src/2d/lib/curve2dFns.ts
|
|
5
5
|
/**
|
|
6
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_errors = require("./errors-
|
|
2
|
-
const require_boolean2D = require("./boolean2D-
|
|
3
|
-
const require_blueprint = require("./blueprint-
|
|
1
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
2
|
+
const require_boolean2D = require("./boolean2D-BPsyKImE.cjs");
|
|
3
|
+
const require_blueprint = require("./blueprint-D0XChcek.cjs");
|
|
4
4
|
//#region src/2d/lib/curve2dFns.ts
|
|
5
5
|
/**
|
|
6
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
|
|
4
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
5
|
+
const require_types = require("./types-BjDcsS7l.cjs");
|
|
6
|
+
const require_vecOps = require("./vecOps-BXvBYIor.cjs");
|
|
7
|
+
const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-DCEcwcpd.cjs");
|
|
9
|
+
const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
|
|
10
|
+
const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
|
|
11
|
+
const require_helpers = require("./helpers-DZje6XWE.cjs");
|
|
12
|
+
const require_blueprint = require("./blueprint-D0XChcek.cjs");
|
|
13
|
+
const require_extrudeFns = require("./extrudeFns-Rcut7h8S.cjs");
|
|
13
14
|
//#region node_modules/flatqueue/index.js
|
|
14
15
|
/** @template T */
|
|
15
16
|
var FlatQueue = class {
|
|
@@ -1213,10 +1214,10 @@ var defaultsSplineOptions = (config) => {
|
|
|
1213
1214
|
};
|
|
1214
1215
|
const { endTangent: endTgt, startFactor = 1, endFactor = 1, startTangent: startTgt } = conf;
|
|
1215
1216
|
let endTangent;
|
|
1216
|
-
if (typeof endTgt === "number") endTangent = require_helpers.polarToCartesian(1, endTgt *
|
|
1217
|
+
if (typeof endTgt === "number") endTangent = require_helpers.polarToCartesian(1, endTgt * require_constants.DEG2RAD);
|
|
1217
1218
|
else endTangent = endTgt;
|
|
1218
1219
|
let startTangent;
|
|
1219
|
-
if (typeof startTgt === "number") startTangent = require_helpers.polarToCartesian(1, startTgt *
|
|
1220
|
+
if (typeof startTgt === "number") startTangent = require_helpers.polarToCartesian(1, startTgt * require_constants.DEG2RAD);
|
|
1220
1221
|
else startTangent = startTgt;
|
|
1221
1222
|
return {
|
|
1222
1223
|
endTangent,
|
|
@@ -1335,7 +1336,7 @@ function normalizeEllipseRadii(horizontalRadius, verticalRadius, rotation) {
|
|
|
1335
1336
|
* @param convertToUV - Coordinate conversion function from user space to UV space.
|
|
1336
1337
|
*/
|
|
1337
1338
|
function makeEllipseArcFromSvgParams(startUV, endUV, majorRadius, minorRadius, rotationAngleDeg, longAxis, sweep, convertToUV) {
|
|
1338
|
-
const radRotationAngle = rotationAngleDeg *
|
|
1339
|
+
const radRotationAngle = rotationAngleDeg * require_constants.DEG2RAD;
|
|
1339
1340
|
const convertAxis = (ax) => require_helpers.distance2d(convertToUV(ax));
|
|
1340
1341
|
const r1 = convertAxis(require_helpers.polarToCartesian(majorRadius, radRotationAngle));
|
|
1341
1342
|
const r2 = convertAxis(require_helpers.polarToCartesian(minorRadius, radRotationAngle + Math.PI / 2));
|
|
@@ -1427,7 +1428,7 @@ var BaseSketcher2d = class {
|
|
|
1427
1428
|
const lastCurve = this._lastCurve();
|
|
1428
1429
|
if (!lastCurve) return 0;
|
|
1429
1430
|
const [dx, dy] = lastCurve.tangentAt(1);
|
|
1430
|
-
return Math.atan2(dy, dx) *
|
|
1431
|
+
return Math.atan2(dy, dx) * require_constants.RAD2DEG;
|
|
1431
1432
|
}
|
|
1432
1433
|
/** Move the pen to an absolute 2D position before drawing any curves. */
|
|
1433
1434
|
movePointerTo(point) {
|
|
@@ -1473,11 +1474,11 @@ var BaseSketcher2d = class {
|
|
|
1473
1474
|
}
|
|
1474
1475
|
/** Draw a line to a point given in polar coordinates [r, theta] from the origin. */
|
|
1475
1476
|
polarLineTo([r, theta]) {
|
|
1476
|
-
return this.lineTo(require_helpers.polarToCartesian(r, theta *
|
|
1477
|
+
return this.lineTo(require_helpers.polarToCartesian(r, theta * require_constants.DEG2RAD));
|
|
1477
1478
|
}
|
|
1478
1479
|
/** Draw a line in polar coordinates (distance and angle in degrees) from the current point. */
|
|
1479
1480
|
polarLine(distance, angle) {
|
|
1480
|
-
const [x, y] = require_helpers.polarToCartesian(distance, angle *
|
|
1481
|
+
const [x, y] = require_helpers.polarToCartesian(distance, angle * require_constants.DEG2RAD);
|
|
1481
1482
|
return this.line(x, y);
|
|
1482
1483
|
}
|
|
1483
1484
|
/** Draw a line tangent to the previous curve, extending by the given distance. */
|
|
@@ -1564,7 +1565,7 @@ var BaseSketcher2d = class {
|
|
|
1564
1565
|
halfEllipseTo(end, minorRadius, sweep = false) {
|
|
1565
1566
|
const angle = require_helpers.polarAngle2d(end, this.pointer);
|
|
1566
1567
|
const dist = require_helpers.distance2d(end, this.pointer);
|
|
1567
|
-
return this.ellipseTo(end, dist / 2, minorRadius, angle *
|
|
1568
|
+
return this.ellipseTo(end, dist / 2, minorRadius, angle * require_constants.RAD2DEG, true, sweep);
|
|
1568
1569
|
}
|
|
1569
1570
|
/** Draw a half-ellipse arc to a relative end point with a given minor radius. */
|
|
1570
1571
|
halfEllipse(xDist, yDist, minorRadius, sweep = false) {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { J as _usingCtx, L as DisposalScope, X as getKernel2D, Y as getKernel, a as createEdge, h as isShape3D, o as createFace, t as castShape, u as createWire } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { c as curveStartPoint, l as curveTangentAt, r as curveIsClosed } from "./curveFns-
|
|
9
|
-
import {
|
|
10
|
-
import { _ as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { c as
|
|
1
|
+
import { J as _usingCtx, L as DisposalScope, X as getKernel2D, Y as getKernel, a as createEdge, h as isShape3D, o as createFace, t as castShape, u as createWire } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, R as unwrap, T as isOk, b as err, d as validationError, h as bug, i as kernelError, l as typeCastError, n as computationError, s as safeIndex } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { _ as downcast, c as normalAt, p as uvBounds, u as pointOnSurface } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { r as RAD2DEG, t as DEG2RAD } from "./constants-B9u763C3.js";
|
|
5
|
+
import { r as toVec3 } from "./types-BWBlwp6w.js";
|
|
6
|
+
import { d as vecNormalize, h as vecScale, r as vecCross } from "./vecOps-D9etjPgV.js";
|
|
7
|
+
import { n as createPlane } from "./planeOps-gTOEarV2.js";
|
|
8
|
+
import { c as curveStartPoint, l as curveTangentAt, r as curveIsClosed } from "./curveFns-CcInoOEA.js";
|
|
9
|
+
import { r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
|
|
10
|
+
import { _ as zip, i as makeNewFaceWithinFace, r as makeFace, s as assembleWire } from "./surfaceBuilders-DE5e6bp8.js";
|
|
11
|
+
import { _ as samePoint$1, b as subtract2d, d as cartesianToPolar, f as crossProduct2d, g as rotate2d, h as polarToCartesian, l as add2d, m as polarAngle2d, o as normalize2d, p as distance2d, s as PRECISION_INTERSECTION, v as scalarMultiply2d } from "./helpers-XrXlKm8D.js";
|
|
12
|
+
import { _ as Curve2D, b as removeDuplicatePoints, c as make2dCircle, f as make2dSegmentCurve, h as approximateAsBSpline, m as make2dThreePointArc, n as asSVG, o as make2dArcFromCenter, p as make2dTangentArc, r as viewbox, s as make2dBezierCurve, t as Blueprint, u as make2dEllipseArc, x as isPoint2D, y as BoundingBox2d } from "./blueprint-B3A5x7P9.js";
|
|
13
|
+
import { c as twistExtrude, n as revolve, r as complexExtrude, s as sweep, t as extrude } from "./extrudeFns-DrDr9-nU.js";
|
|
13
14
|
//#region node_modules/flatqueue/index.js
|
|
14
15
|
/** @template T */
|
|
15
16
|
var FlatQueue = class {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
2
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
3
|
+
const require_constants = require("./constants-unWN8k4c.cjs");
|
|
4
|
+
const require_vecOps = require("./vecOps-BXvBYIor.cjs");
|
|
5
|
+
const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
|
|
6
|
+
const require_shapeFns = require("./shapeFns-aEeSHNqX.cjs");
|
|
7
|
+
const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
|
|
8
|
+
const require_surfaceBuilders = require("./surfaceBuilders-C_8rs79F.cjs");
|
|
7
9
|
//#region src/topology/booleanFns.ts
|
|
8
10
|
/**
|
|
9
11
|
* Boolean and compound operations — functional replacements for _3DShape boolean methods.
|
|
@@ -39,8 +41,8 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
39
41
|
if (require_errors.isErr(checkA)) return checkA;
|
|
40
42
|
const checkB = validateShape3D(b, "fuse: second operand");
|
|
41
43
|
if (require_errors.isErr(checkB)) return checkB;
|
|
42
|
-
const inputFaceHashes =
|
|
43
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
44
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
45
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().fuseWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
44
46
|
optimisation,
|
|
45
47
|
simplify,
|
|
46
48
|
fuzzyValue
|
|
@@ -50,7 +52,7 @@ function fuse(a, b, { optimisation = "none", simplify = false, signal, fuzzyValu
|
|
|
50
52
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
51
53
|
}
|
|
52
54
|
const fuseResult = castToShape3D(resultShape, "FUSE_NOT_3D", "Fuse did not produce a 3D shape", "Common causes: overlapping coplanar faces, zero-thickness geometry, or non-manifold input. Try autoHeal() on inputs first.", diagnostics);
|
|
53
|
-
if (fuseResult.ok)
|
|
55
|
+
if (fuseResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], fuseResult.value);
|
|
54
56
|
return fuseResult;
|
|
55
57
|
}
|
|
56
58
|
function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
|
|
@@ -59,8 +61,8 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
59
61
|
if (require_errors.isErr(checkBase)) return checkBase;
|
|
60
62
|
const checkTool = validateShape3D(tool, "cut: tool");
|
|
61
63
|
if (require_errors.isErr(checkTool)) return checkTool;
|
|
62
|
-
const inputFaceHashes =
|
|
63
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes,
|
|
64
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([base, tool]);
|
|
65
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().cutWithHistory(base.wrapped, tool.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
64
66
|
optimisation,
|
|
65
67
|
simplify,
|
|
66
68
|
fuzzyValue
|
|
@@ -70,7 +72,7 @@ function cut(base, tool, { optimisation = "none", simplify = false, signal, fuzz
|
|
|
70
72
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
71
73
|
}
|
|
72
74
|
const cutResult = castToShape3D(resultShape, "CUT_NOT_3D", "Cut did not produce a 3D shape", "Common causes: tool does not fully intersect the base, or produces a zero-thickness sliver. Ensure the tool extends through the shape.", diagnostics);
|
|
73
|
-
if (cutResult.ok)
|
|
75
|
+
if (cutResult.ok) require_shapeFns.propagateAllMetadata(evolution, [base, tool], cutResult.value);
|
|
74
76
|
return cutResult;
|
|
75
77
|
}
|
|
76
78
|
function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe } = {}) {
|
|
@@ -79,8 +81,8 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
|
|
|
79
81
|
if (require_errors.isErr(checkA)) return checkA;
|
|
80
82
|
const checkB = validateShape3D(b, "intersect: second operand");
|
|
81
83
|
if (require_errors.isErr(checkB)) return checkB;
|
|
82
|
-
const inputFaceHashes =
|
|
83
|
-
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes,
|
|
84
|
+
const inputFaceHashes = require_shapeFns.collectInputFaceHashes([a, b]);
|
|
85
|
+
const { shape: resultShape, evolution, diagnostics } = require_shapeTypes.getKernel().intersectWithHistory(a.wrapped, b.wrapped, inputFaceHashes, require_constants.HASH_CODE_MAX, {
|
|
84
86
|
simplify,
|
|
85
87
|
fuzzyValue
|
|
86
88
|
});
|
|
@@ -89,7 +91,7 @@ function intersect(a, b, { simplify = false, signal, fuzzyValue, unsafe: _unsafe
|
|
|
89
91
|
return require_errors.err(require_errors.kernelError(require_errors.BrepErrorCode.BOOLEAN_HAS_ERRORS, "Boolean operation reported internal errors. The result may be invalid.", void 0, { diagnostics }, "Use checkBoolean() to pre-validate operands, or try autoHeal() on inputs."));
|
|
90
92
|
}
|
|
91
93
|
const intResult = castToShape3D(resultShape, "INTERSECT_NOT_3D", "Intersect did not produce a 3D shape", "Shapes may not overlap. Verify they share a common volume before intersecting.", diagnostics);
|
|
92
|
-
if (intResult.ok)
|
|
94
|
+
if (intResult.ok) require_shapeFns.propagateAllMetadata(evolution, [a, b], intResult.value);
|
|
93
95
|
return intResult;
|
|
94
96
|
}
|
|
95
97
|
/**
|
|
@@ -135,7 +137,7 @@ function fuseAll(shapes, { optimisation = "none", simplify = false, strategy = "
|
|
|
135
137
|
fuzzyValue,
|
|
136
138
|
...signal ? { signal } : {}
|
|
137
139
|
}), "FUSE_ALL_NOT_3D", "fuseAll did not produce a 3D shape");
|
|
138
|
-
if (fuseAllResult.ok)
|
|
140
|
+
if (fuseAllResult.ok) require_shapeFns.propagateMetadataByHash(shapes, fuseAllResult.value);
|
|
139
141
|
return fuseAllResult;
|
|
140
142
|
}
|
|
141
143
|
return fuseAllPairwise(shapes, 0, shapes.length, optimisation, simplify, true, signal, fuzzyValue);
|
|
@@ -155,7 +157,7 @@ function cutAll(base, tools, { optimisation = "none", simplify = false, signal,
|
|
|
155
157
|
simplify,
|
|
156
158
|
fuzzyValue
|
|
157
159
|
}), "CUT_ALL_NOT_3D", "cutAll did not produce a 3D shape");
|
|
158
|
-
if (cutAllResult.ok)
|
|
160
|
+
if (cutAllResult.ok) require_shapeFns.propagateMetadataByHash(allInputs, cutAllResult.value);
|
|
159
161
|
return cutAllResult;
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
@@ -220,9 +222,9 @@ function buildEdgeAdjacency(edges) {
|
|
|
220
222
|
const vertexToEdges = /* @__PURE__ */ new Map();
|
|
221
223
|
const edgeVertexHashes = /* @__PURE__ */ new Map();
|
|
222
224
|
for (const edge of edges) {
|
|
223
|
-
const verts =
|
|
224
|
-
const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped,
|
|
225
|
-
const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped,
|
|
225
|
+
const verts = require_shapeFns.getVertices(edge);
|
|
226
|
+
const h0 = verts[0] ? kernel.hashCode(verts[0].wrapped, require_constants.HASH_CODE_MAX) : -1;
|
|
227
|
+
const h1 = verts.length > 1 && verts[1] ? kernel.hashCode(verts[1].wrapped, require_constants.HASH_CODE_MAX) : h0;
|
|
226
228
|
edgeVertexHashes.set(edge, [h0, h1]);
|
|
227
229
|
for (const h of [h0, h1]) {
|
|
228
230
|
const bucket = vertexToEdges.get(h) ?? [];
|
|
@@ -326,9 +328,9 @@ function findOuterWireIndex(wires) {
|
|
|
326
328
|
function sectionToFace(shape, plane, options = {}) {
|
|
327
329
|
const sectionResult = section(shape, plane, options);
|
|
328
330
|
if (!sectionResult.ok) return sectionResult;
|
|
329
|
-
const wires =
|
|
331
|
+
const wires = require_shapeFns.getWires(sectionResult.value);
|
|
330
332
|
if (wires.length === 0) {
|
|
331
|
-
const edges =
|
|
333
|
+
const edges = require_shapeFns.getEdges(sectionResult.value);
|
|
332
334
|
if (edges.length === 0) return require_errors.err(require_errors.kernelError("SECTION_FAILED", "sectionToFace: section produced no geometry", void 0, void 0, "The cutting plane may not intersect the shape. Verify plane position relative to shape bounds."));
|
|
333
335
|
wires.push(...assembleWiresFromEdges(edges));
|
|
334
336
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Y as getKernel, h as isShape3D, t as castShape } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, R as unwrap, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { n as HASH_CODE_MAX } from "./constants-B9u763C3.js";
|
|
4
|
+
import { h as vecScale, t as vecAdd } from "./vecOps-D9etjPgV.js";
|
|
5
|
+
import { o as resolvePlane } from "./planeOps-gTOEarV2.js";
|
|
6
|
+
import { F as getVertices, I as getWires, M as getEdges, _ as propagateAllMetadata, g as collectInputFaceHashes, v as propagateMetadataByHash } from "./shapeFns-DCi9O27X.js";
|
|
7
|
+
import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
|
|
8
|
+
import { r as makeFace } from "./surfaceBuilders-DE5e6bp8.js";
|
|
7
9
|
//#region src/topology/booleanFns.ts
|
|
8
10
|
/**
|
|
9
11
|
* Boolean and compound operations — functional replacements for _3DShape boolean methods.
|