brepjs 12.8.2 → 12.10.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/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
- package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
- package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
- package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
- package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
- package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
- package/dist/2d/blueprints/index.d.ts +4 -4
- package/dist/2d/blueprints/index.d.ts.map +1 -1
- package/dist/2d/lib/Curve2D.d.ts +1 -1
- package/dist/2d/lib/Curve2D.d.ts.map +1 -1
- 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-CzEysb7A.js +108 -0
- package/dist/2d-DCxS_sb_.cjs +107 -0
- package/dist/2d.cjs +24 -88
- package/dist/2d.d.ts +1 -1
- package/dist/2d.js +34 -99
- package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
- package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
- package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
- package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
- package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
- package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
- package/dist/brepjs.cjs +448 -379
- package/dist/brepjs.js +1634 -1563
- 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 +7 -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/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
- 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 +119 -76
- package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
- package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
- package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
- package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
- package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
- package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
- package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
- package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
- package/dist/index.d.ts +20 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/io/gltfImportFns.d.ts +18 -0
- package/dist/io/gltfImportFns.d.ts.map +1 -0
- package/dist/io/ioUtils.d.ts +16 -0
- package/dist/io/ioUtils.d.ts.map +1 -0
- package/dist/io/objImportFns.d.ts.map +1 -1
- package/dist/io/threemfImportFns.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/builder-ops.d.ts +57 -0
- package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
- package/dist/kernel/interfaces/core.d.ts +30 -0
- package/dist/kernel/interfaces/core.d.ts.map +1 -0
- package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
- package/dist/kernel/interfaces/curve-ops.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/index.d.ts +37 -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/primitive-ops.d.ts +13 -0
- package/dist/kernel/interfaces/primitive-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/surface-ops.d.ts +50 -0
- package/dist/kernel/interfaces/surface-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 +35 -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/measurement/measureCache.d.ts +11 -9
- package/dist/measurement/measureCache.d.ts.map +1 -1
- package/dist/measurement/measureFns.d.ts +24 -71
- package/dist/measurement/measureFns.d.ts.map +1 -1
- package/dist/measurement/measureTypes.d.ts +30 -0
- package/dist/measurement/measureTypes.d.ts.map +1 -0
- package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
- package/dist/measurement-ph-kanQ7.cjs +154 -0
- package/dist/measurement.cjs +2 -1
- package/dist/measurement.d.ts +1 -1
- package/dist/measurement.d.ts.map +1 -1
- package/dist/measurement.js +4 -3
- package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
- package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
- package/dist/operations/compoundOpsFns.d.ts +38 -0
- package/dist/operations/compoundOpsFns.d.ts.map +1 -0
- package/dist/operations/convexHullFns.d.ts +21 -0
- package/dist/operations/convexHullFns.d.ts.map +1 -0
- 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/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/straightSkeleton.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-DX_qy_TB.js} +29 -177
- package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
- package/dist/operations.cjs +6 -10
- package/dist/operations.d.ts +0 -2
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +26 -30
- package/dist/originTrackingFns-BOCAMfd0.js +137 -0
- package/dist/originTrackingFns-SPU7ly3_.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-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
- package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
- package/dist/result.cjs +1 -1
- package/dist/result.js +23 -23
- package/dist/shapeFns-BZ6zk7nd.js +34 -0
- package/dist/shapeFns-bRkrwI8R.cjs +33 -0
- package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
- package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
- package/dist/sketching/CompoundSketch.d.ts +4 -4
- package/dist/sketching/CompoundSketch.d.ts.map +1 -1
- package/dist/sketching/Sketch.d.ts +3 -3
- package/dist/sketching/Sketch.d.ts.map +1 -1
- package/dist/sketching/Sketcher.d.ts.map +1 -1
- package/dist/sketching/Sketches.d.ts +1 -1
- package/dist/sketching/Sketches.d.ts.map +1 -1
- package/dist/sketching/draw.d.ts +1 -20
- package/dist/sketching/draw.d.ts.map +1 -1
- package/dist/sketching/draw3d.d.ts +22 -0
- package/dist/sketching/draw3d.d.ts.map +1 -0
- package/dist/sketching/sketchFns.d.ts +3 -3
- package/dist/sketching/sketchFns.d.ts.map +1 -1
- package/dist/sketching/sketchLib.d.ts +2 -2
- package/dist/sketching/sketchLib.d.ts.map +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.d.ts +2 -1
- package/dist/sketching.d.ts.map +1 -1
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
- package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
- package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
- package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
- package/dist/sweepFns-BKnQs59A.js +215 -0
- package/dist/sweepFns-COqeYIUp.cjs +214 -0
- package/dist/text/textBlueprints.d.ts +4 -3
- package/dist/text/textBlueprints.d.ts.map +1 -1
- package/dist/topology/booleanFns.d.ts.map +1 -1
- package/dist/topology/cast.d.ts +1 -5
- package/dist/topology/cast.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/curveFns.d.ts +1 -1
- package/dist/topology/curveFns.d.ts.map +1 -1
- package/dist/topology/index.d.ts +2 -3
- package/dist/topology/index.d.ts.map +1 -1
- package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
- package/dist/topology/metadata/colorFns.d.ts.map +1 -0
- package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
- package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
- package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
- package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
- package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
- package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
- package/dist/topology/modifierFns.d.ts.map +1 -1
- 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-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
- package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
- package/dist/topology.cjs +18 -17
- package/dist/topology.js +97 -96
- package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
- package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -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-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
- package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
- package/dist/vectors.cjs +1 -1
- package/dist/vectors.js +23 -23
- package/package.json +9 -9
- package/dist/2d/blueprints/approximations.d.ts.map +0 -1
- package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
- package/dist/2d/blueprints/offset.d.ts.map +0 -1
- package/dist/core/definitionMaps.d.ts.map +0 -1
- 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/loft-Bhw-FMoL.js +0 -228
- package/dist/loft-hp3pc1M7.cjs +0 -227
- package/dist/measurement-BoNTUBAp.cjs +0 -135
- package/dist/operations/extrude.d.ts +0 -72
- package/dist/operations/extrude.d.ts.map +0 -1
- package/dist/operations/loft.d.ts +0 -33
- package/dist/operations/loft.d.ts.map +0 -1
- package/dist/shapeFns-C2SnNvdH.cjs +0 -468
- package/dist/shapeFns-FDuKkrDR.js +0 -469
- package/dist/topology/colorFns.d.ts.map +0 -1
- package/dist/topology/faceTagFns.d.ts.map +0 -1
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const result = require("./result-DULetAht.cjs");
|
|
3
3
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
4
|
+
const booleanFns = require("./booleanFns-CxArUj_q.cjs");
|
|
5
|
+
const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
|
|
6
|
+
const shapeFns = require("./shapeFns-bRkrwI8R.cjs");
|
|
7
|
+
const faceFns = require("./faceFns-CmIrjdt1.cjs");
|
|
8
|
+
require("./sweepFns-COqeYIUp.cjs");
|
|
9
9
|
function uuidv() {
|
|
10
10
|
return (String([1e7]) + String(-1e3) + String(-4e3) + String(-8e3) + String(-1e11)).replace(
|
|
11
11
|
/[018]/g,
|
|
@@ -32,148 +32,6 @@ function createAssembly(shapes = []) {
|
|
|
32
32
|
const doc = shapeTypes.getKernel().createXCAFDocument(parts);
|
|
33
33
|
return shapeTypes.createKernelHandle(doc);
|
|
34
34
|
}
|
|
35
|
-
function makeSpineWire(start, end) {
|
|
36
|
-
const kernel = shapeTypes.getKernel();
|
|
37
|
-
const edge = kernel.makeLineEdge([...start], [...end]);
|
|
38
|
-
const wire = kernel.makeWire([edge]);
|
|
39
|
-
return shapeTypes.castShape(wire);
|
|
40
|
-
}
|
|
41
|
-
function makeHelixWire(pitch, height, radius, center, dir, _lefthand = false) {
|
|
42
|
-
const kernel = shapeTypes.getKernel();
|
|
43
|
-
return shapeTypes.castShape(kernel.makeHelixWire(pitch, height, radius, [...center], [...dir]));
|
|
44
|
-
}
|
|
45
|
-
function extrude(face, extrusionVec) {
|
|
46
|
-
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
47
|
-
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "extrude: face is a null shape"));
|
|
48
|
-
}
|
|
49
|
-
if (vecOps.vecLength(extrusionVec) === 0) {
|
|
50
|
-
return result.err(result.validationError("EXTRUDE_ZERO_VECTOR", "extrude: extrusion vector has zero length"));
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
const kernel = shapeTypes.getKernel();
|
|
54
|
-
const len = vecOps.vecLength(extrusionVec);
|
|
55
|
-
const dir = vecOps.vecNormalize(extrusionVec);
|
|
56
|
-
const shape = kernel.extrude(face.wrapped, [...dir], len);
|
|
57
|
-
const downcastShape = kernel.downcast(shape, "solid");
|
|
58
|
-
const solid = shapeTypes.createSolid(downcastShape);
|
|
59
|
-
return result.ok(solid);
|
|
60
|
-
} catch (e) {
|
|
61
|
-
return result.err(
|
|
62
|
-
result.kernelError("EXTRUDE_FAILED", "Extrusion operation failed", e, {
|
|
63
|
-
operation: "extrude",
|
|
64
|
-
vectorLength: vecOps.vecLength(extrusionVec)
|
|
65
|
-
})
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function revolve(face, center = [0, 0, 0], direction = [0, 0, 1], angle = 360) {
|
|
70
|
-
if (shapeTypes.getKernel().isNull(face.wrapped)) {
|
|
71
|
-
return result.err(result.validationError(result.BrepErrorCode.NULL_SHAPE_INPUT, "revolve: face is a null shape"));
|
|
72
|
-
}
|
|
73
|
-
const kernel = shapeTypes.getKernel();
|
|
74
|
-
const shape = kernel.revolveVec(face.wrapped, [...center], [...direction], angle);
|
|
75
|
-
const result$1 = shapeTypes.castShape(shape);
|
|
76
|
-
if (!shapeTypes.isShape3D(result$1)) {
|
|
77
|
-
return result.err(result.typeCastError("REVOLUTION_NOT_3D", "Revolution did not produce a 3D shape"));
|
|
78
|
-
}
|
|
79
|
-
return result.ok(result$1);
|
|
80
|
-
}
|
|
81
|
-
function sweep(wire, spine, config = {}, shellMode = false) {
|
|
82
|
-
if (config.mode === "simple" && !shellMode) {
|
|
83
|
-
const kernel2 = shapeTypes.getKernel();
|
|
84
|
-
const resultOc = kernel2.simplePipe(wire.wrapped, spine.wrapped);
|
|
85
|
-
const shape2 = shapeTypes.castShape(resultOc);
|
|
86
|
-
if (!shapeTypes.isShape3D(shape2)) {
|
|
87
|
-
return result.err(result.typeCastError("SWEEP_NOT_3D", "Simple pipe did not produce a 3D shape"));
|
|
88
|
-
}
|
|
89
|
-
return result.ok(shape2);
|
|
90
|
-
}
|
|
91
|
-
const {
|
|
92
|
-
frenet = false,
|
|
93
|
-
auxiliarySpine,
|
|
94
|
-
law = null,
|
|
95
|
-
transitionMode = "right",
|
|
96
|
-
withContact,
|
|
97
|
-
support,
|
|
98
|
-
forceProfileSpineOthogonality,
|
|
99
|
-
tolerance,
|
|
100
|
-
boundTolerance,
|
|
101
|
-
angularTolerance,
|
|
102
|
-
maxDegree,
|
|
103
|
-
maxSegments
|
|
104
|
-
} = config;
|
|
105
|
-
const kernel = shapeTypes.getKernel();
|
|
106
|
-
const withCorrection = transitionMode === "round" ? true : !!forceProfileSpineOthogonality;
|
|
107
|
-
const result$1 = kernel.sweepPipeShell(wire.wrapped, spine.wrapped, {
|
|
108
|
-
transitionMode,
|
|
109
|
-
contact: !!withContact,
|
|
110
|
-
correction: withCorrection,
|
|
111
|
-
frenet,
|
|
112
|
-
shellMode,
|
|
113
|
-
...auxiliarySpine?.wrapped ? { auxiliary: auxiliarySpine.wrapped } : {},
|
|
114
|
-
...law !== null ? { law } : {},
|
|
115
|
-
...support !== null ? { support } : {},
|
|
116
|
-
tolerance,
|
|
117
|
-
boundTolerance,
|
|
118
|
-
angularTolerance,
|
|
119
|
-
maxDegree,
|
|
120
|
-
maxSegments
|
|
121
|
-
});
|
|
122
|
-
if (shellMode && typeof result$1 === "object" && "firstShape" in result$1) {
|
|
123
|
-
const shape2 = shapeTypes.castShape(result$1.shape);
|
|
124
|
-
if (!shapeTypes.isShape3D(shape2)) {
|
|
125
|
-
return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
|
|
126
|
-
}
|
|
127
|
-
const startWire = shapeTypes.castShape(result$1.firstShape);
|
|
128
|
-
const endWire = shapeTypes.castShape(result$1.lastShape);
|
|
129
|
-
if (!shapeTypes.isWire(startWire)) {
|
|
130
|
-
return result.err(result.typeCastError("SWEEP_START_NOT_WIRE", "Sweep did not produce a start Wire"));
|
|
131
|
-
}
|
|
132
|
-
if (!shapeTypes.isWire(endWire)) {
|
|
133
|
-
return result.err(result.typeCastError("SWEEP_END_NOT_WIRE", "Sweep did not produce an end Wire"));
|
|
134
|
-
}
|
|
135
|
-
return result.ok([shape2, startWire, endWire]);
|
|
136
|
-
}
|
|
137
|
-
const shape = shapeTypes.castShape(result$1);
|
|
138
|
-
if (!shapeTypes.isShape3D(shape)) {
|
|
139
|
-
return result.err(result.typeCastError("SWEEP_NOT_3D", "Sweep did not produce a 3D shape"));
|
|
140
|
-
}
|
|
141
|
-
return result.ok(shape);
|
|
142
|
-
}
|
|
143
|
-
function supportExtrude(wire, center, normal, support) {
|
|
144
|
-
const endPoint = vecOps.vecAdd(center, normal);
|
|
145
|
-
const spine = makeSpineWire(center, endPoint);
|
|
146
|
-
return sweep(wire, spine, { support });
|
|
147
|
-
}
|
|
148
|
-
function complexExtrude(wire, center, normal, profileShape, shellMode = false) {
|
|
149
|
-
const extrusionLength = vecOps.vecLength(normal);
|
|
150
|
-
if (extrusionLength === 0) {
|
|
151
|
-
return result.err(
|
|
152
|
-
result.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length")
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
const endPoint = vecOps.vecAdd(center, normal);
|
|
156
|
-
const spine = makeSpineWire(center, endPoint);
|
|
157
|
-
const law = profileShape ? result.unwrap(loft.buildLawFromProfile(extrusionLength, profileShape)) : null;
|
|
158
|
-
return sweep(wire, spine, { law }, shellMode);
|
|
159
|
-
}
|
|
160
|
-
function twistExtrude(wire, angleDegrees, center, normal, profileShape, shellMode = false) {
|
|
161
|
-
if (angleDegrees === 0) {
|
|
162
|
-
return result.err(result.validationError("ZERO_TWIST_ANGLE", "Twist angle cannot be zero"));
|
|
163
|
-
}
|
|
164
|
-
const extrusionLength = vecOps.vecLength(normal);
|
|
165
|
-
if (extrusionLength === 0) {
|
|
166
|
-
return result.err(
|
|
167
|
-
result.validationError("ZERO_LENGTH_EXTRUSION", "Extrusion vector cannot have zero length")
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
const endPoint = vecOps.vecAdd(center, normal);
|
|
171
|
-
const spine = makeSpineWire(center, endPoint);
|
|
172
|
-
const pitch = 360 / angleDegrees * extrusionLength;
|
|
173
|
-
const auxiliarySpine = makeHelixWire(pitch, extrusionLength, 1, center, normal);
|
|
174
|
-
const law = profileShape ? result.unwrap(loft.buildLawFromProfile(extrusionLength, profileShape)) : null;
|
|
175
|
-
return sweep(wire, spine, { auxiliarySpine, law }, shellMode);
|
|
176
|
-
}
|
|
177
35
|
function exportAssemblySTEP(shapes = [], { unit, modelUnit } = {}) {
|
|
178
36
|
const parseHex = (hex) => {
|
|
179
37
|
let h = hex;
|
|
@@ -533,7 +391,6 @@ exports.addChild = addChild;
|
|
|
533
391
|
exports.addStep = addStep;
|
|
534
392
|
exports.circularPattern = circularPattern;
|
|
535
393
|
exports.collectShapes = collectShapes;
|
|
536
|
-
exports.complexExtrude = complexExtrude;
|
|
537
394
|
exports.countNodes = countNodes;
|
|
538
395
|
exports.createAssembly = createAssembly;
|
|
539
396
|
exports.createAssemblyNode = createAssemblyNode;
|
|
@@ -541,7 +398,6 @@ exports.createHistory = createHistory;
|
|
|
541
398
|
exports.createRegistry = createRegistry;
|
|
542
399
|
exports.deserializeHistory = deserializeHistory;
|
|
543
400
|
exports.exportAssemblySTEP = exportAssemblySTEP;
|
|
544
|
-
exports.extrude = extrude;
|
|
545
401
|
exports.findNode = findNode;
|
|
546
402
|
exports.findStep = findStep;
|
|
547
403
|
exports.getShape = getShape;
|
|
@@ -553,13 +409,9 @@ exports.registerShape = registerShape;
|
|
|
553
409
|
exports.removeChild = removeChild;
|
|
554
410
|
exports.replayFrom = replayFrom;
|
|
555
411
|
exports.replayHistory = replayHistory;
|
|
556
|
-
exports.revolve = revolve;
|
|
557
412
|
exports.serializeHistory = serializeHistory;
|
|
558
413
|
exports.stepCount = stepCount;
|
|
559
414
|
exports.stepsFrom = stepsFrom;
|
|
560
|
-
exports.supportExtrude = supportExtrude;
|
|
561
|
-
exports.sweep = sweep;
|
|
562
|
-
exports.twistExtrude = twistExtrude;
|
|
563
415
|
exports.undoLast = undoLast;
|
|
564
416
|
exports.updateNode = updateNode;
|
|
565
417
|
exports.walkAssembly = walkAssembly;
|
package/dist/operations.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const operations = require("./operations-
|
|
4
|
-
const
|
|
3
|
+
const operations = require("./operations-Ds4xoyxR.cjs");
|
|
4
|
+
const sweepFns = require("./sweepFns-COqeYIUp.cjs");
|
|
5
5
|
exports.addChild = operations.addChild;
|
|
6
6
|
exports.addStep = operations.addStep;
|
|
7
7
|
exports.circularPattern = operations.circularPattern;
|
|
8
8
|
exports.collectShapes = operations.collectShapes;
|
|
9
|
-
exports.complexExtrude = operations.complexExtrude;
|
|
10
9
|
exports.countNodes = operations.countNodes;
|
|
11
10
|
exports.createAssembly = operations.createAssembly;
|
|
12
11
|
exports.createAssemblyNode = operations.createAssemblyNode;
|
|
@@ -26,13 +25,10 @@ exports.replayFrom = operations.replayFrom;
|
|
|
26
25
|
exports.replayHistory = operations.replayHistory;
|
|
27
26
|
exports.stepCount = operations.stepCount;
|
|
28
27
|
exports.stepsFrom = operations.stepsFrom;
|
|
29
|
-
exports.supportExtrude = operations.supportExtrude;
|
|
30
|
-
exports.sweep = operations.sweep;
|
|
31
|
-
exports.twistExtrude = operations.twistExtrude;
|
|
32
28
|
exports.undoLast = operations.undoLast;
|
|
33
29
|
exports.updateNode = operations.updateNode;
|
|
34
30
|
exports.walkAssembly = operations.walkAssembly;
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
31
|
+
exports.complexExtrude = sweepFns.complexExtrude;
|
|
32
|
+
exports.supportExtrude = sweepFns.supportExtrude;
|
|
33
|
+
exports.sweep = sweepFns.sweep;
|
|
34
|
+
exports.twistExtrude = sweepFns.twistExtrude;
|
package/dist/operations.d.ts
CHANGED
|
@@ -11,7 +11,5 @@ export { linearPattern, circularPattern, gridPattern } from './operations/patter
|
|
|
11
11
|
export { createAssemblyNode, addChild, removeChild, updateNode, findNode, walkAssembly, countNodes, collectShapes, type AssemblyNode, type AssemblyNodeOptions, } from './operations/assemblyFns.js';
|
|
12
12
|
export { exportAssemblySTEP, type ShapeOptions, type SupportedUnit, } from './operations/exporterFns.js';
|
|
13
13
|
export { createHistory, addStep, undoLast, findStep, getShape as getHistoryShape, stepCount, stepsFrom, registerShape, createRegistry, registerOperation, replayHistory, replayFrom, modifyStep, type OperationStep, type ModelHistory, type OperationFn, type OperationRegistry as HistoryOperationRegistry, } from './operations/historyFns.js';
|
|
14
|
-
export { basicFaceExtrusion, revolution, genericSweep, type GenericSweepOptions, } from './operations/extrude.js';
|
|
15
|
-
export { loft } from './operations/loft.js';
|
|
16
14
|
export { type AssemblyExporter, createAssembly } from './operations/exporters.js';
|
|
17
15
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzF,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,IAAI,eAAe,EAC3B,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,IAAI,wBAAwB,GACnD,MAAM,4BAA4B,CAAC;AAIpC,OAAO,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzF,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,IAAI,eAAe,EAC3B,SAAS,EACT,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,iBAAiB,IAAI,wBAAwB,GACnD,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/operations.js
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
import { a, b, c, d, f, g, h, i,
|
|
2
|
-
import {
|
|
1
|
+
import { a, b, c, d, e, f, g, h, i, k, m, n, o, B, l, p, r, q, s, t, u, x, y, z, A, w } from "./operations-DX_qy_TB.js";
|
|
2
|
+
import { c as c2, a as a2, s as s2, t as t2 } from "./sweepFns-BKnQs59A.js";
|
|
3
3
|
export {
|
|
4
4
|
a as addChild,
|
|
5
5
|
b as addStep,
|
|
6
|
-
b2 as basicFaceExtrusion,
|
|
7
6
|
c as circularPattern,
|
|
8
7
|
d as collectShapes,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
H as gridPattern,
|
|
8
|
+
c2 as complexExtrude,
|
|
9
|
+
e as countNodes,
|
|
10
|
+
f as createAssembly,
|
|
11
|
+
g as createAssemblyNode,
|
|
12
|
+
h as createHistory,
|
|
13
|
+
i as createRegistry,
|
|
14
|
+
k as exportAssemblySTEP,
|
|
15
|
+
m as findNode,
|
|
16
|
+
n as findStep,
|
|
17
|
+
o as getHistoryShape,
|
|
18
|
+
B as gridPattern,
|
|
21
19
|
l as linearPattern,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
F as undoLast,
|
|
36
|
-
G as updateNode,
|
|
20
|
+
p as modifyStep,
|
|
21
|
+
r as registerOperation,
|
|
22
|
+
q as registerShape,
|
|
23
|
+
s as removeChild,
|
|
24
|
+
t as replayFrom,
|
|
25
|
+
u as replayHistory,
|
|
26
|
+
x as stepCount,
|
|
27
|
+
y as stepsFrom,
|
|
28
|
+
a2 as supportExtrude,
|
|
29
|
+
s2 as sweep,
|
|
30
|
+
t2 as twistExtrude,
|
|
31
|
+
z as undoLast,
|
|
32
|
+
A as updateNode,
|
|
37
33
|
w as walkAssembly
|
|
38
34
|
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { g as getKernel } from "./shapeTypes-dhhm-T5A.js";
|
|
2
|
+
import { H as HASH_CODE_MAX } from "./vecOps-LTN--A58.js";
|
|
3
|
+
import { g as getCacheEntry, a as getOrCreateCache, b as getFaces } from "./topologyQueryFns-Dj4Xd5kx.js";
|
|
4
|
+
function setShapeOrigin(shape, origin) {
|
|
5
|
+
const cache = getOrCreateCache(shape);
|
|
6
|
+
const map = /* @__PURE__ */ new Map();
|
|
7
|
+
for (const f of getFaces(shape)) {
|
|
8
|
+
map.set(getKernel().hashCode(f.wrapped, HASH_CODE_MAX), origin);
|
|
9
|
+
}
|
|
10
|
+
cache.faceOrigins = map;
|
|
11
|
+
}
|
|
12
|
+
function getFaceOrigins(shape) {
|
|
13
|
+
return getCacheEntry(shape)?.faceOrigins;
|
|
14
|
+
}
|
|
15
|
+
function propagateOriginsFromEvolution(evolution, inputs, result) {
|
|
16
|
+
const inputOrigins = /* @__PURE__ */ new Map();
|
|
17
|
+
for (const input of inputs) {
|
|
18
|
+
const origins = getFaceOrigins(input);
|
|
19
|
+
if (!origins) continue;
|
|
20
|
+
for (const [hash, origin] of origins) {
|
|
21
|
+
inputOrigins.set(hash, origin);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (inputOrigins.size === 0) return;
|
|
25
|
+
const resultMap = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const [hash, origin] of inputOrigins) {
|
|
27
|
+
if (evolution.deleted.has(hash)) continue;
|
|
28
|
+
const modifiedHashes = evolution.modified.get(hash);
|
|
29
|
+
if (modifiedHashes && modifiedHashes.length > 0) {
|
|
30
|
+
for (const modHash of modifiedHashes) {
|
|
31
|
+
resultMap.set(modHash, origin);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
resultMap.set(hash, origin);
|
|
35
|
+
}
|
|
36
|
+
const generatedHashes = evolution.generated.get(hash);
|
|
37
|
+
if (generatedHashes) {
|
|
38
|
+
for (const genHash of generatedHashes) {
|
|
39
|
+
if (!resultMap.has(genHash)) {
|
|
40
|
+
resultMap.set(genHash, 0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (resultMap.size > 0) {
|
|
46
|
+
const cache = getOrCreateCache(result);
|
|
47
|
+
cache.faceOrigins = resultMap;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function propagateOriginsByHash(inputs, result) {
|
|
51
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const input of inputs) {
|
|
53
|
+
const origins = getFaceOrigins(input);
|
|
54
|
+
if (!origins) continue;
|
|
55
|
+
for (const [hash, origin] of origins) {
|
|
56
|
+
lookup.set(hash, origin);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (lookup.size === 0) return;
|
|
60
|
+
const kernel = getKernel();
|
|
61
|
+
const resultMap = /* @__PURE__ */ new Map();
|
|
62
|
+
const resultFaces = getFaces(result);
|
|
63
|
+
for (const f of resultFaces) {
|
|
64
|
+
const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
|
|
65
|
+
const origin = lookup.get(hash);
|
|
66
|
+
if (origin !== void 0) {
|
|
67
|
+
resultMap.set(hash, origin);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (resultMap.size === 0) {
|
|
71
|
+
const inputSigs = [];
|
|
72
|
+
for (const input of inputs) {
|
|
73
|
+
const origins = getFaceOrigins(input);
|
|
74
|
+
if (!origins) continue;
|
|
75
|
+
for (const f of getFaces(input)) {
|
|
76
|
+
const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
|
|
77
|
+
const origin = origins.get(hash);
|
|
78
|
+
if (origin === void 0) continue;
|
|
79
|
+
try {
|
|
80
|
+
const bounds = kernel.uvBounds(f.wrapped);
|
|
81
|
+
const normal = kernel.surfaceNormal(
|
|
82
|
+
f.wrapped,
|
|
83
|
+
0.5 * (bounds.uMin + bounds.uMax),
|
|
84
|
+
0.5 * (bounds.vMin + bounds.vMax)
|
|
85
|
+
);
|
|
86
|
+
const centroid = kernel.surfaceCenterOfMass(f.wrapped);
|
|
87
|
+
inputSigs.push({ origin, normal, centroid });
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (inputSigs.length > 0) {
|
|
93
|
+
for (const f of resultFaces) {
|
|
94
|
+
const hash = kernel.hashCode(f.wrapped, HASH_CODE_MAX);
|
|
95
|
+
try {
|
|
96
|
+
const outBounds = kernel.uvBounds(f.wrapped);
|
|
97
|
+
const outNormal = kernel.surfaceNormal(
|
|
98
|
+
f.wrapped,
|
|
99
|
+
0.5 * (outBounds.uMin + outBounds.uMax),
|
|
100
|
+
0.5 * (outBounds.vMin + outBounds.vMax)
|
|
101
|
+
);
|
|
102
|
+
const outCentroid = kernel.surfaceCenterOfMass(f.wrapped);
|
|
103
|
+
let bestScore = -Infinity;
|
|
104
|
+
let bestOrigin;
|
|
105
|
+
for (const inp of inputSigs) {
|
|
106
|
+
const dot = outNormal[0] * inp.normal[0] + outNormal[1] * inp.normal[1] + outNormal[2] * inp.normal[2];
|
|
107
|
+
if (dot < 0.707) continue;
|
|
108
|
+
const dx = outCentroid[0] - inp.centroid[0];
|
|
109
|
+
const dy = outCentroid[1] - inp.centroid[1];
|
|
110
|
+
const dz = outCentroid[2] - inp.centroid[2];
|
|
111
|
+
const distSq = dx * dx + dy * dy + dz * dz;
|
|
112
|
+
if (distSq > 100) continue;
|
|
113
|
+
const score = dot - distSq / 100;
|
|
114
|
+
if (score > bestScore) {
|
|
115
|
+
bestScore = score;
|
|
116
|
+
bestOrigin = inp.origin;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (bestOrigin !== void 0) {
|
|
120
|
+
resultMap.set(hash, bestOrigin);
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (resultMap.size > 0) {
|
|
128
|
+
const cache = getOrCreateCache(result);
|
|
129
|
+
cache.faceOrigins = resultMap;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
propagateOriginsFromEvolution as a,
|
|
134
|
+
getFaceOrigins as g,
|
|
135
|
+
propagateOriginsByHash as p,
|
|
136
|
+
setShapeOrigin as s
|
|
137
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const shapeTypes = require("./shapeTypes-T0n6mRmt.cjs");
|
|
3
|
+
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
4
|
+
const topologyQueryFns = require("./topologyQueryFns-0IptTUCo.cjs");
|
|
5
|
+
function setShapeOrigin(shape, origin) {
|
|
6
|
+
const cache = topologyQueryFns.getOrCreateCache(shape);
|
|
7
|
+
const map = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const f of topologyQueryFns.getFaces(shape)) {
|
|
9
|
+
map.set(shapeTypes.getKernel().hashCode(f.wrapped, vecOps.HASH_CODE_MAX), origin);
|
|
10
|
+
}
|
|
11
|
+
cache.faceOrigins = map;
|
|
12
|
+
}
|
|
13
|
+
function getFaceOrigins(shape) {
|
|
14
|
+
return topologyQueryFns.getCacheEntry(shape)?.faceOrigins;
|
|
15
|
+
}
|
|
16
|
+
function propagateOriginsFromEvolution(evolution, inputs, result) {
|
|
17
|
+
const inputOrigins = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const input of inputs) {
|
|
19
|
+
const origins = getFaceOrigins(input);
|
|
20
|
+
if (!origins) continue;
|
|
21
|
+
for (const [hash, origin] of origins) {
|
|
22
|
+
inputOrigins.set(hash, origin);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (inputOrigins.size === 0) return;
|
|
26
|
+
const resultMap = /* @__PURE__ */ new Map();
|
|
27
|
+
for (const [hash, origin] of inputOrigins) {
|
|
28
|
+
if (evolution.deleted.has(hash)) continue;
|
|
29
|
+
const modifiedHashes = evolution.modified.get(hash);
|
|
30
|
+
if (modifiedHashes && modifiedHashes.length > 0) {
|
|
31
|
+
for (const modHash of modifiedHashes) {
|
|
32
|
+
resultMap.set(modHash, origin);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
resultMap.set(hash, origin);
|
|
36
|
+
}
|
|
37
|
+
const generatedHashes = evolution.generated.get(hash);
|
|
38
|
+
if (generatedHashes) {
|
|
39
|
+
for (const genHash of generatedHashes) {
|
|
40
|
+
if (!resultMap.has(genHash)) {
|
|
41
|
+
resultMap.set(genHash, 0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (resultMap.size > 0) {
|
|
47
|
+
const cache = topologyQueryFns.getOrCreateCache(result);
|
|
48
|
+
cache.faceOrigins = resultMap;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function propagateOriginsByHash(inputs, result) {
|
|
52
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
53
|
+
for (const input of inputs) {
|
|
54
|
+
const origins = getFaceOrigins(input);
|
|
55
|
+
if (!origins) continue;
|
|
56
|
+
for (const [hash, origin] of origins) {
|
|
57
|
+
lookup.set(hash, origin);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (lookup.size === 0) return;
|
|
61
|
+
const kernel = shapeTypes.getKernel();
|
|
62
|
+
const resultMap = /* @__PURE__ */ new Map();
|
|
63
|
+
const resultFaces = topologyQueryFns.getFaces(result);
|
|
64
|
+
for (const f of resultFaces) {
|
|
65
|
+
const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
|
|
66
|
+
const origin = lookup.get(hash);
|
|
67
|
+
if (origin !== void 0) {
|
|
68
|
+
resultMap.set(hash, origin);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (resultMap.size === 0) {
|
|
72
|
+
const inputSigs = [];
|
|
73
|
+
for (const input of inputs) {
|
|
74
|
+
const origins = getFaceOrigins(input);
|
|
75
|
+
if (!origins) continue;
|
|
76
|
+
for (const f of topologyQueryFns.getFaces(input)) {
|
|
77
|
+
const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
|
|
78
|
+
const origin = origins.get(hash);
|
|
79
|
+
if (origin === void 0) continue;
|
|
80
|
+
try {
|
|
81
|
+
const bounds = kernel.uvBounds(f.wrapped);
|
|
82
|
+
const normal = kernel.surfaceNormal(
|
|
83
|
+
f.wrapped,
|
|
84
|
+
0.5 * (bounds.uMin + bounds.uMax),
|
|
85
|
+
0.5 * (bounds.vMin + bounds.vMax)
|
|
86
|
+
);
|
|
87
|
+
const centroid = kernel.surfaceCenterOfMass(f.wrapped);
|
|
88
|
+
inputSigs.push({ origin, normal, centroid });
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (inputSigs.length > 0) {
|
|
94
|
+
for (const f of resultFaces) {
|
|
95
|
+
const hash = kernel.hashCode(f.wrapped, vecOps.HASH_CODE_MAX);
|
|
96
|
+
try {
|
|
97
|
+
const outBounds = kernel.uvBounds(f.wrapped);
|
|
98
|
+
const outNormal = kernel.surfaceNormal(
|
|
99
|
+
f.wrapped,
|
|
100
|
+
0.5 * (outBounds.uMin + outBounds.uMax),
|
|
101
|
+
0.5 * (outBounds.vMin + outBounds.vMax)
|
|
102
|
+
);
|
|
103
|
+
const outCentroid = kernel.surfaceCenterOfMass(f.wrapped);
|
|
104
|
+
let bestScore = -Infinity;
|
|
105
|
+
let bestOrigin;
|
|
106
|
+
for (const inp of inputSigs) {
|
|
107
|
+
const dot = outNormal[0] * inp.normal[0] + outNormal[1] * inp.normal[1] + outNormal[2] * inp.normal[2];
|
|
108
|
+
if (dot < 0.707) continue;
|
|
109
|
+
const dx = outCentroid[0] - inp.centroid[0];
|
|
110
|
+
const dy = outCentroid[1] - inp.centroid[1];
|
|
111
|
+
const dz = outCentroid[2] - inp.centroid[2];
|
|
112
|
+
const distSq = dx * dx + dy * dy + dz * dz;
|
|
113
|
+
if (distSq > 100) continue;
|
|
114
|
+
const score = dot - distSq / 100;
|
|
115
|
+
if (score > bestScore) {
|
|
116
|
+
bestScore = score;
|
|
117
|
+
bestOrigin = inp.origin;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (bestOrigin !== void 0) {
|
|
121
|
+
resultMap.set(hash, bestOrigin);
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (resultMap.size > 0) {
|
|
129
|
+
const cache = topologyQueryFns.getOrCreateCache(result);
|
|
130
|
+
cache.faceOrigins = resultMap;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.getFaceOrigins = getFaceOrigins;
|
|
134
|
+
exports.propagateOriginsByHash = propagateOriginsByHash;
|
|
135
|
+
exports.propagateOriginsFromEvolution = propagateOriginsFromEvolution;
|
|
136
|
+
exports.setShapeOrigin = setShapeOrigin;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { DirectionInput } from './directionUtils.js';
|
|
6
|
-
export interface EdgeFinderFn extends ShapeFinder<Edge> {
|
|
7
|
-
readonly inDirection: (dir?: DirectionInput, angle?: number) => EdgeFinderFn;
|
|
8
|
-
readonly ofLength: (length: number, tolerance?: number) => EdgeFinderFn;
|
|
9
|
-
readonly ofCurveType: (curveType: CurveType) => EdgeFinderFn;
|
|
10
|
-
readonly parallelTo: (dir?: DirectionInput) => EdgeFinderFn;
|
|
11
|
-
readonly atDistance: (distance: number, point?: Vec3) => EdgeFinderFn;
|
|
12
|
-
}
|
|
13
|
-
/** Create an immutable edge finder. */
|
|
14
|
-
export declare function edgeFinder(): EdgeFinderFn;
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports from `./shapeFinders.js` for backward compatibility.
|
|
3
|
+
*/
|
|
4
|
+
export { edgeFinder, type EdgeFinderFn } from './shapeFinders.js';
|
|
15
5
|
//# sourceMappingURL=edgeFinder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgeFinder.d.ts","sourceRoot":"","sources":["../../src/query/edgeFinder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"edgeFinder.d.ts","sourceRoot":"","sources":["../../src/query/edgeFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { DirectionInput } from './directionUtils.js';
|
|
6
|
-
export interface FaceFinderFn extends ShapeFinder<Face> {
|
|
7
|
-
readonly inDirection: (dir?: DirectionInput, angle?: number) => FaceFinderFn;
|
|
8
|
-
readonly parallelTo: (dir?: DirectionInput) => FaceFinderFn;
|
|
9
|
-
readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
|
|
10
|
-
readonly ofArea: (area: number, tolerance?: number) => FaceFinderFn;
|
|
11
|
-
readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
|
|
12
|
-
}
|
|
13
|
-
/** Create an immutable face finder. */
|
|
14
|
-
export declare function faceFinder(): FaceFinderFn;
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports from `./shapeFinders.js` for backward compatibility.
|
|
3
|
+
*/
|
|
4
|
+
export { faceFinder, type FaceFinderFn } from './shapeFinders.js';
|
|
15
5
|
//# sourceMappingURL=faceFinder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faceFinder.d.ts","sourceRoot":"","sources":["../../src/query/faceFinder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"faceFinder.d.ts","sourceRoot":"","sources":["../../src/query/faceFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -17,6 +17,12 @@ export interface ShapeFinder<T extends AnyShape<Dimension>> {
|
|
|
17
17
|
readonly findUnique: (shape: AnyShape<Dimension>) => Result<T>;
|
|
18
18
|
/** Check if an element passes all filters. */
|
|
19
19
|
readonly shouldKeep: (element: T) => boolean;
|
|
20
|
+
/** Intersect: element must match both this finder AND other. */
|
|
21
|
+
readonly and: (other: ShapeFinder<T>) => ShapeFinder<T>;
|
|
22
|
+
/** Union: element must match this finder OR other. */
|
|
23
|
+
readonly or: (other: ShapeFinder<T>) => ShapeFinder<T>;
|
|
24
|
+
/** Negate: invert all filters on this finder. */
|
|
25
|
+
readonly negate: () => ShapeFinder<T>;
|
|
20
26
|
readonly _filters: ReadonlyArray<Predicate<T>>;
|
|
21
27
|
readonly _topoKind: TopoKind;
|
|
22
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finderCore.d.ts","sourceRoot":"","sources":["../../src/query/finderCore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AASjE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAMnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAM3D,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC;IACxD,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnD,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnF,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACpF,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"finderCore.d.ts","sourceRoot":"","sources":["../../src/query/finderCore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AASjE,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAMnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAM3D,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC;IACxD,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnD,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACnF,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACpF,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;IAE7C,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACxD,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;IACvD,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC;IAGtC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAC9B;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EACvF,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACpC,OAAO,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EACvD,MAAM,EAAE,CACN,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAClC,IAAI,CAAC,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,GACjC,CAAC,CA6FH"}
|