brepjs 12.7.3 → 12.8.1
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/blueprints/boolean2D.d.ts.map +1 -1
- package/dist/2d/blueprints/lib.d.ts.map +1 -1
- package/dist/2d/blueprints/offset.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-CnDVffSX.cjs → Blueprint-CQ28WJhz.cjs} +29 -30
- package/dist/{Blueprint-C3lWY1Jf.js → Blueprint-DbVaf6k7.js} +7 -8
- package/dist/{boolean2D-DyQJt8Na.cjs → boolean2D-0blbVtJ8.cjs} +70 -61
- package/dist/{boolean2D-CwZAIJDS.js → boolean2D-y3E92F0u.js} +37 -28
- package/dist/{booleanFns-CcNUsgI8.js → booleanFns-BCTjYZAg.js} +4 -4
- package/dist/{booleanFns-D7HmkpYt.cjs → booleanFns-gmsX3Cv2.cjs} +59 -59
- package/dist/brepjs.cjs +319 -372
- package/dist/brepjs.js +358 -411
- package/dist/core/errors.d.ts +14 -5
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +30 -31
- package/dist/core.js +19 -20
- package/dist/{cornerFinder-BV-l1BCw.js → cornerFinder-Ckz-mPHE.js} +1 -1
- package/dist/{cornerFinder-3zfbQvXg.cjs → cornerFinder-ZmOyOOsh.cjs} +1 -1
- package/dist/{curveFns-Ch87sD5O.cjs → curveFns-BZngcnQ1.cjs} +17 -17
- package/dist/{curveFns-CloOqAQ_.js → curveFns-mROFhiuG.js} +1 -1
- package/dist/{drawFns-5myJTgtX.js → drawFns-Bwakrq7w.js} +24 -25
- package/dist/{drawFns-CDNafQhv.cjs → drawFns-CjRc1NfQ.cjs} +51 -52
- package/dist/{faceFns-B6ebRh5I.js → faceFns-B8GnxjdY.js} +1 -1
- package/dist/{faceFns-BLTEPBKq.cjs → faceFns-DB1Fc5gy.cjs} +20 -20
- package/dist/{helpers-6kn30cSD.cjs → helpers-C8NoT0Wu.cjs} +14 -14
- package/dist/{helpers-C9KvE1RW.js → helpers-X0juxnwj.js} +4 -4
- package/dist/io.cjs +26 -26
- package/dist/io.js +3 -3
- package/dist/kernel/brepkitAdapter.d.ts +8 -8
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +6 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/historyOps.d.ts +3 -3
- package/dist/kernel/historyOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +8 -8
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-BcZUCGKi.js → loft-Bhw-FMoL.js} +4 -4
- package/dist/{loft-DR1UN5uN.cjs → loft-hp3pc1M7.cjs} +43 -43
- package/dist/{measurement-DoYXRaKI.cjs → measurement-BoNTUBAp.cjs} +1 -1
- package/dist/{measurement-oWvhSVZG.js → measurement-D8EJ694A.js} +1 -1
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-3gy0empP.cjs → meshFns-BnV0ZR8w.cjs} +17 -17
- package/dist/{meshFns-DsLRd3tA.js → meshFns-nQjK38EC.js} +2 -2
- package/dist/{operations-Dcz6YlOt.js → operations-BfbkK6DU.js} +5 -5
- package/dist/{operations-DLFzmdFX.cjs → operations-CYpmLSC4.cjs} +75 -75
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query.cjs +3 -3
- package/dist/query.js +4 -4
- package/dist/{errors-B7kgv0cd.js → result-BaSD1fqR.js} +43 -23
- package/dist/{errors-9fDehDNc.cjs → result-fAX0OZzI.cjs} +20 -0
- package/dist/result.cjs +30 -41
- package/dist/result.js +18 -29
- package/dist/{shapeFns-D-MOoqJd.cjs → shapeFns-C2SnNvdH.cjs} +39 -39
- package/dist/{shapeFns-D2PlLFE6.js → shapeFns-FDuKkrDR.js} +4 -4
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-BzfRBizW.cjs → solidBuilders-994_MQwB.cjs} +12 -12
- package/dist/{solidBuilders-BXhh5hP2.js → solidBuilders-DmwhTCCd.js} +2 -2
- package/dist/{surfaceBuilders-Be_ENWSA.cjs → surfaceBuilders-5VA34a3_.cjs} +27 -27
- package/dist/{surfaceBuilders-D6iDVPIM.js → surfaceBuilders-nQdJ56fe.js} +2 -2
- package/dist/{topology-CKtCGLmb.cjs → topology-ANwCzGL8.cjs} +54 -54
- package/dist/{topology-DxD58iQ6.js → topology-C7x98OVn.js} +8 -8
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/dist/{vectors-CESkzEm6.js → vectors-Bx8wkNui.js} +1 -1
- package/dist/{vectors-BafmMf96.cjs → vectors-D_IiZx0q.cjs} +6 -6
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +1 -1
- package/package.json +5 -8
package/dist/core/errors.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Re-exports bug/BrepBugError from utils (Layer 0) for convenience.
|
|
4
|
-
*/
|
|
5
|
-
export { bug, BrepBugError } from '../utils/bug.js';
|
|
1
|
+
import { bug, BrepBugError } from '../utils/bug.js';
|
|
2
|
+
export { bug, BrepBugError };
|
|
6
3
|
/** High-level category for a brepjs error. */
|
|
7
4
|
export type BrepErrorKind = 'KERNEL_OPERATION' | 'VALIDATION' | 'TYPE_CAST' | 'SKETCHER_STATE' | 'MODULE_INIT' | 'COMPUTATION' | 'IO' | 'QUERY' | 'UNSUPPORTED';
|
|
8
5
|
/**
|
|
@@ -147,4 +144,16 @@ export declare function unsupportedError(code: string, message: string, cause?:
|
|
|
147
144
|
* @returns User-friendly error message with actionable guidance
|
|
148
145
|
*/
|
|
149
146
|
export declare function translateKernelError(kernelMessage: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Safe array index access that throws a descriptive {@link BrepBugError} instead
|
|
149
|
+
* of returning `undefined` when the index is out of bounds.
|
|
150
|
+
*
|
|
151
|
+
* Use in place of `arr[i]!` when the caller can prove the index is valid by
|
|
152
|
+
* construction but TypeScript's `noUncheckedIndexedAccess` still requires a guard.
|
|
153
|
+
*
|
|
154
|
+
* @param arr - The array to index into.
|
|
155
|
+
* @param index - The index to access.
|
|
156
|
+
* @param context - Optional caller context for the error message (e.g. function name).
|
|
157
|
+
*/
|
|
158
|
+
export declare function safeIndex<T>(arr: readonly T[], index: number, context?: string): T;
|
|
150
159
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;AAM7B,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,IAAI,GACJ,OAAO,GACP,aAAa,CAAC;AAMlB;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0HhB,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAM/E;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC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E,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAMlF"}
|
package/dist/core.cjs
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const types = require("./types-CA_xrgDq.cjs");
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const
|
|
6
|
-
const vectors = require("./vectors-
|
|
5
|
+
const result = require("./result-fAX0OZzI.cjs");
|
|
6
|
+
const vectors = require("./vectors-D_IiZx0q.cjs");
|
|
7
7
|
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
8
|
-
const result = require("./result.cjs");
|
|
9
8
|
exports.resolveDirection = types.resolveDirection;
|
|
10
9
|
exports.toVec2 = types.toVec2;
|
|
11
10
|
exports.toVec3 = types.toVec3;
|
|
@@ -28,32 +27,34 @@ exports.vecRepr = vecOps.vecRepr;
|
|
|
28
27
|
exports.vecRotate = vecOps.vecRotate;
|
|
29
28
|
exports.vecScale = vecOps.vecScale;
|
|
30
29
|
exports.vecSub = vecOps.vecSub;
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
30
|
+
exports.BrepBugError = result.BrepBugError;
|
|
31
|
+
exports.OK = result.OK;
|
|
32
|
+
exports.andThen = result.andThen;
|
|
33
|
+
exports.bug = result.bug;
|
|
34
|
+
exports.collect = result.collect;
|
|
35
|
+
exports.computationError = result.computationError;
|
|
36
|
+
exports.err = result.err;
|
|
37
|
+
exports.flatMap = result.flatMap;
|
|
38
|
+
exports.ioError = result.ioError;
|
|
39
|
+
exports.isErr = result.isErr;
|
|
40
|
+
exports.isOk = result.isOk;
|
|
41
|
+
exports.kernelError = result.kernelError;
|
|
42
|
+
exports.map = result.map;
|
|
43
|
+
exports.mapErr = result.mapErr;
|
|
44
|
+
exports.match = result.match;
|
|
45
|
+
exports.moduleInitError = result.moduleInitError;
|
|
46
|
+
exports.ok = result.ok;
|
|
47
|
+
exports.queryError = result.queryError;
|
|
48
|
+
exports.sketcherStateError = result.sketcherStateError;
|
|
49
|
+
exports.tryCatch = result.tryCatch;
|
|
50
|
+
exports.tryCatchAsync = result.tryCatchAsync;
|
|
51
|
+
exports.typeCastError = result.typeCastError;
|
|
52
|
+
exports.unsupportedError = result.unsupportedError;
|
|
53
|
+
exports.unwrap = result.unwrap;
|
|
54
|
+
exports.unwrapErr = result.unwrapErr;
|
|
55
|
+
exports.unwrapOr = result.unwrapOr;
|
|
56
|
+
exports.unwrapOrElse = result.unwrapOrElse;
|
|
57
|
+
exports.validationError = result.validationError;
|
|
57
58
|
exports.createNamedPlane = vectors.createNamedPlane;
|
|
58
59
|
exports.createPlane = vectors.createPlane;
|
|
59
60
|
exports.pivotPlane = vectors.pivotPlane;
|
|
@@ -87,5 +88,3 @@ exports.validSolid = shapeTypes.validSolid;
|
|
|
87
88
|
exports.withScope = shapeTypes.withScope;
|
|
88
89
|
exports.withScopeResult = shapeTypes.withScopeResult;
|
|
89
90
|
exports.withScopeResultAsync = shapeTypes.withScopeResultAsync;
|
|
90
|
-
exports.BrepBugError = result.BrepBugError;
|
|
91
|
-
exports.bug = result.bug;
|
package/dist/core.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { r, t, a } from "./types-CWDdqcrq.js";
|
|
2
2
|
import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
|
|
3
|
-
import { O, a as a3, c as c2,
|
|
4
|
-
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-
|
|
5
|
-
import { D as D2, c as c4, a as a5, b as b3, d as d3, g as g3, i as i3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, o as o3, p as p3, q as q2, r as r4, s as s2, t as t4, u as u2, v as v3, w as w2, x as x2, y as y2, z, A } from "./shapeTypes-CpSaBLDv.js";
|
|
6
|
-
import { BrepBugError, bug } from "./result.js";
|
|
3
|
+
import { B, O, a as a3, b as b2, c as c2, d as d2, e as e2, f as f2, i as i2, g as g2, h as h2, k as k2, m as m2, j as j2, l as l2, n as n2, o as o2, q, s, t as t2, p, r as r2, u, v as v2, w, x, y, z } from "./result-BaSD1fqR.js";
|
|
4
|
+
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-Bx8wkNui.js";
|
|
5
|
+
import { D as D2, c as c4, a as a5, b as b3, d as d3, g as g3, i as i3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, o as o3, p as p3, q as q2, r as r4, s as s2, t as t4, u as u2, v as v3, w as w2, x as x2, y as y2, z as z2, A } from "./shapeTypes-CpSaBLDv.js";
|
|
7
6
|
export {
|
|
8
|
-
BrepBugError,
|
|
7
|
+
B as BrepBugError,
|
|
9
8
|
D as DEG2RAD,
|
|
10
9
|
D2 as DisposalScope,
|
|
11
10
|
H as HASH_CODE_MAX,
|
|
12
11
|
O as OK,
|
|
13
12
|
R as RAD2DEG,
|
|
14
13
|
a3 as andThen,
|
|
15
|
-
bug,
|
|
14
|
+
b2 as bug,
|
|
16
15
|
c4 as castShape,
|
|
17
16
|
a5 as closedWire,
|
|
18
17
|
c2 as collect,
|
|
19
|
-
|
|
18
|
+
d2 as computationError,
|
|
20
19
|
b3 as createHandle,
|
|
21
20
|
d3 as createKernelHandle,
|
|
22
21
|
c3 as createNamedPlane,
|
|
@@ -30,11 +29,11 @@ export {
|
|
|
30
29
|
f3 as isClosedWire,
|
|
31
30
|
h3 as isCompound,
|
|
32
31
|
j3 as isEdge,
|
|
33
|
-
|
|
32
|
+
g2 as isErr,
|
|
34
33
|
k3 as isFace,
|
|
35
34
|
l3 as isLive,
|
|
36
35
|
m3 as isManifoldShell,
|
|
37
|
-
|
|
36
|
+
h2 as isOk,
|
|
38
37
|
n3 as isOrientedFace,
|
|
39
38
|
o3 as isShape1D,
|
|
40
39
|
p3 as isShape3D,
|
|
@@ -46,9 +45,9 @@ export {
|
|
|
46
45
|
k2 as kernelError,
|
|
47
46
|
v3 as manifoldShell,
|
|
48
47
|
m2 as map,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
j2 as mapErr,
|
|
49
|
+
l2 as match,
|
|
50
|
+
n2 as moduleInitError,
|
|
52
51
|
o2 as ok,
|
|
53
52
|
w2 as orientedFace,
|
|
54
53
|
p2 as pivotPlane,
|
|
@@ -60,15 +59,15 @@ export {
|
|
|
60
59
|
a as toVec3,
|
|
61
60
|
t3 as translatePlane,
|
|
62
61
|
t2 as tryCatch,
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
p as tryCatchAsync,
|
|
63
|
+
r2 as typeCastError,
|
|
65
64
|
u as unsupportedError,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
v2 as unwrap,
|
|
66
|
+
w as unwrapErr,
|
|
67
|
+
x as unwrapOr,
|
|
68
|
+
y as unwrapOrElse,
|
|
70
69
|
x2 as validSolid,
|
|
71
|
-
|
|
70
|
+
z as validationError,
|
|
72
71
|
v as vecAdd,
|
|
73
72
|
a2 as vecAngle,
|
|
74
73
|
b as vecCross,
|
|
@@ -86,6 +85,6 @@ export {
|
|
|
86
85
|
n as vecScale,
|
|
87
86
|
o as vecSub,
|
|
88
87
|
y2 as withScope,
|
|
89
|
-
|
|
88
|
+
z2 as withScopeResult,
|
|
90
89
|
A as withScopeResultAsync
|
|
91
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
2
|
-
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-
|
|
2
|
+
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-X0juxnwj.js";
|
|
3
3
|
const PI_2 = 2 * Math.PI;
|
|
4
4
|
function positiveHalfAngle(angle) {
|
|
5
5
|
const limitedAngle = angle % PI_2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
3
|
-
const helpers = require("./helpers-
|
|
3
|
+
const helpers = require("./helpers-C8NoT0Wu.cjs");
|
|
4
4
|
const PI_2 = 2 * Math.PI;
|
|
5
5
|
function positiveHalfAngle(angle) {
|
|
6
6
|
const limitedAngle = angle % PI_2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
|
|
3
|
-
const
|
|
3
|
+
const result = require("./result-fAX0OZzI.cjs");
|
|
4
4
|
function getCurveType(shape) {
|
|
5
5
|
return shapeTypes.getKernel().curveType(shape.wrapped);
|
|
6
6
|
}
|
|
@@ -43,18 +43,18 @@ function flipOrientation(shape) {
|
|
|
43
43
|
}
|
|
44
44
|
function interpolateCurve(points, options = {}) {
|
|
45
45
|
if (points.length < 2) {
|
|
46
|
-
return
|
|
46
|
+
return result.err(result.typeCastError("INTERPOLATE_MIN_POINTS", "Interpolation requires at least 2 points"));
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
const result = shapeTypes.getKernel().interpolatePoints(points, options);
|
|
50
|
-
const cast = shapeTypes.castShape(result);
|
|
49
|
+
const result$1 = shapeTypes.getKernel().interpolatePoints(points, options);
|
|
50
|
+
const cast = shapeTypes.castShape(result$1);
|
|
51
51
|
if (!shapeTypes.isEdge(cast)) {
|
|
52
|
-
return
|
|
52
|
+
return result.err(result.typeCastError("INTERPOLATE_NOT_EDGE", "Interpolation did not produce an edge"));
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return result.ok(cast);
|
|
55
55
|
} catch (e) {
|
|
56
|
-
return
|
|
57
|
-
|
|
56
|
+
return result.err(
|
|
57
|
+
result.typeCastError(
|
|
58
58
|
"INTERPOLATE_FAILED",
|
|
59
59
|
`Interpolation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
60
60
|
)
|
|
@@ -63,18 +63,18 @@ function interpolateCurve(points, options = {}) {
|
|
|
63
63
|
}
|
|
64
64
|
function approximateCurve(points, options = {}) {
|
|
65
65
|
if (points.length < 2) {
|
|
66
|
-
return
|
|
66
|
+
return result.err(result.typeCastError("APPROXIMATE_MIN_POINTS", "Approximation requires at least 2 points"));
|
|
67
67
|
}
|
|
68
68
|
try {
|
|
69
|
-
const result = shapeTypes.getKernel().approximatePoints(points, options);
|
|
70
|
-
const cast = shapeTypes.castShape(result);
|
|
69
|
+
const result$1 = shapeTypes.getKernel().approximatePoints(points, options);
|
|
70
|
+
const cast = shapeTypes.castShape(result$1);
|
|
71
71
|
if (!shapeTypes.isEdge(cast)) {
|
|
72
|
-
return
|
|
72
|
+
return result.err(result.typeCastError("APPROXIMATE_NOT_EDGE", "Approximation did not produce an edge"));
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return result.ok(cast);
|
|
75
75
|
} catch (e) {
|
|
76
|
-
return
|
|
77
|
-
|
|
76
|
+
return result.err(
|
|
77
|
+
result.typeCastError(
|
|
78
78
|
"APPROXIMATE_FAILED",
|
|
79
79
|
`Approximation failed: ${e instanceof Error ? e.message : String(e)}`
|
|
80
80
|
)
|
|
@@ -93,9 +93,9 @@ function offsetWire2D(wire, offset, kind = "arc") {
|
|
|
93
93
|
const wrapped = shapeTypes.castShape(resultShape);
|
|
94
94
|
if (!shapeTypes.isWire(wrapped)) {
|
|
95
95
|
wrapped[Symbol.dispose]();
|
|
96
|
-
return
|
|
96
|
+
return result.err(result.typeCastError("OFFSET_NOT_WIRE", "Offset did not produce a Wire"));
|
|
97
97
|
}
|
|
98
|
-
return
|
|
98
|
+
return result.ok(wrapped);
|
|
99
99
|
}
|
|
100
100
|
exports.approximateCurve = approximateCurve;
|
|
101
101
|
exports.curveEndPoint = curveEndPoint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as getKernel, c as castShape, j as isEdge, u as isWire } from "./shapeTypes-CpSaBLDv.js";
|
|
2
|
-
import { e as err,
|
|
2
|
+
import { e as err, r as typeCastError, o as ok } from "./result-BaSD1fqR.js";
|
|
3
3
|
function getCurveType(shape) {
|
|
4
4
|
return getKernel().curveType(shape.wrapped);
|
|
5
5
|
}
|
|
@@ -43,23 +43,22 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
43
43
|
};
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
|
-
import {
|
|
47
|
-
import { r as resolvePlane, b as planeToWorld } from "./vectors-
|
|
46
|
+
import { b as bug, v as unwrap, h as isOk, C as safeIndex, e as err, z as validationError, o as ok } from "./result-BaSD1fqR.js";
|
|
47
|
+
import { r as resolvePlane, b as planeToWorld } from "./vectors-Bx8wkNui.js";
|
|
48
48
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
49
49
|
import { j as vecNormalize, b as vecCross, o as vecSub, n as vecScale, m as vecRotate, D as DEG2RAD, g as vecLength } from "./vecOps-ZDdZWbwT.js";
|
|
50
|
-
import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-
|
|
51
|
-
import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-
|
|
52
|
-
import { o as offsetWire2D } from "./curveFns-
|
|
53
|
-
import { b as assembleWire, d as addHolesInFace, m as makeFace, e as makeCircle, f as makeEllipse, c as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-
|
|
50
|
+
import { b as Flatbush, B as BaseSketcher2d, S as Sketch, r as roundedRectangleBlueprint, c as Blueprints, C as CompoundBlueprint, d as cut2D, i as intersectCurves, f as fuse2D, m as make2dOffset, e as filletCurves, g as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, h as intersect2D, p as polysidesBlueprint } from "./boolean2D-y3E92F0u.js";
|
|
51
|
+
import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-B8GnxjdY.js";
|
|
52
|
+
import { o as offsetWire2D } from "./curveFns-mROFhiuG.js";
|
|
53
|
+
import { b as assembleWire, d as addHolesInFace, m as makeFace, e as makeCircle, f as makeEllipse, c as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-nQdJ56fe.js";
|
|
54
54
|
import { D as DisposalScope, G as createWire, I as createFace, B as getKernel, k as isFace, c as castShape } from "./shapeTypes-CpSaBLDv.js";
|
|
55
|
-
import { c as curvesAsEdgesOnPlane, m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, d as approximateAsSvgCompatibleCurve, e as BoundingBox2d, f as edgeToCurve, g as make2dInerpolatedBSplineCurve, h as make2dCircle, i as make2dEllipse, j as deserializeCurve2D } from "./Blueprint-
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-BcZUCGKi.js";
|
|
55
|
+
import { c as curvesAsEdgesOnPlane, m as mirror, B as Blueprint, C as Curve2D, a as make2dSegmentCurve, b as make2dArcFromCenter, d as approximateAsSvgCompatibleCurve, e as BoundingBox2d, f as edgeToCurve, g as make2dInerpolatedBSplineCurve, h as make2dCircle, i as make2dEllipse, j as deserializeCurve2D } from "./Blueprint-DbVaf6k7.js";
|
|
56
|
+
import { s as samePoint$1, P as PRECISION_OFFSET, f as squareDistance2d, e as subtract2d, c as add2d } from "./helpers-X0juxnwj.js";
|
|
57
|
+
import { d as getEdges } from "./shapeFns-FDuKkrDR.js";
|
|
58
|
+
import { a as makeCompound, b as makeSolid } from "./solidBuilders-DmwhTCCd.js";
|
|
59
|
+
import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-Bhw-FMoL.js";
|
|
61
60
|
import opentype from "opentype.js";
|
|
62
|
-
import { c as cornerFinder } from "./cornerFinder-
|
|
61
|
+
import { c as cornerFinder } from "./cornerFinder-Ckz-mPHE.js";
|
|
63
62
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
64
63
|
const startPoints = new Flatbush(curves.length);
|
|
65
64
|
curves.forEach((c) => {
|
|
@@ -591,12 +590,12 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
|
|
|
591
590
|
intersections = [...pointIntersections, ...commonSegmentsPoints];
|
|
592
591
|
}
|
|
593
592
|
if (intersections.length > 0) {
|
|
594
|
-
let intersection = intersections
|
|
593
|
+
let intersection = safeIndex(intersections, 0, "rawOffsets");
|
|
595
594
|
if (intersections.length > 1) {
|
|
596
595
|
const originalEndpoint = previousCurve.original.lastPoint;
|
|
597
596
|
let minDist = squareDistance2d(intersection, originalEndpoint);
|
|
598
597
|
for (let i = 1; i < intersections.length; i++) {
|
|
599
|
-
const point = intersections
|
|
598
|
+
const point = safeIndex(intersections, i, "rawOffsets");
|
|
600
599
|
const d = squareDistance2d(point, originalEndpoint);
|
|
601
600
|
if (d < minDist) {
|
|
602
601
|
minDist = d;
|
|
@@ -604,10 +603,11 @@ function rawOffsets(blueprint, offset2, offsetConfig = {}) {
|
|
|
604
603
|
}
|
|
605
604
|
}
|
|
606
605
|
}
|
|
607
|
-
const splitPreviousCurve =
|
|
608
|
-
[intersection],
|
|
609
|
-
|
|
610
|
-
|
|
606
|
+
const splitPreviousCurve = safeIndex(
|
|
607
|
+
previousCurve.offset.splitAt([intersection], PRECISION_OFFSET),
|
|
608
|
+
0,
|
|
609
|
+
"rawOffsets"
|
|
610
|
+
);
|
|
611
611
|
const splitCurve = curve.offset.splitAt([intersection], PRECISION_OFFSET).at(-1);
|
|
612
612
|
if (!splitCurve) bug("offset.rawOffsets", "Split produced no trailing curve segment");
|
|
613
613
|
appendCurve({
|
|
@@ -647,7 +647,7 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
|
|
|
647
647
|
const pairKey = `${firstIndex}-${secondIndex}`;
|
|
648
648
|
if (testedPairs.has(pairKey)) continue;
|
|
649
649
|
testedPairs.add(pairKey);
|
|
650
|
-
const secondCurve = offsettedArray
|
|
650
|
+
const secondCurve = safeIndex(offsettedArray, secondIndex, "offsetBlueprint");
|
|
651
651
|
const { intersections: rawIntersections, commonSegmentsPoints } = unwrap(
|
|
652
652
|
intersectCurves(firstCurve, secondCurve, PRECISION_OFFSET)
|
|
653
653
|
);
|
|
@@ -685,14 +685,14 @@ function offsetBlueprint(blueprint, offset2, offsetConfig = {}) {
|
|
|
685
685
|
const blueprints = curvesGrouped.filter((c) => c.length > 1).map((c) => new Blueprint(c)).filter((b) => b.isClosed());
|
|
686
686
|
if (!blueprints.length) return null;
|
|
687
687
|
if (blueprints.length === 1) {
|
|
688
|
-
return blueprints
|
|
688
|
+
return safeIndex(blueprints, 0, "offsetBlueprint");
|
|
689
689
|
}
|
|
690
690
|
return new Blueprints(blueprints);
|
|
691
691
|
}
|
|
692
692
|
const fuseAll = (blueprints) => {
|
|
693
|
-
let fused = blueprints
|
|
693
|
+
let fused = safeIndex(blueprints, 0, "fuseAll");
|
|
694
694
|
for (let i = 1; i < blueprints.length; i++) {
|
|
695
|
-
fused = fuse2D(fused, blueprints
|
|
695
|
+
fused = fuse2D(fused, safeIndex(blueprints, i, "fuseAll"));
|
|
696
696
|
}
|
|
697
697
|
return fused;
|
|
698
698
|
};
|
|
@@ -706,8 +706,7 @@ function offset(bp, offsetDistance, offsetConfig = {}) {
|
|
|
706
706
|
bp.blueprints.slice(1).map((b) => offset(b, offsetDistance, offsetConfig))
|
|
707
707
|
);
|
|
708
708
|
return cut2D(
|
|
709
|
-
|
|
710
|
-
offset(bp.blueprints[0], offsetDistance, offsetConfig),
|
|
709
|
+
offset(safeIndex(bp.blueprints, 0, "offset"), offsetDistance, offsetConfig),
|
|
711
710
|
innerShape
|
|
712
711
|
);
|
|
713
712
|
}
|