brepjs 8.3.0 → 8.4.0
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/lib/Curve2D.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-CdVaHDSx.js → Blueprint-Bp45tnh0.js} +16 -13
- package/dist/{Blueprint-a3ukJMG4.cjs → Blueprint-zgFe_5Qj.cjs} +16 -13
- package/dist/{boolean2D-pvPIs21j.cjs → boolean2D-CfEbRMPF.cjs} +11 -11
- package/dist/{boolean2D-DzA0STqC.js → boolean2D-DN6ETTCq.js} +11 -11
- package/dist/{booleanFns-Cd414V3l.cjs → booleanFns-5dDG0jpA.cjs} +5 -5
- package/dist/{booleanFns-BcQUqjUu.js → booleanFns-C-M6qqvB.js} +5 -5
- package/dist/brepjs.cjs +186 -20
- package/dist/brepjs.js +208 -42
- package/dist/{cast-C107o5ow.cjs → cast-CPNOTNFm.cjs} +3 -3
- package/dist/{cast-D0OhP1nV.js → cast-Cerqtxtb.js} +3 -3
- package/dist/core/errors.d.ts +7 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/{cornerFinder-BdKtobgb.cjs → cornerFinder-BQ-_VJx0.cjs} +1 -1
- package/dist/{cornerFinder-DvPiz-VR.js → cornerFinder-CC_MunIh.js} +1 -1
- package/dist/{curveBuilders-CN72XaIQ.js → curveBuilders-BREwqvuc.js} +3 -3
- package/dist/{curveBuilders-Du03_Yyf.cjs → curveBuilders-BkEJ-RVn.cjs} +3 -3
- package/dist/{curveFns-B5EQsSwv.cjs → curveFns-VMxgfkqw.cjs} +3 -3
- package/dist/{curveFns-CyHyk29c.js → curveFns-ZuQUBZvd.js} +3 -3
- package/dist/{drawFns-CAAE4Z88.js → drawFns-BbhX1IUq.js} +19 -16
- package/dist/{drawFns-Mr2pghU8.cjs → drawFns-CKaHgGSK.cjs} +19 -16
- package/dist/{errors-wGhcJMpB.js → errors-CSYOlCCR.js} +10 -1
- package/dist/{errors-DK1VAdP4.cjs → errors-D13q2HCk.cjs} +10 -1
- package/dist/{faceFns-ub3CugDN.js → faceFns-CfJIbHY3.js} +4 -4
- package/dist/{faceFns-D1Sqnlu6.cjs → faceFns-es3GENII.cjs} +4 -4
- package/dist/{helpers-CP2KrBZl.cjs → helpers-C0q_FVxq.cjs} +7 -7
- package/dist/{helpers-r_e-u1JM.js → helpers-CmVkMubc.js} +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +5 -5
- package/dist/io.js +5 -5
- package/dist/kernel/hullOps.d.ts +22 -0
- package/dist/kernel/hullOps.d.ts.map +1 -0
- package/dist/kernel/occtAdapter.d.ts +6 -0
- package/dist/kernel/occtAdapter.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +6 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-PMRx9iMG.cjs → loft-B-UCPW9P.cjs} +5 -5
- package/dist/{loft-BHn7GKm8.js → loft-oJq2OD3A.js} +5 -5
- package/dist/{measurement-B06hNs89.cjs → measurement-CYmT-C77.cjs} +3 -3
- package/dist/{measurement-BfhEneUl.js → measurement-Cf_SoIiR.js} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BEvGVcym.js → meshFns-CqNwW0PO.js} +3 -3
- package/dist/{meshFns-CJV_k_EQ.cjs → meshFns-DDC_2U81.cjs} +3 -3
- package/dist/{occtBoundary-BFAaUtA7.cjs → occtBoundary-CocN2VKx.cjs} +419 -2
- package/dist/{occtBoundary-CoXB2xvx.js → occtBoundary-D_gjqgzo.js} +419 -2
- package/dist/{operations-B314mytX.js → operations-6hdpuYmY.js} +6 -6
- package/dist/{operations-CYGNxn5D.cjs → operations-BQeW_DSM.cjs} +6 -6
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query.cjs +5 -5
- package/dist/query.js +6 -6
- package/dist/result.cjs +1 -1
- package/dist/result.js +1 -1
- package/dist/{shapeFns-Z_ScEjmn.cjs → shapeFns-B0zSdO9c.cjs} +4 -4
- package/dist/{shapeFns-CWd_ASDV.js → shapeFns-k1YHFwmB.js} +15 -15
- package/dist/{shapeTypes-UqVCIO_T.cjs → shapeTypes-BxVxLdiD.cjs} +1 -1
- package/dist/{shapeTypes-BU2LKv2S.js → shapeTypes-c-_pgYCx.js} +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/hullFns.d.ts +16 -0
- package/dist/topology/hullFns.d.ts.map +1 -0
- package/dist/topology/minkowskiFns.d.ts +20 -0
- package/dist/topology/minkowskiFns.d.ts.map +1 -0
- package/dist/{topology-A7-jUtHB.cjs → topology-CycEc6Oe.cjs} +9 -9
- package/dist/{topology-BupialMm.js → topology-tMKHJgw2.js} +9 -9
- package/dist/topology.cjs +7 -7
- package/dist/topology.js +27 -27
- package/dist/{vectors-BhfKwL9J.js → vectors-DE0XriuQ.js} +2 -2
- package/dist/{vectors-t1XG4LpL.cjs → vectors-DVmHF4zt.cjs} +2 -2
- package/dist/vectors.cjs +2 -2
- package/dist/vectors.js +2 -2
- package/package.json +5 -5
package/dist/brepjs.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { g as getKernel, b as toOcPnt, a as toVec3 } from "./occtBoundary-
|
|
2
|
-
import { f, h, i, j, r, c, t, w, k, l } from "./occtBoundary-
|
|
3
|
-
import { l as ok, y as translateOcctError, e as err, q as queryError,
|
|
4
|
-
import { O, a, c as c2, b, f as f2, i as i2, g, m, h as h2, j as j2, k as k2, z, s, t as t2, n, r as r2, v, w as w2 } from "./errors-
|
|
5
|
-
import { c as castShape,
|
|
6
|
-
import { D, q, o, u, a as a2, b as b2, v as v2, r as r3, n as n2, x, g as g2, i as i3, f as f3, j as j3,
|
|
1
|
+
import { g as getKernel, b as toOcPnt, a as toVec3 } from "./occtBoundary-D_gjqgzo.js";
|
|
2
|
+
import { f, h, i, j, r, c, t, w, k, l } from "./occtBoundary-D_gjqgzo.js";
|
|
3
|
+
import { l as ok, y as translateOcctError, e as err, q as queryError, x as validationError, B as BrepErrorCode, d as isErr, o as occtError, p as typeCastError, u as unwrap } from "./errors-CSYOlCCR.js";
|
|
4
|
+
import { O, a, c as c2, b, f as f2, i as i2, g, m, h as h2, j as j2, k as k2, z, s, t as t2, n, r as r2, v, w as w2 } from "./errors-CSYOlCCR.js";
|
|
5
|
+
import { c as castShape, k as isSolid, h as isShape3D, p as gcWithScope, s as createSolid, e as isFace, d as isEdge, m as isWire } from "./shapeTypes-c-_pgYCx.js";
|
|
6
|
+
import { D, q, o, u, a as a2, b as b2, v as v2, r as r3, n as n2, x, g as g2, i as i3, f as f3, j as j3, l as l2, t as t3, w as w3 } from "./shapeTypes-c-_pgYCx.js";
|
|
7
7
|
import { c as vecDistance, D as DEG2RAD, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
8
|
-
import { H, R, v as v3, a as a3, b as b3, d, e, g as g3, h as h3, i as i4, k as
|
|
9
|
-
import { a as addHolesInFace, m as makeFace, b as makeNonPlanarFace, c as makePolygon, d as makeNewFaceWithinFace } from "./Blueprint-
|
|
10
|
-
import { B, e as e2, C, f as f4, g as g4 } from "./Blueprint-
|
|
11
|
-
import { c as curveIsClosed, a as curveTangentAt, b as curvePointAt, d as curveEndPoint, e as curveStartPoint, f as curveLength } from "./curveFns-
|
|
12
|
-
import { g as g5, h as h4, i as i5, j as j4, k as
|
|
13
|
-
import { m as makeCompound, a as makeCone, b as makeCylinder, c as makeEllipsoid, d as makeOffset, w as weldShellsAndFaces, e as makeSolid, f as makeSphere, g as makeTorus, h as makeVertex } from "./loft-
|
|
14
|
-
import { i as i6, j as j5, r as r4 } from "./loft-
|
|
15
|
-
import { e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-
|
|
16
|
-
import { a as a4, b as b4, d as d2, f as f5, g as g6, h as h5, i as i7, j as j6, k as
|
|
17
|
-
import { B as B3, a as a5, b as b5, C as C3, F, S, c as c3, d as d3, f as f6, e as e3, i as i8, g as g7, o as o5, p as p2, r as r5 } from "./boolean2D-
|
|
8
|
+
import { H, R, v as v3, a as a3, b as b3, d, e, g as g3, h as h3, i as i4, k as k3, l as l3, m as m2, o as o2 } from "./vecOps-ZDdZWbwT.js";
|
|
9
|
+
import { a as addHolesInFace, m as makeFace, b as makeNonPlanarFace, c as makePolygon, d as makeNewFaceWithinFace } from "./Blueprint-Bp45tnh0.js";
|
|
10
|
+
import { B, e as e2, C, f as f4, g as g4 } from "./Blueprint-Bp45tnh0.js";
|
|
11
|
+
import { c as curveIsClosed, a as curveTangentAt, b as curvePointAt, d as curveEndPoint, e as curveStartPoint, f as curveLength } from "./curveFns-ZuQUBZvd.js";
|
|
12
|
+
import { g as g5, h as h4, i as i5, j as j4, k as k4, l as l4, m as m3, n as n3, o as o3 } from "./curveFns-ZuQUBZvd.js";
|
|
13
|
+
import { m as makeCompound, a as makeCone, b as makeCylinder, c as makeEllipsoid, d as makeOffset, w as weldShellsAndFaces, e as makeSolid, f as makeSphere, g as makeTorus, h as makeVertex } from "./loft-oJq2OD3A.js";
|
|
14
|
+
import { i as i6, j as j5, r as r4 } from "./loft-oJq2OD3A.js";
|
|
15
|
+
import { e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-6hdpuYmY.js";
|
|
16
|
+
import { a as a4, b as b4, d as d2, f as f5, g as g6, h as h5, i as i7, j as j6, k as k5, m as m4, n as n4, o as o4, p, q as q2, t as t4, u as u2, v as v4, w as w4, x as x2, y, z as z2, A, B as B2, C as C2, D as D2, E } from "./operations-6hdpuYmY.js";
|
|
17
|
+
import { B as B3, a as a5, b as b5, C as C3, F, S, c as c3, d as d3, f as f6, e as e3, i as i8, g as g7, o as o5, p as p2, r as r5 } from "./boolean2D-DN6ETTCq.js";
|
|
18
18
|
import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
|
|
19
|
-
import { c as createTypedFinder, f as faceFinder } from "./helpers-
|
|
20
|
-
import { g as g8 } from "./helpers-
|
|
19
|
+
import { c as createTypedFinder, f as faceFinder } from "./helpers-CmVkMubc.js";
|
|
20
|
+
import { g as g8 } from "./helpers-CmVkMubc.js";
|
|
21
21
|
import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
|
|
22
|
-
import { C as C4, D as D3, a as a6, S as S2, b as b6, X, Y, c as c4, d as d4, e as e4, f as f7, Z, g as g9, h as h6, i as i9, j as j7, k as
|
|
23
|
-
import { c as c5, a as a7, p as p4, r as r7, t as t6 } from "./vectors-
|
|
24
|
-
import { v as vertexPosition, t as translate$1,
|
|
25
|
-
import { w as w6, g as g10, b as b7, x as x4, i as i10, y as y3, z as z4, A as A3, B as B5, C as C5 } from "./shapeFns-
|
|
26
|
-
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-
|
|
27
|
-
import { a as a8, b as b8, e as e5, f as f8, d as d5, g as g11, j as j8, s as s3, t as t7, k as
|
|
28
|
-
import { n as normalAt, f as faceCenter, i as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-
|
|
29
|
-
import { c as c6, a as a9, b as b9, d as d6, p as p5, e as e6, u as u4, h as h7 } from "./faceFns-
|
|
30
|
-
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-
|
|
31
|
-
import { c as c7, b as b10, e as e7, d as d7, f as f9 } from "./meshFns-
|
|
32
|
-
import { c as cut$1, f as fuse$1, i as intersect$1, s as section$1, a as slice$1, b as split$1, d as fuseAll, e as cutAll } from "./booleanFns-
|
|
33
|
-
import { g as g12 } from "./booleanFns-
|
|
34
|
-
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-
|
|
35
|
-
import { d as d8, e as e8, f as f10, g as g13, h as h8, i as i11 } from "./measurement-
|
|
36
|
-
import { c as makeBezierCurve, d as makeBSplineApproximation, e as makeCircle, f as makeEllipse, g as makeEllipseArc, b as makeHelix, m as makeLine, h as makeTangentArc, i as makeThreePointArc, a as assembleWire } from "./curveBuilders-
|
|
37
|
-
import { i as iterTopo, f as fromBREP$1 } from "./cast-
|
|
38
|
-
import { e as e9, c as c8, d as d9, g as g14, s as s4 } from "./cast-
|
|
22
|
+
import { C as C4, D as D3, a as a6, S as S2, b as b6, X, Y, c as c4, d as d4, e as e4, f as f7, Z, g as g9, h as h6, i as i9, j as j7, k as k6, l as l5, m as m5, n as n5, o as o6, p as p3, q as q3, r as r6, s as s2, t as t5, u as u3, v as v5, w as w5, x as x3, y as y2, z as z3, _, $, a0, A as A2, a1, B as B4, E as E2, a2 as a22, F as F2, G, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a3 as a32, V, a4 as a42, W } from "./drawFns-BbhX1IUq.js";
|
|
23
|
+
import { c as c5, a as a7, p as p4, r as r7, t as t6 } from "./vectors-DE0XriuQ.js";
|
|
24
|
+
import { v as vertexPosition, c as getFaces, d as getVertices, t as translate$1, e as getEdges, p as propagateOrigins, f as applyMatrix$1, h as clone$1, j as describe$1, k as isEmpty$1, m as mirror$1, r as rotate$1, s as scale$1, l as simplify$1, n as toBREP$1, o as transformCopy$1, q as getBounds, u as getWires } from "./shapeFns-k1YHFwmB.js";
|
|
25
|
+
import { w as w6, g as g10, b as b7, x as x4, i as i10, y as y3, z as z4, A as A3, B as B5, C as C5 } from "./shapeFns-k1YHFwmB.js";
|
|
26
|
+
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-tMKHJgw2.js";
|
|
27
|
+
import { a as a8, b as b8, e as e5, f as f8, d as d5, g as g11, j as j8, s as s3, t as t7, k as k7, l as l6, v as v6, w as w7 } from "./topology-tMKHJgw2.js";
|
|
28
|
+
import { n as normalAt, f as faceCenter, i as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-CfJIbHY3.js";
|
|
29
|
+
import { c as c6, a as a9, b as b9, d as d6, p as p5, e as e6, u as u4, h as h7 } from "./faceFns-CfJIbHY3.js";
|
|
30
|
+
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-CqNwW0PO.js";
|
|
31
|
+
import { c as c7, b as b10, e as e7, d as d7, f as f9 } from "./meshFns-CqNwW0PO.js";
|
|
32
|
+
import { c as cut$1, f as fuse$1, i as intersect$1, s as section$1, a as slice$1, b as split$1, d as fuseAll, e as cutAll } from "./booleanFns-C-M6qqvB.js";
|
|
33
|
+
import { g as g12 } from "./booleanFns-C-M6qqvB.js";
|
|
34
|
+
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-Cf_SoIiR.js";
|
|
35
|
+
import { d as d8, e as e8, f as f10, g as g13, h as h8, i as i11 } from "./measurement-Cf_SoIiR.js";
|
|
36
|
+
import { c as makeBezierCurve, d as makeBSplineApproximation, e as makeCircle, f as makeEllipse, g as makeEllipseArc, b as makeHelix, m as makeLine, h as makeTangentArc, i as makeThreePointArc, a as assembleWire } from "./curveBuilders-BREwqvuc.js";
|
|
37
|
+
import { i as iterTopo, f as fromBREP$1 } from "./cast-Cerqtxtb.js";
|
|
38
|
+
import { e as e9, c as c8, d as d9, g as g14, s as s4 } from "./cast-Cerqtxtb.js";
|
|
39
39
|
import { edgeFinder } from "./query.js";
|
|
40
40
|
import { BrepBugError, bug } from "./result.js";
|
|
41
|
-
import { c as c9 } from "./cornerFinder-
|
|
41
|
+
import { c as c9 } from "./cornerFinder-CC_MunIh.js";
|
|
42
42
|
import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
|
|
43
43
|
const errorFactories = {
|
|
44
44
|
OCCT_OPERATION: (code, message, cause) => ({ kind: "OCCT_OPERATION", code, message, cause }),
|
|
@@ -159,6 +159,170 @@ function buildVertexFinder(filters) {
|
|
|
159
159
|
function vertexFinder() {
|
|
160
160
|
return buildVertexFinder([]);
|
|
161
161
|
}
|
|
162
|
+
function validateNotNull$1(shape2, label) {
|
|
163
|
+
if (shape2.wrapped.IsNull()) {
|
|
164
|
+
return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `${label} is a null shape`));
|
|
165
|
+
}
|
|
166
|
+
return ok(void 0);
|
|
167
|
+
}
|
|
168
|
+
function hull(shapes, options = {}) {
|
|
169
|
+
if (shapes.length === 0) {
|
|
170
|
+
return err(
|
|
171
|
+
validationError(
|
|
172
|
+
BrepErrorCode.HULL_EMPTY_INPUT,
|
|
173
|
+
"hull: at least one shape is required",
|
|
174
|
+
void 0,
|
|
175
|
+
void 0,
|
|
176
|
+
"Provide one or more shapes to compute a convex hull"
|
|
177
|
+
)
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
for (const [i12, shape2] of shapes.entries()) {
|
|
181
|
+
const check = validateNotNull$1(shape2, `hull: shapes[${i12}]`);
|
|
182
|
+
if (isErr(check)) return check;
|
|
183
|
+
}
|
|
184
|
+
const tolerance = options.tolerance ?? 0.1;
|
|
185
|
+
try {
|
|
186
|
+
const kernel = getKernel();
|
|
187
|
+
const ocShapes = shapes.map((s5) => s5.wrapped);
|
|
188
|
+
const resultOc = kernel.hull(ocShapes, tolerance);
|
|
189
|
+
const cast = castShape(resultOc);
|
|
190
|
+
if (!isSolid(cast)) {
|
|
191
|
+
return err(
|
|
192
|
+
occtError(BrepErrorCode.HULL_NOT_3D, "Hull result is not a solid; input may be degenerate")
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return ok(cast);
|
|
196
|
+
} catch (e10) {
|
|
197
|
+
const raw = e10 instanceof Error ? e10.message : String(e10);
|
|
198
|
+
if (raw.includes("coplanar") || raw.includes("fewer than") || raw.includes("degenerate")) {
|
|
199
|
+
return err(occtError(BrepErrorCode.HULL_DEGENERATE, `Hull degenerate: ${raw}`, e10));
|
|
200
|
+
}
|
|
201
|
+
return err(occtError(BrepErrorCode.HULL_FAILED, `Hull operation failed: ${raw}`, e10));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function detectSphere(shape2) {
|
|
205
|
+
const oc = getKernel().oc;
|
|
206
|
+
const faces = getFaces(shape2);
|
|
207
|
+
if (faces.length !== 1) return null;
|
|
208
|
+
const face2 = faces[0];
|
|
209
|
+
const r8 = gcWithScope();
|
|
210
|
+
const adaptor = r8(new oc.BRepAdaptor_Surface_2(face2.wrapped, true));
|
|
211
|
+
const surfType = adaptor.GetType();
|
|
212
|
+
if (surfType !== oc.GeomAbs_SurfaceType.GeomAbs_Sphere) return null;
|
|
213
|
+
const ocSphere = adaptor.Sphere();
|
|
214
|
+
const radius = ocSphere.Radius();
|
|
215
|
+
ocSphere.delete();
|
|
216
|
+
return radius;
|
|
217
|
+
}
|
|
218
|
+
function minkowskiSphere(shape2, radius, tolerance) {
|
|
219
|
+
const oc = getKernel().oc;
|
|
220
|
+
const r8 = gcWithScope();
|
|
221
|
+
try {
|
|
222
|
+
const offsetMaker = r8(new oc.BRepOffsetAPI_MakeOffsetShape());
|
|
223
|
+
const progress = r8(new oc.Message_ProgressRange_1());
|
|
224
|
+
offsetMaker.PerformByJoin(
|
|
225
|
+
shape2.wrapped,
|
|
226
|
+
radius,
|
|
227
|
+
tolerance,
|
|
228
|
+
oc.BRepOffset_Mode.BRepOffset_Skin,
|
|
229
|
+
false,
|
|
230
|
+
false,
|
|
231
|
+
oc.GeomAbs_JoinType.GeomAbs_Arc,
|
|
232
|
+
false,
|
|
233
|
+
progress
|
|
234
|
+
);
|
|
235
|
+
const resultShape = offsetMaker.Shape();
|
|
236
|
+
const wrapped = castShape(resultShape);
|
|
237
|
+
if (!isShape3D(wrapped)) {
|
|
238
|
+
wrapped[Symbol.dispose]();
|
|
239
|
+
return err(
|
|
240
|
+
typeCastError(
|
|
241
|
+
BrepErrorCode.MINKOWSKI_NOT_3D,
|
|
242
|
+
"Minkowski sphere offset did not produce a 3D shape"
|
|
243
|
+
)
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return ok(wrapped);
|
|
247
|
+
} catch (e10) {
|
|
248
|
+
const raw = e10 instanceof Error ? e10.message : String(e10);
|
|
249
|
+
return err(
|
|
250
|
+
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski sphere offset failed: ${raw}`, e10, {
|
|
251
|
+
operation: "minkowski",
|
|
252
|
+
fastPath: "sphere"
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function minkowskiGeneral(shape2, tool, _tolerance) {
|
|
258
|
+
const oc = getKernel().oc;
|
|
259
|
+
try {
|
|
260
|
+
const shapeVerts = getVertices(shape2);
|
|
261
|
+
const toolVerts = getVertices(tool);
|
|
262
|
+
if (shapeVerts.length === 0 || toolVerts.length === 0) {
|
|
263
|
+
return err(
|
|
264
|
+
occtError(
|
|
265
|
+
BrepErrorCode.MINKOWSKI_FAILED,
|
|
266
|
+
"Minkowski sum: one or both shapes have no vertices",
|
|
267
|
+
void 0,
|
|
268
|
+
{
|
|
269
|
+
operation: "minkowski"
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
const sumPoints = [];
|
|
275
|
+
for (const sv of shapeVerts) {
|
|
276
|
+
const r1 = gcWithScope();
|
|
277
|
+
const pa = r1(oc.BRep_Tool.Pnt(sv.wrapped));
|
|
278
|
+
const ax = pa.X(), ay = pa.Y(), az = pa.Z();
|
|
279
|
+
for (const tv of toolVerts) {
|
|
280
|
+
const r22 = gcWithScope();
|
|
281
|
+
const pb = r22(oc.BRep_Tool.Pnt(tv.wrapped));
|
|
282
|
+
const bx = pb.X(), by = pb.Y(), bz = pb.Z();
|
|
283
|
+
sumPoints.push({ x: ax + bx, y: ay + by, z: az + bz });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const kernel = getKernel();
|
|
287
|
+
const hullShape = kernel.hullFromPoints(sumPoints, _tolerance);
|
|
288
|
+
const wrapped = castShape(hullShape);
|
|
289
|
+
if (!isShape3D(wrapped)) {
|
|
290
|
+
wrapped[Symbol.dispose]();
|
|
291
|
+
return err(
|
|
292
|
+
typeCastError(BrepErrorCode.MINKOWSKI_NOT_3D, "Minkowski hull did not produce a 3D shape")
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
return ok(wrapped);
|
|
296
|
+
} catch (e10) {
|
|
297
|
+
const raw = e10 instanceof Error ? e10.message : String(e10);
|
|
298
|
+
return err(
|
|
299
|
+
occtError(BrepErrorCode.MINKOWSKI_FAILED, `Minkowski general path failed: ${raw}`, e10, {
|
|
300
|
+
operation: "minkowski"
|
|
301
|
+
})
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
function minkowski(shape2, tool, options = {}) {
|
|
306
|
+
const { tolerance = 1e-6 } = options;
|
|
307
|
+
if (shape2.wrapped.IsNull()) {
|
|
308
|
+
return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "minkowski: shape is a null shape"));
|
|
309
|
+
}
|
|
310
|
+
if (tool.wrapped.IsNull()) {
|
|
311
|
+
return err(
|
|
312
|
+
validationError(BrepErrorCode.MINKOWSKI_NULL_TOOL, "minkowski: tool is a null shape")
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
if (!isShape3D(shape2) || !isShape3D(tool)) {
|
|
316
|
+
return err(
|
|
317
|
+
validationError(BrepErrorCode.MINKOWSKI_NOT_3D, "minkowski: both shape and tool must be 3D")
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
const sphereRadius = detectSphere(tool);
|
|
321
|
+
if (sphereRadius !== null) {
|
|
322
|
+
return minkowskiSphere(shape2, sphereRadius, tolerance);
|
|
323
|
+
}
|
|
324
|
+
return minkowskiGeneral(shape2, tool, tolerance);
|
|
325
|
+
}
|
|
162
326
|
function checkInterference(shape1, shape2, tolerance = 1e-6) {
|
|
163
327
|
if (shape1.wrapped.IsNull()) {
|
|
164
328
|
return err(
|
|
@@ -1187,7 +1351,7 @@ export {
|
|
|
1187
1351
|
b2 as createOcHandle,
|
|
1188
1352
|
createOperationRegistry,
|
|
1189
1353
|
a7 as createPlane,
|
|
1190
|
-
|
|
1354
|
+
k5 as createRegistry,
|
|
1191
1355
|
v2 as createShell,
|
|
1192
1356
|
createSolid,
|
|
1193
1357
|
createTaskQueue,
|
|
@@ -1224,7 +1388,7 @@ export {
|
|
|
1224
1388
|
h6 as draw,
|
|
1225
1389
|
i9 as drawCircle,
|
|
1226
1390
|
j7 as drawEllipse,
|
|
1227
|
-
|
|
1391
|
+
k6 as drawFaceOutline,
|
|
1228
1392
|
l5 as drawParametricFunction,
|
|
1229
1393
|
m5 as drawPointsInterpolation,
|
|
1230
1394
|
n5 as drawPolysides,
|
|
@@ -1271,7 +1435,7 @@ export {
|
|
|
1271
1435
|
o4 as findStep,
|
|
1272
1436
|
f2 as flatMap,
|
|
1273
1437
|
d6 as flipFaceOrientation,
|
|
1274
|
-
|
|
1438
|
+
k4 as flipOrientation,
|
|
1275
1439
|
fromBREP,
|
|
1276
1440
|
f as fromOcDir,
|
|
1277
1441
|
h as fromOcPnt,
|
|
@@ -1305,6 +1469,7 @@ export {
|
|
|
1305
1469
|
g11 as healSolid,
|
|
1306
1470
|
j8 as healWire,
|
|
1307
1471
|
helix,
|
|
1472
|
+
hull,
|
|
1308
1473
|
importIGES,
|
|
1309
1474
|
importSTEP,
|
|
1310
1475
|
importSTL,
|
|
@@ -1339,7 +1504,7 @@ export {
|
|
|
1339
1504
|
f3 as isShape1D,
|
|
1340
1505
|
isShape3D,
|
|
1341
1506
|
j3 as isShell,
|
|
1342
|
-
|
|
1507
|
+
isSolid,
|
|
1343
1508
|
isSuccessResponse,
|
|
1344
1509
|
isValid,
|
|
1345
1510
|
l2 as isVertex,
|
|
@@ -1373,6 +1538,7 @@ export {
|
|
|
1373
1538
|
measureVolumeProps,
|
|
1374
1539
|
mesh,
|
|
1375
1540
|
meshEdges,
|
|
1541
|
+
minkowski,
|
|
1376
1542
|
mirror,
|
|
1377
1543
|
mirror2D,
|
|
1378
1544
|
B4 as mirrorDrawing,
|
|
@@ -1462,7 +1628,7 @@ export {
|
|
|
1462
1628
|
threePointArc,
|
|
1463
1629
|
toBREP,
|
|
1464
1630
|
t7 as toBufferGeometryData,
|
|
1465
|
-
|
|
1631
|
+
k7 as toGroupedBufferGeometryData,
|
|
1466
1632
|
l6 as toLineGeometryData,
|
|
1467
1633
|
c as toOcVec,
|
|
1468
1634
|
toSVGPathD,
|
|
@@ -1498,7 +1664,7 @@ export {
|
|
|
1498
1664
|
h3 as vecLengthSq,
|
|
1499
1665
|
i4 as vecNegate,
|
|
1500
1666
|
vecNormalize,
|
|
1501
|
-
|
|
1667
|
+
k3 as vecProjectToPlane,
|
|
1502
1668
|
l3 as vecRepr,
|
|
1503
1669
|
m2 as vecRotate,
|
|
1504
1670
|
vecScale,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const occtBoundary = require("./occtBoundary-
|
|
4
|
-
const errors = require("./errors-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
3
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
5
|
let _topoMap = null;
|
|
6
6
|
const asTopo = (entity) => {
|
|
7
7
|
if (!_topoMap) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as castShape, h as isShape3D$1, m as isWire$1 } from "./shapeTypes-
|
|
2
|
-
import { g as getKernel } from "./occtBoundary-
|
|
3
|
-
import { e as err, p as typeCastError, l as ok, a as andThen } from "./errors-
|
|
1
|
+
import { c as castShape, h as isShape3D$1, m as isWire$1 } from "./shapeTypes-c-_pgYCx.js";
|
|
2
|
+
import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
|
|
3
|
+
import { e as err, p as typeCastError, l as ok, a as andThen } from "./errors-CSYOlCCR.js";
|
|
4
4
|
let _topoMap = null;
|
|
5
5
|
const asTopo = (entity) => {
|
|
6
6
|
if (!_topoMap) {
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -74,6 +74,13 @@ export declare const BrepErrorCode: {
|
|
|
74
74
|
readonly INTERSECTION_FAILED: "INTERSECTION_FAILED";
|
|
75
75
|
readonly SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED";
|
|
76
76
|
readonly FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE";
|
|
77
|
+
readonly HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT";
|
|
78
|
+
readonly HULL_FAILED: "HULL_FAILED";
|
|
79
|
+
readonly HULL_DEGENERATE: "HULL_DEGENERATE";
|
|
80
|
+
readonly HULL_NOT_3D: "HULL_NOT_3D";
|
|
81
|
+
readonly MINKOWSKI_FAILED: "MINKOWSKI_FAILED";
|
|
82
|
+
readonly MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL";
|
|
83
|
+
readonly MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D";
|
|
77
84
|
};
|
|
78
85
|
/** Union of all known error code string literals. */
|
|
79
86
|
export type BrepErrorCode = (typeof BrepErrorCode)[keyof typeof BrepErrorCode];
|
|
@@ -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;AAMpD,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,YAAY,GACZ,WAAW,GACX,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,IAAI,GACJ,OAAO,CAAC;AAMZ;;;;GAIG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"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"}
|
package/dist/core.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const errors = require("./errors-
|
|
6
|
-
const vectors = require("./vectors-
|
|
7
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
6
|
+
const vectors = require("./vectors-DVmHF4zt.cjs");
|
|
7
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
8
8
|
const result = require("./result.cjs");
|
|
9
9
|
exports.resolveDirection = occtBoundary.resolveDirection;
|
|
10
10
|
exports.toVec2 = occtBoundary.toVec2;
|
package/dist/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r, t, a } from "./occtBoundary-
|
|
1
|
+
import { r, t, a } from "./occtBoundary-D_gjqgzo.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, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-
|
|
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, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-
|
|
3
|
+
import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, m as m2, h as h2, j as j2, k as k2, o as o2, l as l2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-CSYOlCCR.js";
|
|
4
|
+
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-DE0XriuQ.js";
|
|
5
|
+
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, w as w2 } from "./shapeTypes-c-_pgYCx.js";
|
|
6
6
|
import { BrepBugError, bug } from "./result.js";
|
|
7
7
|
export {
|
|
8
8
|
BrepBugError,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-
|
|
1
|
+
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-CmVkMubc.js";
|
|
2
2
|
import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
const PI_2 = 2 * Math.PI;
|
|
4
4
|
function positiveHalfAngle(angle) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getKernel, b as toOcPnt, c as toOcVec, m as makeOcAx2, d as makeOcAx3 } from "./occtBoundary-
|
|
2
|
-
import { d as isEdge, m as isWire, n as createWire, o as createEdge, p as gcWithScope } from "./shapeTypes-
|
|
3
|
-
import { e as err, o as occtError, l as ok, x as validationError } from "./errors-
|
|
1
|
+
import { g as getKernel, b as toOcPnt, c as toOcVec, m as makeOcAx2, d as makeOcAx3 } from "./occtBoundary-D_gjqgzo.js";
|
|
2
|
+
import { d as isEdge, m as isWire, n as createWire, o as createEdge, p as gcWithScope } from "./shapeTypes-c-_pgYCx.js";
|
|
3
|
+
import { e as err, o as occtError, l as ok, x as validationError } from "./errors-CSYOlCCR.js";
|
|
4
4
|
function makeLine(v1, v2) {
|
|
5
5
|
const oc = getKernel().oc;
|
|
6
6
|
const r = gcWithScope();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
-
const shapeTypes = require("./shapeTypes-
|
|
4
|
-
const errors = require("./errors-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
5
|
function makeLine(v1, v2) {
|
|
6
6
|
const oc = occtBoundary.getKernel().oc;
|
|
7
7
|
const r = shapeTypes.gcWithScope();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const occtBoundary = require("./occtBoundary-
|
|
3
|
-
const shapeTypes = require("./shapeTypes-
|
|
4
|
-
const errors = require("./errors-
|
|
2
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
3
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
4
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
5
5
|
let CURVE_TYPES_MAP = null;
|
|
6
6
|
const getCurveTypesMap = (refresh) => {
|
|
7
7
|
if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getKernel } from "./occtBoundary-
|
|
2
|
-
import { c as castShape, d as isEdge, m as isWire, p as gcWithScope } from "./shapeTypes-
|
|
3
|
-
import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-
|
|
1
|
+
import { g as getKernel } from "./occtBoundary-D_gjqgzo.js";
|
|
2
|
+
import { c as castShape, d as isEdge, m as isWire, p as gcWithScope } from "./shapeTypes-c-_pgYCx.js";
|
|
3
|
+
import { e as err, p as typeCastError, l as ok, u as unwrap } from "./errors-CSYOlCCR.js";
|
|
4
4
|
let CURVE_TYPES_MAP = null;
|
|
5
5
|
const getCurveTypesMap = (refresh) => {
|
|
6
6
|
if (CURVE_TYPES_MAP && !refresh) return CURVE_TYPES_MAP;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-
|
|
2
|
-
import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-
|
|
3
|
-
import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-
|
|
1
|
+
import { u as unwrap, g as isOk, e as err, x as validationError, l as ok } from "./errors-CSYOlCCR.js";
|
|
2
|
+
import { r as resolvePlane, b as planeToWorld, d as planeToLocal } from "./vectors-DE0XriuQ.js";
|
|
3
|
+
import { g as getKernel, a as toVec3, m as makeOcAx2 } from "./occtBoundary-D_gjqgzo.js";
|
|
4
4
|
import { n as vecScale, j as vecNormalize, v as vecAdd, o as vecSub, b as vecCross, m as vecRotate, R as RAD2DEG, g as vecLength, e as vecEquals, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
5
|
-
import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-
|
|
6
|
-
import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-
|
|
7
|
-
import { a as curveTangentAt, d as curveEndPoint, l as getCurveType, o as offsetWire2D } from "./curveFns-
|
|
8
|
-
import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-
|
|
9
|
-
import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-
|
|
10
|
-
import { d as downcast, c as cast } from "./cast-
|
|
11
|
-
import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-
|
|
5
|
+
import { h as Flatbush, j as convertSvgEllipseParams, k as defaultsSplineOptions, S as Sketch, r as roundedRectangleBlueprint, b as Blueprints, C as CompoundBlueprint, c as cut2D, l as intersectCurves, f as fuse2D, m as make2dOffset, n as filletCurves, q as chamferCurves, o as organiseBlueprints, a as BlueprintSketcher, i as intersect2D, B as BaseSketcher2d, p as polysidesBlueprint } from "./boolean2D-DN6ETTCq.js";
|
|
6
|
+
import { f as faceCenter, n as normalAt, o as outerWire } from "./faceFns-CfJIbHY3.js";
|
|
7
|
+
import { a as curveTangentAt, d as curveEndPoint, l as getCurveType, o as offsetWire2D } from "./curveFns-ZuQUBZvd.js";
|
|
8
|
+
import { m as makeLine, i as makeThreePointArc, h as makeTangentArc, g as makeEllipseArc, c as makeBezierCurve, a as assembleWire, e as makeCircle, f as makeEllipse, b as makeHelix, d as makeBSplineApproximation } from "./curveBuilders-BREwqvuc.js";
|
|
9
|
+
import { n as createWire, t as localGC, u as createFace, e as isFace, p as gcWithScope, c as castShape } from "./shapeTypes-c-_pgYCx.js";
|
|
10
|
+
import { d as downcast, c as cast } from "./cast-Cerqtxtb.js";
|
|
11
|
+
import { h as mirror, a as addHolesInFace, m as makeFace, B as Blueprint, C as Curve2D, i as make2dSegmentCurve, j as make2dArcFromCenter, k as approximateAsSvgCompatibleCurve, e as BoundingBox2d, l as edgeToCurve, n as make2dInerpolatedBSplineCurve, o as make2dCircle, p as make2dEllipse, q as deserializeCurve2D } from "./Blueprint-Bp45tnh0.js";
|
|
12
12
|
import { bug } from "./result.js";
|
|
13
|
-
import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-
|
|
14
|
-
import {
|
|
15
|
-
import { m as makeCompound, i as basicFaceExtrusion, r as revolution, e as makeSolid, k as complexExtrude, t as twistExtrude } from "./loft-
|
|
13
|
+
import { d as distance2d, p as polarAngle2d, b as polarToCartesian, P as PRECISION_OFFSET, e as squareDistance2d, s as samePoint$1, h as subtract2d, i as add2d } from "./helpers-CmVkMubc.js";
|
|
14
|
+
import { e as getEdges } from "./shapeFns-k1YHFwmB.js";
|
|
15
|
+
import { m as makeCompound, i as basicFaceExtrusion, r as revolution, e as makeSolid, k as complexExtrude, t as twistExtrude } from "./loft-oJq2OD3A.js";
|
|
16
16
|
import opentype from "opentype.js";
|
|
17
|
-
import { c as cornerFinder } from "./cornerFinder-
|
|
17
|
+
import { c as cornerFinder } from "./cornerFinder-CC_MunIh.js";
|
|
18
18
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
19
19
|
const startPoints = new Flatbush(curves.length);
|
|
20
20
|
curves.forEach((c) => {
|
|
@@ -1023,7 +1023,8 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1023
1023
|
response = await fetch(fontPath);
|
|
1024
1024
|
} catch (e) {
|
|
1025
1025
|
throw new Error(
|
|
1026
|
-
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}
|
|
1026
|
+
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
1027
|
+
{ cause: e }
|
|
1027
1028
|
);
|
|
1028
1029
|
}
|
|
1029
1030
|
if (!response.ok) {
|
|
@@ -1039,7 +1040,9 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1039
1040
|
try {
|
|
1040
1041
|
font = opentype.parse(fontData);
|
|
1041
1042
|
} catch (e) {
|
|
1042
|
-
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}
|
|
1043
|
+
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, {
|
|
1044
|
+
cause: e
|
|
1045
|
+
});
|
|
1043
1046
|
}
|
|
1044
1047
|
FONT_REGISTER[fontFamily] = font;
|
|
1045
1048
|
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = font;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const errors = require("./errors-
|
|
3
|
-
const vectors = require("./vectors-
|
|
4
|
-
const occtBoundary = require("./occtBoundary-
|
|
2
|
+
const errors = require("./errors-D13q2HCk.cjs");
|
|
3
|
+
const vectors = require("./vectors-DVmHF4zt.cjs");
|
|
4
|
+
const occtBoundary = require("./occtBoundary-CocN2VKx.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const boolean2D = require("./boolean2D-
|
|
7
|
-
const faceFns = require("./faceFns-
|
|
8
|
-
const curveFns = require("./curveFns-
|
|
9
|
-
const curveBuilders = require("./curveBuilders-
|
|
10
|
-
const shapeTypes = require("./shapeTypes-
|
|
11
|
-
const cast = require("./cast-
|
|
12
|
-
const Blueprint = require("./Blueprint-
|
|
6
|
+
const boolean2D = require("./boolean2D-CfEbRMPF.cjs");
|
|
7
|
+
const faceFns = require("./faceFns-es3GENII.cjs");
|
|
8
|
+
const curveFns = require("./curveFns-VMxgfkqw.cjs");
|
|
9
|
+
const curveBuilders = require("./curveBuilders-BkEJ-RVn.cjs");
|
|
10
|
+
const shapeTypes = require("./shapeTypes-BxVxLdiD.cjs");
|
|
11
|
+
const cast = require("./cast-CPNOTNFm.cjs");
|
|
12
|
+
const Blueprint = require("./Blueprint-zgFe_5Qj.cjs");
|
|
13
13
|
const result = require("./result.cjs");
|
|
14
|
-
const helpers = require("./helpers-
|
|
15
|
-
const shapeFns = require("./shapeFns-
|
|
16
|
-
const loft = require("./loft-
|
|
14
|
+
const helpers = require("./helpers-C0q_FVxq.cjs");
|
|
15
|
+
const shapeFns = require("./shapeFns-B0zSdO9c.cjs");
|
|
16
|
+
const loft = require("./loft-B-UCPW9P.cjs");
|
|
17
17
|
const opentype = require("opentype.js");
|
|
18
|
-
const cornerFinder = require("./cornerFinder-
|
|
18
|
+
const cornerFinder = require("./cornerFinder-BQ-_VJx0.cjs");
|
|
19
19
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
20
20
|
const startPoints = new boolean2D.Flatbush(curves.length);
|
|
21
21
|
curves.forEach((c) => {
|
|
@@ -1024,7 +1024,8 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1024
1024
|
response = await fetch(fontPath);
|
|
1025
1025
|
} catch (e) {
|
|
1026
1026
|
throw new Error(
|
|
1027
|
-
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}
|
|
1027
|
+
`Failed to fetch font from ${fontPath}: ${e instanceof Error ? e.message : String(e)}`,
|
|
1028
|
+
{ cause: e }
|
|
1028
1029
|
);
|
|
1029
1030
|
}
|
|
1030
1031
|
if (!response.ok) {
|
|
@@ -1040,7 +1041,9 @@ async function loadFont(fontPath, fontFamily = "default", force = false) {
|
|
|
1040
1041
|
try {
|
|
1041
1042
|
font = opentype.parse(fontData);
|
|
1042
1043
|
} catch (e) {
|
|
1043
|
-
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}
|
|
1044
|
+
throw new Error(`Failed to parse font data: ${e instanceof Error ? e.message : String(e)}`, {
|
|
1045
|
+
cause: e
|
|
1046
|
+
});
|
|
1044
1047
|
}
|
|
1045
1048
|
FONT_REGISTER[fontFamily] = font;
|
|
1046
1049
|
if (!FONT_REGISTER["default"]) FONT_REGISTER["default"] = font;
|
|
@@ -160,7 +160,16 @@ const BrepErrorCode = {
|
|
|
160
160
|
INTERSECTION_FAILED: "INTERSECTION_FAILED",
|
|
161
161
|
SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED",
|
|
162
162
|
// Query errors
|
|
163
|
-
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE"
|
|
163
|
+
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE",
|
|
164
|
+
// Hull errors
|
|
165
|
+
HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT",
|
|
166
|
+
HULL_FAILED: "HULL_FAILED",
|
|
167
|
+
HULL_DEGENERATE: "HULL_DEGENERATE",
|
|
168
|
+
HULL_NOT_3D: "HULL_NOT_3D",
|
|
169
|
+
// Minkowski errors
|
|
170
|
+
MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
|
|
171
|
+
MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
|
|
172
|
+
MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
|
|
164
173
|
};
|
|
165
174
|
function makeError(kind, code, message, cause, metadata, suggestion) {
|
|
166
175
|
const base = { kind, code, message, cause };
|
|
@@ -161,7 +161,16 @@ const BrepErrorCode = {
|
|
|
161
161
|
INTERSECTION_FAILED: "INTERSECTION_FAILED",
|
|
162
162
|
SELF_INTERSECTION_FAILED: "SELF_INTERSECTION_FAILED",
|
|
163
163
|
// Query errors
|
|
164
|
-
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE"
|
|
164
|
+
FINDER_NOT_UNIQUE: "FINDER_NOT_UNIQUE",
|
|
165
|
+
// Hull errors
|
|
166
|
+
HULL_EMPTY_INPUT: "HULL_EMPTY_INPUT",
|
|
167
|
+
HULL_FAILED: "HULL_FAILED",
|
|
168
|
+
HULL_DEGENERATE: "HULL_DEGENERATE",
|
|
169
|
+
HULL_NOT_3D: "HULL_NOT_3D",
|
|
170
|
+
// Minkowski errors
|
|
171
|
+
MINKOWSKI_FAILED: "MINKOWSKI_FAILED",
|
|
172
|
+
MINKOWSKI_NULL_TOOL: "MINKOWSKI_NULL_TOOL",
|
|
173
|
+
MINKOWSKI_NOT_3D: "MINKOWSKI_NOT_3D"
|
|
165
174
|
};
|
|
166
175
|
function makeError(kind, code, message, cause, metadata, suggestion) {
|
|
167
176
|
const base = { kind, code, message, cause };
|