brepjs 13.4.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.cjs +15 -14
- package/dist/2d.js +6 -5
- package/dist/arrayAccess-CmulMesb.cjs +40 -0
- package/dist/arrayAccess-xxcB3YNq.js +23 -0
- package/dist/{blueprint-CB_85Lz_.js → blueprint-B3A5x7P9.js} +9 -9
- package/dist/{blueprint-CDnBM-tA.cjs → blueprint-D0XChcek.cjs} +13 -13
- package/dist/{blueprintFns-DVDommWB.js → blueprintFns-BwAMXY3t.js} +4 -125
- package/dist/{blueprintFns-D4YucGaQ.cjs → blueprintFns-COrEYX29.cjs} +3 -142
- package/dist/{boolean2D-lqfKJKUY.cjs → boolean2D-BPsyKImE.cjs} +19 -18
- package/dist/{boolean2D-Mzp-0g7o.js → boolean2D-D_Te-6N6.js} +12 -11
- package/dist/{booleanFns-Bw8sAMgI.cjs → booleanFns-B6M6Lm0V.cjs} +24 -22
- package/dist/{booleanFns-B46fgObh.js → booleanFns-CgsaJFBf.js} +8 -6
- package/dist/brepjs.cjs +301 -90
- package/dist/brepjs.js +189 -26
- package/dist/constants-B9u763C3.js +9 -0
- package/dist/constants-unWN8k4c.cjs +26 -0
- package/dist/core/errors.d.ts +5 -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 +8 -7
- package/dist/core.js +5 -4
- package/dist/{cornerFinder-aBLykolI.js → cornerFinder-AEFnAxt4.js} +3 -3
- package/dist/{cornerFinder-BszIcLqj.cjs → cornerFinder-DTt_SvtC.cjs} +4 -4
- package/dist/{curveFns-DY4dFcP-.js → curveFns-CcInoOEA.js} +2 -2
- package/dist/{curveFns-CZszKLQB.cjs → curveFns-DCEcwcpd.cjs} +2 -2
- package/dist/{drawFns-BHNDF8hb.cjs → drawFns-BOwBIzPa.cjs} +34 -17
- package/dist/{drawFns-l5CY2s-l.js → drawFns-n9qif7QN.js} +16 -14
- package/dist/{errors-BlC5ZWv4.cjs → errors-9zQcQK1H.cjs} +28 -0
- package/dist/{errors-BVOlxlIA.js → errors-C-cgQA3w.js} +23 -1
- package/dist/{extrudeFns-b0uLn4E4.js → extrudeFns-DrDr9-nU.js} +3 -3
- package/dist/{extrudeFns-GpCB_Uzs.cjs → extrudeFns-Rcut7h8S.cjs} +3 -3
- package/dist/{faceFns-Cat-4X74.js → faceFns-TSH54pPQ.js} +93 -3
- package/dist/{faceFns-BywUjlJ7.cjs → faceFns-cE2WxY6I.cjs} +110 -2
- package/dist/{helpers-1iCCEElA.cjs → helpers-DZje6XWE.cjs} +18 -17
- package/dist/{helpers-DgX1UucG.js → helpers-XrXlKm8D.js} +8 -7
- package/dist/{historyFns-BFwp8NLX.js → historyFns-2hCWrX_X.js} +10 -10
- package/dist/{historyFns-DqxDtXIZ.cjs → historyFns-BiQ9dmzp.cjs} +10 -10
- package/dist/{importFns-ChXEJAvu.cjs → importFns-DGE5nCSW.cjs} +4 -4
- package/dist/{importFns-Cb8fcldB.js → importFns-m0xyj0Zt.js} +4 -4
- package/dist/index.d.ts +11 -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 +149 -242
- 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/{measureFns-D3rAp1X1.js → measureFns-DHByqdmn.js} +9 -16
- package/dist/{measureFns-Bx-kl7_g.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-D3KAZ_ma.cjs → meshFns-CVe3Kc77.cjs} +4 -4
- package/dist/{meshFns-BPi0bhm9.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-BqLav0Ir.cjs → planeOps-6Wu7dMDN.cjs} +4 -3
- package/dist/{planeOps-D88tfyJs.js → planeOps-gTOEarV2.js} +3 -2
- package/dist/{primitiveFns-BGh9A9jR.cjs → primitiveFns-CRPGjIFg.cjs} +69 -69
- package/dist/{primitiveFns-CnZkW6Bi.js → primitiveFns-CeKiYSSW.js} +7 -7
- 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-B5LgmXBo.js → shapeFns-DCi9O27X.js} +8 -30
- package/dist/{arrayAccess-t2dlxGSK.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-Di6GlhPk.js → shapeTypes-BO1aiDhi.js} +2642 -2546
- package/dist/{shapeTypes-8eK48l-X.cjs → shapeTypes-BqWQlrYE.cjs} +2642 -2546
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-D9KYP9sL.cjs → solidBuilders-0iVdiZUw.cjs} +3 -3
- package/dist/{solidBuilders-ctO_wFrm.js → solidBuilders-jk7HfWs8.js} +3 -3
- package/dist/{surfaceBuilders-CZzipftq.cjs → surfaceBuilders-C_8rs79F.cjs} +3 -3
- package/dist/{surfaceBuilders-BaqeZa0x.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/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 +20 -20
- package/dist/topology.js +6 -6
- package/dist/{vecOps-DKGelwGL.cjs → vecOps-BXvBYIor.cjs} +0 -26
- package/dist/{vecOps-DFfUfsmc.js → vecOps-D9etjPgV.js} +1 -9
- package/dist/vectors.cjs +5 -4
- package/dist/vectors.js +3 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +1 -1
- package/package.json +14 -4
- /package/dist/{workerHandler-nLkvSOKX.cjs → workerHandler-C-7OUJsa.cjs} +0 -0
- /package/dist/{workerHandler-BrOTzYRI.js → workerHandler-o2xzAfFk.js} +0 -0
package/dist/2d.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
3
|
-
const require_errors = require("./errors-
|
|
4
|
-
const
|
|
5
|
-
const require_boolean2D = require("./boolean2D-
|
|
6
|
-
const require_blueprint = require("./blueprint-
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-BqWQlrYE.cjs");
|
|
3
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-cE2WxY6I.cjs");
|
|
5
|
+
const require_boolean2D = require("./boolean2D-BPsyKImE.cjs");
|
|
6
|
+
const require_blueprint = require("./blueprint-D0XChcek.cjs");
|
|
7
|
+
const require_blueprintFns = require("./blueprintFns-COrEYX29.cjs");
|
|
7
8
|
//#region src/core/curve2dHandle.ts
|
|
8
9
|
/**
|
|
9
10
|
* Wrap a raw kernel 2D curve handle with brand + disposal tracking.
|
|
@@ -50,7 +51,7 @@ function wrapRawHandle(raw) {
|
|
|
50
51
|
}
|
|
51
52
|
/** Wrap a kernel call that returns a raw curve handle into Result<Curve2DHandle>. */
|
|
52
53
|
function curveCall(fn, code, message) {
|
|
53
|
-
const result =
|
|
54
|
+
const result = require_faceFns.kernelCallRaw(fn, code, message);
|
|
54
55
|
if (!result.ok) return result;
|
|
55
56
|
return require_errors.ok(wrapRawHandle(result.value));
|
|
56
57
|
}
|
|
@@ -125,19 +126,19 @@ function offsetCurve2d(curve, distance) {
|
|
|
125
126
|
}
|
|
126
127
|
/** Evaluate a point on a 2D curve at a parameter value. */
|
|
127
128
|
function evaluateCurve2d(curve, param) {
|
|
128
|
-
return
|
|
129
|
+
return require_faceFns.kernelCallRaw(() => require_shapeTypes.getKernel2D().evaluateCurve2d(curve.raw, param), CURVE2D_QUERY_FAILED, "Failed to evaluate 2D curve");
|
|
129
130
|
}
|
|
130
131
|
/** Evaluate point and tangent on a 2D curve at a parameter value. */
|
|
131
132
|
function tangentCurve2d(curve, param) {
|
|
132
|
-
return
|
|
133
|
+
return require_faceFns.kernelCallRaw(() => require_shapeTypes.getKernel2D().evaluateCurve2dD1(curve.raw, param), CURVE2D_QUERY_FAILED, "Failed to evaluate 2D curve tangent");
|
|
133
134
|
}
|
|
134
135
|
/** Get the parameter bounds of a 2D curve. */
|
|
135
136
|
function boundsCurve2d(curve) {
|
|
136
|
-
return
|
|
137
|
+
return require_faceFns.kernelCallRaw(() => require_shapeTypes.getKernel2D().getCurve2dBounds(curve.raw), CURVE2D_QUERY_FAILED, "Failed to get 2D curve bounds");
|
|
137
138
|
}
|
|
138
139
|
/** Get the geometric type of a 2D curve (e.g., "Line", "Circle", "BSpline"). */
|
|
139
140
|
function typeCurve2d(curve) {
|
|
140
|
-
return
|
|
141
|
+
return require_faceFns.kernelCallRaw(() => require_shapeTypes.getKernel2D().getCurve2dType(curve.raw), CURVE2D_QUERY_FAILED, "Failed to get 2D curve type");
|
|
141
142
|
}
|
|
142
143
|
/**
|
|
143
144
|
* Find intersection points and overlap segments between two 2D curves.
|
|
@@ -148,7 +149,7 @@ function typeCurve2d(curve) {
|
|
|
148
149
|
* @param tolerance - Intersection tolerance (default: `1e-7`).
|
|
149
150
|
*/
|
|
150
151
|
function intersectCurves2d(c1, c2, tolerance = 1e-7) {
|
|
151
|
-
return
|
|
152
|
+
return require_faceFns.kernelCallRaw(() => {
|
|
152
153
|
const result = require_shapeTypes.getKernel2D().intersectCurves2d(c1.raw, c2.raw, tolerance);
|
|
153
154
|
const wrapped = [];
|
|
154
155
|
try {
|
|
@@ -172,7 +173,7 @@ function intersectCurves2d(c1, c2, tolerance = 1e-7) {
|
|
|
172
173
|
* not an error. Only kernel failures produce `err()`.
|
|
173
174
|
*/
|
|
174
175
|
function projectPointOnCurve2d(curve, point) {
|
|
175
|
-
return
|
|
176
|
+
return require_faceFns.kernelCallRaw(() => require_shapeTypes.getKernel2D().projectPointOnCurve2d(curve.raw, point[0], point[1]), CURVE2D_QUERY_FAILED, "Failed to project point onto 2D curve");
|
|
176
177
|
}
|
|
177
178
|
/**
|
|
178
179
|
* Compute the minimum distance between two 2D curves.
|
|
@@ -181,7 +182,7 @@ function projectPointOnCurve2d(curve, point) {
|
|
|
181
182
|
* @param bounds2 - Optional parameter range for c2 (default: full curve bounds).
|
|
182
183
|
*/
|
|
183
184
|
function distanceBetweenCurves2d(c1, c2, bounds1, bounds2) {
|
|
184
|
-
return
|
|
185
|
+
return require_faceFns.kernelCallRaw(() => {
|
|
185
186
|
const kernel = require_shapeTypes.getKernel2D();
|
|
186
187
|
const b1 = bounds1 ?? kernel.getCurve2dBounds(c1.raw);
|
|
187
188
|
const b2 = bounds2 ?? kernel.getCurve2dBounds(c2.raw);
|
|
@@ -195,7 +196,7 @@ function distanceBetweenCurves2d(c1, c2, bounds1, bounds2) {
|
|
|
195
196
|
* `plane.origin` → `planeOrigin`, `plane.zDir` → `planeZ`, `plane.xDir` → `planeX`.
|
|
196
197
|
*/
|
|
197
198
|
function liftCurve2dToPlane(curve, plane) {
|
|
198
|
-
return
|
|
199
|
+
return require_faceFns.kernelCallRaw(() => {
|
|
199
200
|
return require_shapeTypes.createEdge(require_shapeTypes.getKernel2D().liftCurve2dToPlane(curve.raw, [...plane.origin], [...plane.zDir], [...plane.xDir]));
|
|
200
201
|
}, CURVE2D_BRIDGE_FAILED, "Failed to lift 2D curve to plane");
|
|
201
202
|
}
|
package/dist/2d.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { X as getKernel2D, a as createEdge, z as createKernelHandle } from "./shapeTypes-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as fuseBlueprints, c as roundedRectangleBlueprint, g as Blueprints, h as CompoundBlueprint, i as cutBlueprints, m as organiseBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
5
|
-
import { _ as Curve2D, t as Blueprint, y as BoundingBox2d } from "./blueprint-
|
|
1
|
+
import { X as getKernel2D, a as createEdge, z as createKernelHandle } from "./shapeTypes-BO1aiDhi.js";
|
|
2
|
+
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
|
|
3
|
+
import { C as kernelCallRaw } from "./faceFns-TSH54pPQ.js";
|
|
4
|
+
import { a as fuseBlueprints, c as roundedRectangleBlueprint, g as Blueprints, h as CompoundBlueprint, i as cutBlueprints, m as organiseBlueprints, n as fuse2D, o as intersectBlueprints, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-D_Te-6N6.js";
|
|
5
|
+
import { _ as Curve2D, t as Blueprint, y as BoundingBox2d } from "./blueprint-B3A5x7P9.js";
|
|
6
|
+
import { S as reverseCurve, _ as curve2dIsOnCurve, a as isInside2D, b as curve2dSplitAt, c as scale2D, d as stretch2D, f as toSVGPathD, g as curve2dFirstPoint, h as curve2dDistanceFrom, i as getOrientation2D, l as sketchOnFace2D, m as curve2dBoundingBox, o as mirror2D, p as translate2D, r as getBounds2D, s as rotate2D, t as createBlueprint, u as sketchOnPlane2D, v as curve2dLastPoint, x as curve2dTangentAt, y as curve2dParameter } from "./blueprintFns-BwAMXY3t.js";
|
|
6
7
|
//#region src/core/curve2dHandle.ts
|
|
7
8
|
/**
|
|
8
9
|
* Wrap a raw kernel 2D curve handle with brand + disposal tracking.
|
|
@@ -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 {
|
|
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";
|
|
4
5
|
import { r as toVec3 } from "./types-BWBlwp6w.js";
|
|
5
|
-
import { r as makePlane } from "./planeOps-
|
|
6
|
-
import {
|
|
7
|
-
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { _ as samePoint, b as subtract2d, l as add2d, o as normalize2d, p as distance2d, t as getSingleFace, v as scalarMultiply2d } from "./helpers-DgX1UucG.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
|
|
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");
|
|
4
5
|
const require_types = require("./types-BjDcsS7l.cjs");
|
|
5
|
-
const require_planeOps = require("./planeOps-
|
|
6
|
-
const
|
|
7
|
-
const require_arrayAccess = require("./arrayAccess-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const require_helpers = require("./helpers-1iCCEElA.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,127 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as Blueprint } from "./blueprint-CB_85Lz_.js";
|
|
5
|
-
//#region src/core/kernelCall.ts
|
|
6
|
-
var errorFactories = {
|
|
7
|
-
KERNEL_OPERATION: (code, message, cause) => ({
|
|
8
|
-
kind: "KERNEL_OPERATION",
|
|
9
|
-
code,
|
|
10
|
-
message,
|
|
11
|
-
cause
|
|
12
|
-
}),
|
|
13
|
-
VALIDATION: (code, message, cause) => ({
|
|
14
|
-
kind: "VALIDATION",
|
|
15
|
-
code,
|
|
16
|
-
message,
|
|
17
|
-
cause
|
|
18
|
-
}),
|
|
19
|
-
TYPE_CAST: (code, message, cause) => ({
|
|
20
|
-
kind: "TYPE_CAST",
|
|
21
|
-
code,
|
|
22
|
-
message,
|
|
23
|
-
cause
|
|
24
|
-
}),
|
|
25
|
-
SKETCHER_STATE: (code, message, cause) => ({
|
|
26
|
-
kind: "SKETCHER_STATE",
|
|
27
|
-
code,
|
|
28
|
-
message,
|
|
29
|
-
cause
|
|
30
|
-
}),
|
|
31
|
-
MODULE_INIT: (code, message, cause) => ({
|
|
32
|
-
kind: "MODULE_INIT",
|
|
33
|
-
code,
|
|
34
|
-
message,
|
|
35
|
-
cause
|
|
36
|
-
}),
|
|
37
|
-
COMPUTATION: (code, message, cause) => ({
|
|
38
|
-
kind: "COMPUTATION",
|
|
39
|
-
code,
|
|
40
|
-
message,
|
|
41
|
-
cause
|
|
42
|
-
}),
|
|
43
|
-
IO: (code, message, cause) => ({
|
|
44
|
-
kind: "IO",
|
|
45
|
-
code,
|
|
46
|
-
message,
|
|
47
|
-
cause
|
|
48
|
-
}),
|
|
49
|
-
QUERY: (code, message, cause) => ({
|
|
50
|
-
kind: "QUERY",
|
|
51
|
-
code,
|
|
52
|
-
message,
|
|
53
|
-
cause
|
|
54
|
-
}),
|
|
55
|
-
UNSUPPORTED: (code, message, cause) => ({
|
|
56
|
-
kind: "UNSUPPORTED",
|
|
57
|
-
code,
|
|
58
|
-
message,
|
|
59
|
-
cause
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Wrap a kernel call that returns an KernelShape, automatically casting
|
|
64
|
-
* the result into a branded AnyShape. On exception, returns an Err
|
|
65
|
-
* with the given error code and message.
|
|
66
|
-
*
|
|
67
|
-
* kernel error messages are automatically translated into user-friendly
|
|
68
|
-
* explanations when the error kind is KERNEL_OPERATION.
|
|
69
|
-
*/
|
|
70
|
-
function kernelCall(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
71
|
-
try {
|
|
72
|
-
return ok(castShape(fn()));
|
|
73
|
-
} catch (e) {
|
|
74
|
-
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
75
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ? translateKernelError(rawMessage) : rawMessage;
|
|
76
|
-
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Wrap a kernel call that returns an arbitrary value. On exception,
|
|
81
|
-
* returns an Err with the given error code and message.
|
|
82
|
-
*
|
|
83
|
-
* kernel error messages are automatically translated into user-friendly
|
|
84
|
-
* explanations when the error kind is KERNEL_OPERATION.
|
|
85
|
-
*/
|
|
86
|
-
function kernelCallRaw(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
87
|
-
try {
|
|
88
|
-
return ok(fn());
|
|
89
|
-
} catch (e) {
|
|
90
|
-
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
91
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ? translateKernelError(rawMessage) : rawMessage;
|
|
92
|
-
return err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Wrap a kernel call that needs intermediate kernel allocations.
|
|
97
|
-
*
|
|
98
|
-
* A DisposalScope is created and passed to fn. The scope is disposed
|
|
99
|
-
* deterministically after fn returns or throws — ensuring no intermediate
|
|
100
|
-
* handles are leaked even on error paths.
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* return kernelCallScoped(
|
|
104
|
-
* (scope) => {
|
|
105
|
-
* const axis = scope.register(makeKernelAx1(origin, dir));
|
|
106
|
-
* return getKernel().revolveVec(...) // was: oc.BRepBuilderAPI_MakeRevol_1(shape.wrapped, axis).Shape();
|
|
107
|
-
* },
|
|
108
|
-
* BrepErrorCode.REVOLUTION_NOT_3D,
|
|
109
|
-
* 'Revolution failed'
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
function kernelCallScoped(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
114
|
-
try {
|
|
115
|
-
var _usingCtx$1 = _usingCtx();
|
|
116
|
-
const scope = _usingCtx$1.u(new DisposalScope());
|
|
117
|
-
return kernelCall(() => fn(scope), code, message, kind);
|
|
118
|
-
} catch (_) {
|
|
119
|
-
_usingCtx$1.e = _;
|
|
120
|
-
} finally {
|
|
121
|
-
_usingCtx$1.d();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
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";
|
|
125
4
|
//#region src/2d/lib/curve2dFns.ts
|
|
126
5
|
/**
|
|
127
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -249,4 +128,4 @@ function sketchOnFace2D(bp, face, scaleMode) {
|
|
|
249
128
|
return bp.sketchOnFace(face, scaleMode);
|
|
250
129
|
}
|
|
251
130
|
//#endregion
|
|
252
|
-
export {
|
|
131
|
+
export { reverseCurve as S, curve2dIsOnCurve as _, isInside2D as a, curve2dSplitAt as b, scale2D as c, stretch2D as d, toSVGPathD as f, curve2dFirstPoint as g, curve2dDistanceFrom as h, getOrientation2D as i, sketchOnFace2D as l, curve2dBoundingBox as m, createCompoundBlueprint as n, mirror2D as o, translate2D as p, getBounds2D as r, rotate2D as s, createBlueprint as t, sketchOnPlane2D as u, curve2dLastPoint as v, curve2dTangentAt as x, curve2dParameter as y };
|
|
@@ -1,127 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_blueprint = require("./blueprint-CDnBM-tA.cjs");
|
|
5
|
-
//#region src/core/kernelCall.ts
|
|
6
|
-
var errorFactories = {
|
|
7
|
-
KERNEL_OPERATION: (code, message, cause) => ({
|
|
8
|
-
kind: "KERNEL_OPERATION",
|
|
9
|
-
code,
|
|
10
|
-
message,
|
|
11
|
-
cause
|
|
12
|
-
}),
|
|
13
|
-
VALIDATION: (code, message, cause) => ({
|
|
14
|
-
kind: "VALIDATION",
|
|
15
|
-
code,
|
|
16
|
-
message,
|
|
17
|
-
cause
|
|
18
|
-
}),
|
|
19
|
-
TYPE_CAST: (code, message, cause) => ({
|
|
20
|
-
kind: "TYPE_CAST",
|
|
21
|
-
code,
|
|
22
|
-
message,
|
|
23
|
-
cause
|
|
24
|
-
}),
|
|
25
|
-
SKETCHER_STATE: (code, message, cause) => ({
|
|
26
|
-
kind: "SKETCHER_STATE",
|
|
27
|
-
code,
|
|
28
|
-
message,
|
|
29
|
-
cause
|
|
30
|
-
}),
|
|
31
|
-
MODULE_INIT: (code, message, cause) => ({
|
|
32
|
-
kind: "MODULE_INIT",
|
|
33
|
-
code,
|
|
34
|
-
message,
|
|
35
|
-
cause
|
|
36
|
-
}),
|
|
37
|
-
COMPUTATION: (code, message, cause) => ({
|
|
38
|
-
kind: "COMPUTATION",
|
|
39
|
-
code,
|
|
40
|
-
message,
|
|
41
|
-
cause
|
|
42
|
-
}),
|
|
43
|
-
IO: (code, message, cause) => ({
|
|
44
|
-
kind: "IO",
|
|
45
|
-
code,
|
|
46
|
-
message,
|
|
47
|
-
cause
|
|
48
|
-
}),
|
|
49
|
-
QUERY: (code, message, cause) => ({
|
|
50
|
-
kind: "QUERY",
|
|
51
|
-
code,
|
|
52
|
-
message,
|
|
53
|
-
cause
|
|
54
|
-
}),
|
|
55
|
-
UNSUPPORTED: (code, message, cause) => ({
|
|
56
|
-
kind: "UNSUPPORTED",
|
|
57
|
-
code,
|
|
58
|
-
message,
|
|
59
|
-
cause
|
|
60
|
-
})
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Wrap a kernel call that returns an KernelShape, automatically casting
|
|
64
|
-
* the result into a branded AnyShape. On exception, returns an Err
|
|
65
|
-
* with the given error code and message.
|
|
66
|
-
*
|
|
67
|
-
* kernel error messages are automatically translated into user-friendly
|
|
68
|
-
* explanations when the error kind is KERNEL_OPERATION.
|
|
69
|
-
*/
|
|
70
|
-
function kernelCall(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
71
|
-
try {
|
|
72
|
-
return require_errors.ok(require_shapeTypes.castShape(fn()));
|
|
73
|
-
} catch (e) {
|
|
74
|
-
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
75
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ? require_errors.translateKernelError(rawMessage) : rawMessage;
|
|
76
|
-
return require_errors.err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Wrap a kernel call that returns an arbitrary value. On exception,
|
|
81
|
-
* returns an Err with the given error code and message.
|
|
82
|
-
*
|
|
83
|
-
* kernel error messages are automatically translated into user-friendly
|
|
84
|
-
* explanations when the error kind is KERNEL_OPERATION.
|
|
85
|
-
*/
|
|
86
|
-
function kernelCallRaw(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
87
|
-
try {
|
|
88
|
-
return require_errors.ok(fn());
|
|
89
|
-
} catch (e) {
|
|
90
|
-
const rawMessage = e instanceof Error ? e.message : String(e);
|
|
91
|
-
const translatedMessage = kind === "KERNEL_OPERATION" ? require_errors.translateKernelError(rawMessage) : rawMessage;
|
|
92
|
-
return require_errors.err(errorFactories[kind](code, `${message}: ${translatedMessage}`, e));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Wrap a kernel call that needs intermediate kernel allocations.
|
|
97
|
-
*
|
|
98
|
-
* A DisposalScope is created and passed to fn. The scope is disposed
|
|
99
|
-
* deterministically after fn returns or throws — ensuring no intermediate
|
|
100
|
-
* handles are leaked even on error paths.
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* return kernelCallScoped(
|
|
104
|
-
* (scope) => {
|
|
105
|
-
* const axis = scope.register(makeKernelAx1(origin, dir));
|
|
106
|
-
* return getKernel().revolveVec(...) // was: oc.BRepBuilderAPI_MakeRevol_1(shape.wrapped, axis).Shape();
|
|
107
|
-
* },
|
|
108
|
-
* BrepErrorCode.REVOLUTION_NOT_3D,
|
|
109
|
-
* 'Revolution failed'
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
function kernelCallScoped(fn, code, message, kind = "KERNEL_OPERATION") {
|
|
114
|
-
try {
|
|
115
|
-
var _usingCtx$1 = require_shapeTypes._usingCtx();
|
|
116
|
-
const scope = _usingCtx$1.u(new require_shapeTypes.DisposalScope());
|
|
117
|
-
return kernelCall(() => fn(scope), code, message, kind);
|
|
118
|
-
} catch (_) {
|
|
119
|
-
_usingCtx$1.e = _;
|
|
120
|
-
} finally {
|
|
121
|
-
_usingCtx$1.d();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
1
|
+
const require_errors = require("./errors-9zQcQK1H.cjs");
|
|
2
|
+
const require_boolean2D = require("./boolean2D-BPsyKImE.cjs");
|
|
3
|
+
const require_blueprint = require("./blueprint-D0XChcek.cjs");
|
|
125
4
|
//#region src/2d/lib/curve2dFns.ts
|
|
126
5
|
/**
|
|
127
6
|
* Return a reversed copy of the curve (non-mutating).
|
|
@@ -327,24 +206,6 @@ Object.defineProperty(exports, "isInside2D", {
|
|
|
327
206
|
return isInside2D;
|
|
328
207
|
}
|
|
329
208
|
});
|
|
330
|
-
Object.defineProperty(exports, "kernelCall", {
|
|
331
|
-
enumerable: true,
|
|
332
|
-
get: function() {
|
|
333
|
-
return kernelCall;
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
Object.defineProperty(exports, "kernelCallRaw", {
|
|
337
|
-
enumerable: true,
|
|
338
|
-
get: function() {
|
|
339
|
-
return kernelCallRaw;
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
Object.defineProperty(exports, "kernelCallScoped", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function() {
|
|
345
|
-
return kernelCallScoped;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
209
|
Object.defineProperty(exports, "mirror2D", {
|
|
349
210
|
enumerable: true,
|
|
350
211
|
get: function() {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
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");
|
|
4
5
|
const require_types = require("./types-BjDcsS7l.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
-
const require_helpers = require("./helpers-
|
|
11
|
-
const require_blueprint = require("./blueprint-
|
|
12
|
-
const require_extrudeFns = require("./extrudeFns-
|
|
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
|
|
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";
|
|
4
5
|
import { r as toVec3 } from "./types-BWBlwp6w.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { _ as zip, i as makeNewFaceWithinFace, r as makeFace, s as assembleWire } from "./surfaceBuilders-
|
|
10
|
-
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-
|
|
11
|
-
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-
|
|
12
|
-
import { c as twistExtrude, n as revolve, r as complexExtrude, s as sweep, t as extrude } from "./extrudeFns-
|
|
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 {
|