brepjs 12.8.2 → 12.9.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/lib/svgPath.d.ts.map +1 -1
- package/dist/2d/lib/vectorOperations.d.ts +4 -1
- package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +5 -5
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-1HGbugaC.js} +33 -63
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-CUyXM6CV.cjs} +15 -45
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-9OnbotKT.cjs} +9 -9
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-CR4efa35.js} +11 -11
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-BBd2oTvv.cjs} +43 -40
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-Br2KdGJq.js} +53 -50
- package/dist/brepjs.cjs +379 -284
- package/dist/brepjs.js +1437 -1341
- package/dist/core/definitionMaps.d.ts +2 -7
- package/dist/core/definitionMaps.d.ts.map +1 -1
- package/dist/core/dimensionTypes.d.ts +52 -0
- package/dist/core/dimensionTypes.d.ts.map +1 -0
- package/dist/core/disposal.d.ts +18 -0
- package/dist/core/disposal.d.ts.map +1 -1
- package/dist/core/errors.d.ts +1 -8
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/kernelErrorTranslation.d.ts +15 -0
- package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
- package/dist/core/planeOps.d.ts +14 -0
- package/dist/core/planeOps.d.ts.map +1 -1
- package/dist/core/result.d.ts +4 -0
- package/dist/core/result.d.ts.map +1 -1
- package/dist/core/shapeTypes.d.ts +14 -146
- package/dist/core/shapeTypes.d.ts.map +1 -1
- package/dist/core/typeDiscriminants.d.ts +14 -0
- package/dist/core/typeDiscriminants.d.ts.map +1 -0
- package/dist/core/validityTypes.d.ts +100 -0
- package/dist/core/validityTypes.d.ts.map +1 -0
- package/dist/core.cjs +52 -11
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +118 -75
- package/dist/{curveFns-mROFhiuG.js → curveFns-1u0oZ0u0.js} +14 -14
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-BwLvO_Ia.cjs} +2 -2
- package/dist/{drawFns-Bwakrq7w.js → drawFns-B0na6sbo.js} +16 -16
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-CzlEePor.cjs} +18 -18
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-BAKkZG6D.cjs} +2 -2
- package/dist/{faceFns-B8GnxjdY.js → faceFns-DGMp47Os.js} +3 -3
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-DVdscQxW.cjs} +73 -8
- package/dist/{helpers-X0juxnwj.js → helpers-sJjnIXDA.js} +85 -20
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +4 -4
- package/dist/io.js +4 -4
- package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
- package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
- package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
- package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
- package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/helpers.d.ts +84 -0
- package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
- package/dist/kernel/brepkit/internalOps.d.ts +28 -0
- package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/ioOps.d.ts +43 -0
- package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/measureOps.d.ts +30 -0
- package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/meshOps.d.ts +7 -0
- package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
- package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/repairOps.d.ts +14 -0
- package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
- package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
- package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
- package/dist/kernel/brepkit/transformOps.d.ts +14 -0
- package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
- package/dist/kernel/brepkitAdapter.d.ts +1 -1
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/extendedConstructorOps.d.ts +9 -1
- package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
- package/dist/kernel/index.d.ts +1 -0
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
- package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/construction-ops.d.ts +76 -0
- package/dist/kernel/interfaces/construction-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +45 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
- package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts +77 -0
- package/dist/kernel/interfaces/geometry-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/index.d.ts +29 -0
- package/dist/kernel/interfaces/index.d.ts.map +1 -0
- package/dist/kernel/interfaces/io-ops.d.ts +66 -0
- package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
- package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
- package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
- package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
- package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
- package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
- package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/transform-ops.d.ts +20 -0
- package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
- package/dist/kernel/modifierOps.d.ts +2 -2
- package/dist/kernel/modifierOps.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +2 -446
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-hp3pc1M7.cjs → loft-BNvBZzqe.cjs} +5 -5
- package/dist/{loft-Bhw-FMoL.js → loft-D0aCZRaB.js} +7 -7
- package/dist/measurement/measureFns.d.ts +2 -2
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/{measurement-D8EJ694A.js → measurement-C7o5jE6G.js} +2 -2
- package/dist/{measurement-BoNTUBAp.cjs → measurement-DZcaxo1A.cjs} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-7dgZgNYK.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-CtUl9fGY.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/extrude.d.ts +2 -12
- package/dist/operations/extrude.d.ts.map +1 -1
- package/dist/operations/extrudeFns.d.ts +2 -93
- package/dist/operations/extrudeFns.d.ts.map +1 -1
- package/dist/operations/guidedSweepFns.d.ts +3 -22
- package/dist/operations/guidedSweepFns.d.ts.map +1 -1
- package/dist/operations/loft.d.ts +2 -16
- package/dist/operations/loft.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts +3 -29
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/operations/roofFns.d.ts +2 -2
- package/dist/operations/roofFns.d.ts.map +1 -1
- package/dist/operations/sweepFns.d.ts +121 -0
- package/dist/operations/sweepFns.d.ts.map +1 -0
- package/dist/{operations-BfbkK6DU.js → operations-DisJ5F8s.js} +110 -57
- package/dist/{operations-CYpmLSC4.cjs → operations-DwZ-RBO1.cjs} +97 -44
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +14 -14
- package/dist/originTrackingFns-NJ1dWoiF.js +137 -0
- package/dist/originTrackingFns-dhaCe8Yb.cjs +136 -0
- package/dist/query/edgeFinder.d.ts +4 -14
- package/dist/query/edgeFinder.d.ts.map +1 -1
- package/dist/query/faceFinder.d.ts +4 -14
- package/dist/query/faceFinder.d.ts.map +1 -1
- package/dist/query/finderCore.d.ts +6 -0
- package/dist/query/finderCore.d.ts.map +1 -1
- package/dist/query/shapeFinders.d.ts +32 -0
- package/dist/query/shapeFinders.d.ts.map +1 -0
- package/dist/query/wireFinder.d.ts +4 -9
- package/dist/query/wireFinder.d.ts.map +1 -1
- package/dist/query.cjs +54 -32
- package/dist/query.js +56 -34
- package/dist/{result-fAX0OZzI.cjs → result-DJAAj1yb.cjs} +8 -59
- package/dist/{result-BaSD1fqR.js → result-DtuwWSUD.js} +38 -89
- package/dist/result.cjs +1 -1
- package/dist/result.js +22 -22
- package/dist/shapeFns-BJbua5kT.js +34 -0
- package/dist/shapeFns-w9tWELHX.cjs +33 -0
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-CAEAyk8j.js} +233 -172
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-owrg2MNK.cjs} +421 -360
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BLQ4I6Ig.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-BS-1220W.js} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dj6AjhOv.js} +7 -7
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-KU_7OD2q.cjs} +3 -3
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/compoundOpsFns.d.ts +3 -35
- package/dist/topology/compoundOpsFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +0 -1
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- package/dist/topology/originTrackingFns.d.ts +23 -0
- package/dist/topology/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/shapeFns.d.ts +6 -120
- package/dist/topology/shapeFns.d.ts.map +1 -1
- package/dist/topology/topologyQueryFns.d.ts +67 -0
- package/dist/topology/topologyQueryFns.d.ts.map +1 -0
- package/dist/topology/transformFns.d.ts +49 -0
- package/dist/topology/transformFns.d.ts.map +1 -0
- package/dist/topology/wrapperFns.d.ts.map +1 -1
- package/dist/{topology-ANwCzGL8.cjs → topology-CyPHYYjV.cjs} +205 -20
- package/dist/{topology-C7x98OVn.js → topology-D6LeuhI_.js} +235 -50
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +92 -91
- package/dist/topologyQueryFns-De439iBP.js +119 -0
- package/dist/topologyQueryFns-fz5kz5e1.cjs +118 -0
- package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
- package/dist/utils/precisionRound.d.ts +4 -0
- package/dist/utils/precisionRound.d.ts.map +1 -1
- package/dist/utils/vec2d.d.ts +5 -0
- package/dist/utils/vec2d.d.ts.map +1 -1
- package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
- package/dist/{vectors-D_IiZx0q.cjs → vectors-C8N_QeEX.cjs} +9 -1
- package/dist/{vectors-Bx8wkNui.js → vectors-DTREgnVp.js} +15 -7
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +3 -3
- package/dist/core/geometryHelpers.d.ts +0 -30
- package/dist/core/geometryHelpers.d.ts.map +0 -1
- package/dist/core/memory.d.ts +0 -6
- package/dist/core/memory.d.ts.map +0 -1
- package/dist/core/typeErrors.d.ts +0 -17
- package/dist/core/typeErrors.d.ts.map +0 -1
- package/dist/cornerFinder-Ckz-mPHE.js +0 -59
- package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/utils/round2.d.ts +0 -3
- package/dist/utils/round2.d.ts.map +0 -1
- package/dist/utils/round5.d.ts +0 -3
- package/dist/utils/round5.d.ts.map +0 -1
package/dist/core.cjs
CHANGED
|
@@ -2,9 +2,50 @@
|
|
|
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 result = require("./result-
|
|
6
|
-
const vectors = require("./vectors-
|
|
7
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
6
|
+
const vectors = require("./vectors-C8N_QeEX.cjs");
|
|
7
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
8
|
+
function isClosedWire(wire) {
|
|
9
|
+
return shapeTypes.getKernel().curveIsClosed(wire.wrapped);
|
|
10
|
+
}
|
|
11
|
+
function isOrientedFace(face) {
|
|
12
|
+
return shapeTypes.getKernel().isValid(face.wrapped);
|
|
13
|
+
}
|
|
14
|
+
function isManifoldShell(shell) {
|
|
15
|
+
const kernel = shapeTypes.getKernel();
|
|
16
|
+
if (!kernel.isValid(shell.wrapped)) return false;
|
|
17
|
+
const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
|
|
18
|
+
try {
|
|
19
|
+
const solid = kernel.solidFromShell(shell.wrapped);
|
|
20
|
+
const valid = validate(solid);
|
|
21
|
+
try {
|
|
22
|
+
kernel.dispose(solid);
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
return valid;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function isValidSolid(solid) {
|
|
31
|
+
return shapeTypes.getKernel().isValid(solid.wrapped);
|
|
32
|
+
}
|
|
33
|
+
function closedWire(wire) {
|
|
34
|
+
if (isClosedWire(wire)) return result.ok(wire);
|
|
35
|
+
return result.err("Wire is not closed: start and end points do not coincide");
|
|
36
|
+
}
|
|
37
|
+
function orientedFace(face) {
|
|
38
|
+
if (isOrientedFace(face)) return result.ok(face);
|
|
39
|
+
return result.err("Face orientation is inconsistent or face is invalid");
|
|
40
|
+
}
|
|
41
|
+
function manifoldShell(shell) {
|
|
42
|
+
if (isManifoldShell(shell)) return result.ok(shell);
|
|
43
|
+
return result.err("Shell is not manifold: has free edges or is invalid");
|
|
44
|
+
}
|
|
45
|
+
function validSolid(solid) {
|
|
46
|
+
if (isValidSolid(solid)) return result.ok(solid);
|
|
47
|
+
return result.err("Solid failed BRepCheck validation");
|
|
48
|
+
}
|
|
8
49
|
exports.resolveDirection = types.resolveDirection;
|
|
9
50
|
exports.toVec2 = types.toVec2;
|
|
10
51
|
exports.toVec3 = types.toVec3;
|
|
@@ -62,29 +103,29 @@ exports.resolvePlane = vectors.resolvePlane;
|
|
|
62
103
|
exports.translatePlane = vectors.translatePlane;
|
|
63
104
|
exports.DisposalScope = shapeTypes.DisposalScope;
|
|
64
105
|
exports.castShape = shapeTypes.castShape;
|
|
65
|
-
exports.closedWire = shapeTypes.closedWire;
|
|
66
106
|
exports.createHandle = shapeTypes.createHandle;
|
|
67
107
|
exports.createKernelHandle = shapeTypes.createKernelHandle;
|
|
68
108
|
exports.getShapeKind = shapeTypes.getShapeKind;
|
|
69
109
|
exports.is2D = shapeTypes.is2D;
|
|
70
110
|
exports.is3D = shapeTypes.is3D;
|
|
71
|
-
exports.isClosedWire = shapeTypes.isClosedWire;
|
|
72
111
|
exports.isCompound = shapeTypes.isCompound;
|
|
73
112
|
exports.isEdge = shapeTypes.isEdge;
|
|
74
113
|
exports.isFace = shapeTypes.isFace;
|
|
75
114
|
exports.isLive = shapeTypes.isLive;
|
|
76
|
-
exports.isManifoldShell = shapeTypes.isManifoldShell;
|
|
77
|
-
exports.isOrientedFace = shapeTypes.isOrientedFace;
|
|
78
115
|
exports.isShape1D = shapeTypes.isShape1D;
|
|
79
116
|
exports.isShape3D = shapeTypes.isShape3D;
|
|
80
117
|
exports.isShell = shapeTypes.isShell;
|
|
81
118
|
exports.isSolid = shapeTypes.isSolid;
|
|
82
|
-
exports.isValidSolid = shapeTypes.isValidSolid;
|
|
83
119
|
exports.isVertex = shapeTypes.isVertex;
|
|
84
120
|
exports.isWire = shapeTypes.isWire;
|
|
85
|
-
exports.manifoldShell = shapeTypes.manifoldShell;
|
|
86
|
-
exports.orientedFace = shapeTypes.orientedFace;
|
|
87
|
-
exports.validSolid = shapeTypes.validSolid;
|
|
88
121
|
exports.withScope = shapeTypes.withScope;
|
|
89
122
|
exports.withScopeResult = shapeTypes.withScopeResult;
|
|
90
123
|
exports.withScopeResultAsync = shapeTypes.withScopeResultAsync;
|
|
124
|
+
exports.closedWire = closedWire;
|
|
125
|
+
exports.isClosedWire = isClosedWire;
|
|
126
|
+
exports.isManifoldShell = isManifoldShell;
|
|
127
|
+
exports.isOrientedFace = isOrientedFace;
|
|
128
|
+
exports.isValidSolid = isValidSolid;
|
|
129
|
+
exports.manifoldShell = manifoldShell;
|
|
130
|
+
exports.orientedFace = orientedFace;
|
|
131
|
+
exports.validSolid = validSolid;
|
package/dist/core.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { type BrepError, type BrepErrorKind, kernelError, validationError, typeC
|
|
|
10
10
|
export { DEG2RAD, RAD2DEG, HASH_CODE_MAX } from './core/constants.js';
|
|
11
11
|
export type { Plane as FnPlane, PlaneName as FnPlaneName, PlaneInput } from './core/planeTypes.js';
|
|
12
12
|
export { createPlane, createNamedPlane, resolvePlane, translatePlane, pivotPlane, } from './core/planeOps.js';
|
|
13
|
-
export type { Dimension, ShapeKind, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound, AnyShape, Shape1D, Shape3D, ClosedWire, OrientedFace, ManifoldShell, ValidSolid,
|
|
13
|
+
export type { Dimension, ShapeKind, Vertex, Edge, Wire, Face, Shell, Solid, CompSolid, Compound, AnyShape, Shape1D, Shape3D, ClosedWire, OrientedFace, ManifoldShell, ValidSolid, } from './core/shapeTypes.js';
|
|
14
14
|
export { castShape, getShapeKind, isVertex, isEdge, isWire, isFace, isShell, isSolid, isCompound, isShape3D, isShape1D, is3D, is2D, closedWire, orientedFace, manifoldShell, validSolid, isClosedWire, isOrientedFace, isManifoldShell, isValidSolid, } from './core/shapeTypes.js';
|
|
15
15
|
export type { ShapeHandle, KernelHandle } from './core/disposal.js';
|
|
16
16
|
export { createHandle, createKernelHandle, DisposalScope, withScope, withScopeResult, withScopeResultAsync, isLive, } from './core/disposal.js';
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,EAAE,EACF,GAAG,EACH,EAAE,EACF,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,EAAE,EACF,GAAG,EACH,EAAE,EACF,IAAI,EACJ,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,KAAK,MAAM,EACX,KAAK,EAAE,EACP,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,YAAY,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,MAAM,GACP,MAAM,oBAAoB,CAAC"}
|
package/dist/core.js
CHANGED
|
@@ -1,90 +1,133 @@
|
|
|
1
|
-
import { r,
|
|
2
|
-
import { D, H, R,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { r, a, t } from "./types-CcKqsmd0.js";
|
|
2
|
+
import { D, H, R, a as a2, j, e, h, d, k, i, v, l, m, c, n, o, g, b, f } from "./vecOps-LTN--A58.js";
|
|
3
|
+
import { o as ok, e as err } from "./result-DtuwWSUD.js";
|
|
4
|
+
import { g as g2, O, a as a3, c as c2, j as j2, d as d2, l as l2, i as i2, b as b2, f as f2, k as k2, p, w, x, y, q, D as D2, G, H as H2, t as t2, I, u, J, K, L, v as v2 } from "./result-DtuwWSUD.js";
|
|
5
|
+
import { a as a4, c as c3, b as b3, r as r2, t as t3 } from "./vectors-DTREgnVp.js";
|
|
6
|
+
import { g as getKernel } from "./shapeTypes-CAEAyk8j.js";
|
|
7
|
+
import { D as D3, c as c4, v as v3, w as w2, a as a5, B, C, E, i as i3, o as o2, F, G as G2, j as j3, d as d3, k as k3, H as H3, b as b4, L as L2, M, N } from "./shapeTypes-CAEAyk8j.js";
|
|
8
|
+
function isClosedWire(wire) {
|
|
9
|
+
return getKernel().curveIsClosed(wire.wrapped);
|
|
10
|
+
}
|
|
11
|
+
function isOrientedFace(face) {
|
|
12
|
+
return getKernel().isValid(face.wrapped);
|
|
13
|
+
}
|
|
14
|
+
function isManifoldShell(shell) {
|
|
15
|
+
const kernel = getKernel();
|
|
16
|
+
if (!kernel.isValid(shell.wrapped)) return false;
|
|
17
|
+
const validate = kernel.isValidStrict?.bind(kernel) ?? kernel.isValid.bind(kernel);
|
|
18
|
+
try {
|
|
19
|
+
const solid = kernel.solidFromShell(shell.wrapped);
|
|
20
|
+
const valid = validate(solid);
|
|
21
|
+
try {
|
|
22
|
+
kernel.dispose(solid);
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
return valid;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function isValidSolid(solid) {
|
|
31
|
+
return getKernel().isValid(solid.wrapped);
|
|
32
|
+
}
|
|
33
|
+
function closedWire(wire) {
|
|
34
|
+
if (isClosedWire(wire)) return ok(wire);
|
|
35
|
+
return err("Wire is not closed: start and end points do not coincide");
|
|
36
|
+
}
|
|
37
|
+
function orientedFace(face) {
|
|
38
|
+
if (isOrientedFace(face)) return ok(face);
|
|
39
|
+
return err("Face orientation is inconsistent or face is invalid");
|
|
40
|
+
}
|
|
41
|
+
function manifoldShell(shell) {
|
|
42
|
+
if (isManifoldShell(shell)) return ok(shell);
|
|
43
|
+
return err("Shell is not manifold: has free edges or is invalid");
|
|
44
|
+
}
|
|
45
|
+
function validSolid(solid) {
|
|
46
|
+
if (isValidSolid(solid)) return ok(solid);
|
|
47
|
+
return err("Solid failed BRepCheck validation");
|
|
48
|
+
}
|
|
6
49
|
export {
|
|
7
|
-
|
|
50
|
+
g2 as BrepBugError,
|
|
8
51
|
D as DEG2RAD,
|
|
9
|
-
|
|
52
|
+
D3 as DisposalScope,
|
|
10
53
|
H as HASH_CODE_MAX,
|
|
11
54
|
O as OK,
|
|
12
55
|
R as RAD2DEG,
|
|
13
56
|
a3 as andThen,
|
|
14
|
-
|
|
57
|
+
c2 as bug,
|
|
15
58
|
c4 as castShape,
|
|
16
|
-
|
|
17
|
-
|
|
59
|
+
closedWire,
|
|
60
|
+
j2 as collect,
|
|
18
61
|
d2 as computationError,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
62
|
+
v3 as createHandle,
|
|
63
|
+
w2 as createKernelHandle,
|
|
64
|
+
a4 as createNamedPlane,
|
|
65
|
+
c3 as createPlane,
|
|
66
|
+
err,
|
|
67
|
+
l2 as flatMap,
|
|
68
|
+
a5 as getShapeKind,
|
|
26
69
|
i2 as ioError,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
B as is2D,
|
|
71
|
+
C as is3D,
|
|
72
|
+
isClosedWire,
|
|
73
|
+
E as isCompound,
|
|
74
|
+
i3 as isEdge,
|
|
75
|
+
b2 as isErr,
|
|
76
|
+
o2 as isFace,
|
|
77
|
+
F as isLive,
|
|
78
|
+
isManifoldShell,
|
|
79
|
+
f2 as isOk,
|
|
80
|
+
isOrientedFace,
|
|
81
|
+
G2 as isShape1D,
|
|
82
|
+
j3 as isShape3D,
|
|
83
|
+
d3 as isShell,
|
|
84
|
+
k3 as isSolid,
|
|
85
|
+
isValidSolid,
|
|
86
|
+
H3 as isVertex,
|
|
87
|
+
b4 as isWire,
|
|
45
88
|
k2 as kernelError,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
manifoldShell,
|
|
90
|
+
p as map,
|
|
91
|
+
w as mapErr,
|
|
92
|
+
x as match,
|
|
93
|
+
y as moduleInitError,
|
|
94
|
+
ok,
|
|
95
|
+
orientedFace,
|
|
96
|
+
b3 as pivotPlane,
|
|
54
97
|
q as queryError,
|
|
55
98
|
r as resolveDirection,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
99
|
+
r2 as resolvePlane,
|
|
100
|
+
D2 as sketcherStateError,
|
|
101
|
+
a as toVec2,
|
|
102
|
+
t as toVec3,
|
|
60
103
|
t3 as translatePlane,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
104
|
+
G as tryCatch,
|
|
105
|
+
H2 as tryCatchAsync,
|
|
106
|
+
t2 as typeCastError,
|
|
107
|
+
I as unsupportedError,
|
|
108
|
+
u as unwrap,
|
|
109
|
+
J as unwrapErr,
|
|
110
|
+
K as unwrapOr,
|
|
111
|
+
L as unwrapOrElse,
|
|
112
|
+
validSolid,
|
|
113
|
+
v2 as validationError,
|
|
114
|
+
a2 as vecAdd,
|
|
115
|
+
j as vecAngle,
|
|
116
|
+
e as vecCross,
|
|
117
|
+
h as vecDistance,
|
|
75
118
|
d as vecDot,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
k as vecEquals,
|
|
120
|
+
i as vecIsZero,
|
|
121
|
+
v as vecLength,
|
|
122
|
+
l as vecLengthSq,
|
|
123
|
+
m as vecNegate,
|
|
124
|
+
c as vecNormalize,
|
|
125
|
+
n as vecProjectToPlane,
|
|
126
|
+
o as vecRepr,
|
|
127
|
+
g as vecRotate,
|
|
128
|
+
b as vecScale,
|
|
129
|
+
f as vecSub,
|
|
130
|
+
L2 as withScope,
|
|
131
|
+
M as withScopeResult,
|
|
132
|
+
N as withScopeResultAsync
|
|
90
133
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { e as err,
|
|
1
|
+
import { g as getKernel, c as castShape, i as isEdge, b as isWire } from "./shapeTypes-CAEAyk8j.js";
|
|
2
|
+
import { e as err, t as typeCastError, o as ok } from "./result-DtuwWSUD.js";
|
|
3
3
|
function getCurveType(shape) {
|
|
4
4
|
return getKernel().curveType(shape.wrapped);
|
|
5
5
|
}
|
|
@@ -97,18 +97,18 @@ function offsetWire2D(wire, offset, kind = "arc") {
|
|
|
97
97
|
return ok(wrapped);
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
curveIsClosed as a,
|
|
101
|
+
getOrientation as b,
|
|
102
|
+
curveLength as c,
|
|
103
|
+
curveStartPoint as d,
|
|
104
|
+
curveTangentAt as e,
|
|
105
|
+
curvePointAt as f,
|
|
106
|
+
getCurveType as g,
|
|
107
|
+
curveEndPoint as h,
|
|
108
|
+
approximateCurve as i,
|
|
109
|
+
curveIsPeriodic as j,
|
|
110
|
+
curvePeriod as k,
|
|
111
|
+
flipOrientation as l,
|
|
112
112
|
interpolateCurve as m,
|
|
113
113
|
offsetWire2D as o
|
|
114
114
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const result = require("./result-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
3
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
4
4
|
function getCurveType(shape) {
|
|
5
5
|
return shapeTypes.getKernel().curveType(shape.wrapped);
|
|
6
6
|
}
|
|
@@ -43,22 +43,22 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
43
43
|
};
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
|
-
import {
|
|
47
|
-
import { r as resolvePlane,
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
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 {
|
|
54
|
-
import {
|
|
55
|
-
import { c as curvesAsEdgesOnPlane,
|
|
56
|
-
import { s as samePoint$1, P as PRECISION_OFFSET,
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-Bhw-FMoL.js";
|
|
46
|
+
import { c as bug, u as unwrap, f as isOk, s as safeIndex, e as err, v as validationError, o as ok } from "./result-DtuwWSUD.js";
|
|
47
|
+
import { r as resolvePlane, p as planeToWorld } from "./vectors-DTREgnVp.js";
|
|
48
|
+
import { t as toVec3 } from "./types-CcKqsmd0.js";
|
|
49
|
+
import { c as vecNormalize, e as vecCross, f as vecSub, b as vecScale, g as vecRotate, D as DEG2RAD, v as vecLength } from "./vecOps-LTN--A58.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-CR4efa35.js";
|
|
51
|
+
import { d as downcast, c as cast, e as faceCenter, n as normalAt, o as outerWire } from "./faceFns-DGMp47Os.js";
|
|
52
|
+
import { o as offsetWire2D } from "./curveFns-1u0oZ0u0.js";
|
|
53
|
+
import { D as DisposalScope, g as getKernel, l as createWire, n as createFace, o as isFace, c as castShape } from "./shapeTypes-CAEAyk8j.js";
|
|
54
|
+
import { a as assembleWire, d as addHolesInFace, c as makeFace, e as makeCircle, f as makeEllipse, b as makeHelix, g as makeBSplineApproximation } from "./surfaceBuilders-Dj6AjhOv.js";
|
|
55
|
+
import { c as curvesAsEdgesOnPlane, B as Blueprint, C as Curve2D, m as make2dSegmentCurve, a as make2dArcFromCenter, b as approximateAsSvgCompatibleCurve, d as BoundingBox2d, e as edgeToCurve, f as make2dInerpolatedBSplineCurve, g as make2dCircle, h as make2dEllipse, i as deserializeCurve2D } from "./Blueprint-1HGbugaC.js";
|
|
56
|
+
import { s as samePoint$1, P as PRECISION_OFFSET, e as squareDistance2d, c as subtract2d, b as add2d } from "./helpers-sJjnIXDA.js";
|
|
57
|
+
import { a as makeCompound, b as makeSolid } from "./solidBuilders-BS-1220W.js";
|
|
58
|
+
import { b as basicFaceExtrusion, r as revolution, c as complexExtrude, t as twistExtrude } from "./loft-D0aCZRaB.js";
|
|
60
59
|
import opentype from "opentype.js";
|
|
61
|
-
import {
|
|
60
|
+
import { d as getEdges } from "./topologyQueryFns-De439iBP.js";
|
|
61
|
+
import { cornerFinder } from "./query.js";
|
|
62
62
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
63
63
|
const startPoints = new Flatbush(curves.length);
|
|
64
64
|
curves.forEach((c) => {
|
|
@@ -174,7 +174,7 @@ class Sketcher extends BaseSketcher2d {
|
|
|
174
174
|
const startToEndVector = vecNormalize(diff);
|
|
175
175
|
const normal = vecCross(startToEndVector, this.plane.zDir);
|
|
176
176
|
const clonedWrapped = unwrap(downcast(wire.wrapped));
|
|
177
|
-
const mirroredRaw = mirror(clonedWrapped,
|
|
177
|
+
const mirroredRaw = getKernel().mirror(clonedWrapped, toVec3(pointer3d), toVec3(normal));
|
|
178
178
|
const mirroredWrapped = unwrap(downcast(mirroredRaw));
|
|
179
179
|
const mirroredWire = createWire(mirroredWrapped);
|
|
180
180
|
const combinedWire = unwrap(assembleWire([wire, mirroredWire]));
|
|
@@ -44,22 +44,22 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
};
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
|
-
const result = require("./result-
|
|
48
|
-
const vectors = require("./vectors-
|
|
47
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
48
|
+
const vectors = require("./vectors-C8N_QeEX.cjs");
|
|
49
49
|
const types = require("./types-CA_xrgDq.cjs");
|
|
50
50
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
51
|
-
const boolean2D = require("./boolean2D-
|
|
52
|
-
const faceFns = require("./faceFns-
|
|
53
|
-
const curveFns = require("./curveFns-
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const Blueprint = require("./Blueprint-
|
|
57
|
-
const helpers = require("./helpers-
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const loft = require("./loft-hp3pc1M7.cjs");
|
|
51
|
+
const boolean2D = require("./boolean2D-9OnbotKT.cjs");
|
|
52
|
+
const faceFns = require("./faceFns-BAKkZG6D.cjs");
|
|
53
|
+
const curveFns = require("./curveFns-BwLvO_Ia.cjs");
|
|
54
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-KU_7OD2q.cjs");
|
|
56
|
+
const Blueprint = require("./Blueprint-CUyXM6CV.cjs");
|
|
57
|
+
const helpers = require("./helpers-DVdscQxW.cjs");
|
|
58
|
+
const solidBuilders = require("./solidBuilders-BLQ4I6Ig.cjs");
|
|
59
|
+
const loft = require("./loft-BNvBZzqe.cjs");
|
|
61
60
|
const opentype = require("opentype.js");
|
|
62
|
-
const
|
|
61
|
+
const topologyQueryFns = require("./topologyQueryFns-fz5kz5e1.cjs");
|
|
62
|
+
const query = require("./query.cjs");
|
|
63
63
|
const stitchCurves = (curves, precision = 1e-7) => {
|
|
64
64
|
const startPoints = new boolean2D.Flatbush(curves.length);
|
|
65
65
|
curves.forEach((c) => {
|
|
@@ -175,7 +175,7 @@ class Sketcher extends boolean2D.BaseSketcher2d {
|
|
|
175
175
|
const startToEndVector = vecOps.vecNormalize(diff);
|
|
176
176
|
const normal = vecOps.vecCross(startToEndVector, this.plane.zDir);
|
|
177
177
|
const clonedWrapped = result.unwrap(faceFns.downcast(wire.wrapped));
|
|
178
|
-
const mirroredRaw =
|
|
178
|
+
const mirroredRaw = shapeTypes.getKernel().mirror(clonedWrapped, types.toVec3(pointer3d), types.toVec3(normal));
|
|
179
179
|
const mirroredWrapped = result.unwrap(faceFns.downcast(mirroredRaw));
|
|
180
180
|
const mirroredWire = shapeTypes.createWire(mirroredWrapped);
|
|
181
181
|
const combinedWire = result.unwrap(surfaceBuilders.assembleWire([wire, mirroredWire]));
|
|
@@ -925,7 +925,7 @@ function isProjectionPlane(plane) {
|
|
|
925
925
|
}
|
|
926
926
|
const getEdgesFromOc = (shape) => {
|
|
927
927
|
if (shape.IsNull()) return [];
|
|
928
|
-
return
|
|
928
|
+
return topologyQueryFns.getEdges(shapeTypes.castShape(shape));
|
|
929
929
|
};
|
|
930
930
|
function makeProjectedEdges(shape, camera, withHiddenLines = true) {
|
|
931
931
|
const projected = shapeTypes.getKernel().projectEdges(
|
|
@@ -1098,7 +1098,7 @@ class Drawing {
|
|
|
1098
1098
|
* @category Drawing Modifications
|
|
1099
1099
|
*/
|
|
1100
1100
|
fillet(radius, filter) {
|
|
1101
|
-
const finder = filter && filter(
|
|
1101
|
+
const finder = filter && filter(query.cornerFinder());
|
|
1102
1102
|
return new Drawing(fillet2D(this.innerShape, radius, finder));
|
|
1103
1103
|
}
|
|
1104
1104
|
/**
|
|
@@ -1108,7 +1108,7 @@ class Drawing {
|
|
|
1108
1108
|
* @category Drawing Modifications
|
|
1109
1109
|
*/
|
|
1110
1110
|
chamfer(radius, filter) {
|
|
1111
|
-
const finder = filter && filter(
|
|
1111
|
+
const finder = filter && filter(query.cornerFinder());
|
|
1112
1112
|
return new Drawing(chamfer2D(this.innerShape, radius, finder));
|
|
1113
1113
|
}
|
|
1114
1114
|
sketchOnPlane(inputPlane, origin) {
|
|
@@ -1303,7 +1303,7 @@ function drawFaceOutline(face) {
|
|
|
1303
1303
|
const scope = __using(_stack, new shapeTypes.DisposalScope());
|
|
1304
1304
|
const clonedFace = scope.register(shapeTypes.createFace(result.unwrap(faceFns.downcast(face.wrapped))));
|
|
1305
1305
|
const faceOuterWire = scope.register(faceFns.outerWire(clonedFace));
|
|
1306
|
-
const curves =
|
|
1306
|
+
const curves = topologyQueryFns.getEdges(faceOuterWire).map((e) => Blueprint.edgeToCurve(e, face));
|
|
1307
1307
|
const stitchedCurves = stitchCurves(curves).map((s) => new Blueprint.Blueprint(s));
|
|
1308
1308
|
if (stitchedCurves.length === 0) return new Drawing();
|
|
1309
1309
|
if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
3
3
|
const types = require("./types-CA_xrgDq.cjs");
|
|
4
|
-
const result = require("./result-
|
|
4
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
5
5
|
const TOPO_ENUM = {
|
|
6
6
|
compound: 0,
|
|
7
7
|
solidCompound: 1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { e as err,
|
|
1
|
+
import { g as getKernel, c as castShape, j as isShape3D$1, b as isWire$1 } from "./shapeTypes-CAEAyk8j.js";
|
|
2
|
+
import { t as toVec3 } from "./types-CcKqsmd0.js";
|
|
3
|
+
import { e as err, t as typeCastError, o as ok, u as unwrap } from "./result-DtuwWSUD.js";
|
|
4
4
|
const TOPO_ENUM = {
|
|
5
5
|
compound: 0,
|
|
6
6
|
solidCompound: 1,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
3
|
-
const result = require("./result-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-owrg2MNK.cjs");
|
|
3
|
+
const result = require("./result-DJAAj1yb.cjs");
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const curveFns = require("./curveFns-BwLvO_Ia.cjs");
|
|
6
|
+
const faceFns = require("./faceFns-BAKkZG6D.cjs");
|
|
7
|
+
const measurement = require("./measurement-DZcaxo1A.cjs");
|
|
8
|
+
const shapeFns = require("./shapeFns-w9tWELHX.cjs");
|
|
8
9
|
const PRECISION_INTERSECTION = 1e-9;
|
|
9
10
|
const PRECISION_OFFSET = 1e-8;
|
|
10
11
|
const PRECISION_POINT = 1e-6;
|
|
@@ -46,6 +47,10 @@ const rotate2d = (point, angle, center = [0, 0]) => {
|
|
|
46
47
|
const ynew = px * sinA + py * cosA;
|
|
47
48
|
return [xnew + cx, ynew + cy];
|
|
48
49
|
};
|
|
50
|
+
function normalize2d([x, y]) {
|
|
51
|
+
const l = Math.sqrt(x * x + y * y);
|
|
52
|
+
return l < 1e-12 ? [0, 0] : [x / l, y / l];
|
|
53
|
+
}
|
|
49
54
|
const polarToCartesian = (r, theta) => {
|
|
50
55
|
const x = Math.cos(theta) * r;
|
|
51
56
|
const y = Math.sin(theta) * r;
|
|
@@ -117,7 +122,16 @@ function createTypedFinder(topoKind, filters, rebuild, extend) {
|
|
|
117
122
|
}
|
|
118
123
|
return result.ok(match);
|
|
119
124
|
},
|
|
120
|
-
shouldKeep
|
|
125
|
+
shouldKeep,
|
|
126
|
+
and: (other) => withFilter((el) => other.shouldKeep(el)),
|
|
127
|
+
or: (other) => {
|
|
128
|
+
const selfKeep = shouldKeep;
|
|
129
|
+
return rebuild([(el) => selfKeep(el) || other.shouldKeep(el)]);
|
|
130
|
+
},
|
|
131
|
+
negate: () => {
|
|
132
|
+
const selfKeep = shouldKeep;
|
|
133
|
+
return rebuild([(el) => !selfKeep(el)]);
|
|
134
|
+
}
|
|
121
135
|
};
|
|
122
136
|
const extensions = extend(base, withFilter);
|
|
123
137
|
return { ...base, ...extensions };
|
|
@@ -139,6 +153,35 @@ function distanceFromPointFilter(distance, point, tolerance) {
|
|
|
139
153
|
return Math.abs(d - distance) < tolerance;
|
|
140
154
|
};
|
|
141
155
|
}
|
|
156
|
+
function edgeDirectionFilter(dir, angle) {
|
|
157
|
+
const d = vecOps.vecNormalize(resolveDir(dir));
|
|
158
|
+
return (edge) => {
|
|
159
|
+
const kernel = shapeTypes.getKernel();
|
|
160
|
+
const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
|
|
161
|
+
const midParam = (firstParam + lastParam) / 2;
|
|
162
|
+
const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
|
|
163
|
+
const tangent = vecOps.vecNormalize(rawTangent);
|
|
164
|
+
const ang = Math.acos(Math.min(1, Math.abs(vecOps.vecDot(tangent, d))));
|
|
165
|
+
return Math.abs(ang - vecOps.DEG2RAD * angle) < 1e-6;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function buildEdgeFinder(filters) {
|
|
169
|
+
return createTypedFinder(
|
|
170
|
+
"edge",
|
|
171
|
+
filters,
|
|
172
|
+
buildEdgeFinder,
|
|
173
|
+
(_base, withFilter) => ({
|
|
174
|
+
inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
|
|
175
|
+
ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveFns.curveLength(edge) - length) < tolerance),
|
|
176
|
+
ofCurveType: (curveType) => withFilter((edge) => curveFns.getCurveType(edge) === curveType),
|
|
177
|
+
parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
|
|
178
|
+
atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
function edgeFinder() {
|
|
183
|
+
return buildEdgeFinder([]);
|
|
184
|
+
}
|
|
142
185
|
function faceDirectionFilter(dir, angle) {
|
|
143
186
|
const d = vecOps.vecNormalize(resolveDir(dir));
|
|
144
187
|
return (face) => {
|
|
@@ -164,6 +207,27 @@ function buildFaceFinder(filters) {
|
|
|
164
207
|
function faceFinder() {
|
|
165
208
|
return buildFaceFinder([]);
|
|
166
209
|
}
|
|
210
|
+
function buildWireFinder(filters) {
|
|
211
|
+
return createTypedFinder(
|
|
212
|
+
"wire",
|
|
213
|
+
filters,
|
|
214
|
+
buildWireFinder,
|
|
215
|
+
(_base, withFilter) => ({
|
|
216
|
+
isClosed: () => withFilter((wire) => curveFns.curveIsClosed(wire)),
|
|
217
|
+
isOpen: () => withFilter((wire) => !curveFns.curveIsClosed(wire)),
|
|
218
|
+
ofEdgeCount: (count) => withFilter((wire) => {
|
|
219
|
+
let edgeCount = 0;
|
|
220
|
+
for (const _raw of faceFns.iterTopo(wire.wrapped, "edge")) {
|
|
221
|
+
edgeCount++;
|
|
222
|
+
}
|
|
223
|
+
return edgeCount === count;
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
function wireFinder() {
|
|
229
|
+
return buildWireFinder([]);
|
|
230
|
+
}
|
|
167
231
|
function getSingleFace(f, shape) {
|
|
168
232
|
if (typeof f === "object" && "_topoKind" in f) {
|
|
169
233
|
return f.findUnique(shape);
|
|
@@ -180,14 +244,15 @@ exports.cartesianToPolar = cartesianToPolar;
|
|
|
180
244
|
exports.createTypedFinder = createTypedFinder;
|
|
181
245
|
exports.crossProduct2d = crossProduct2d;
|
|
182
246
|
exports.distance2d = distance2d;
|
|
183
|
-
exports.
|
|
247
|
+
exports.edgeFinder = edgeFinder;
|
|
184
248
|
exports.faceFinder = faceFinder;
|
|
185
249
|
exports.getSingleFace = getSingleFace;
|
|
250
|
+
exports.normalize2d = normalize2d;
|
|
186
251
|
exports.polarAngle2d = polarAngle2d;
|
|
187
252
|
exports.polarToCartesian = polarToCartesian;
|
|
188
|
-
exports.resolveDir = resolveDir;
|
|
189
253
|
exports.rotate2d = rotate2d;
|
|
190
254
|
exports.samePoint = samePoint;
|
|
191
255
|
exports.scalarMultiply2d = scalarMultiply2d;
|
|
192
256
|
exports.squareDistance2d = squareDistance2d;
|
|
193
257
|
exports.subtract2d = subtract2d;
|
|
258
|
+
exports.wireFinder = wireFinder;
|