brepjs 9.3.10 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2d.cjs +2 -2
- package/dist/2d.js +3 -3
- package/dist/{Blueprint-DBFQJ5ME.js → Blueprint-Bx9F-b3M.js} +5 -5
- package/dist/{Blueprint-CYDtiBRw.cjs → Blueprint-CKGR_t7l.cjs} +5 -5
- package/dist/{boolean2D-FaadcaJX.cjs → boolean2D-DXpQlTbC.cjs} +7 -7
- package/dist/{boolean2D-BDRf7DqS.js → boolean2D-iR7ADbYD.js} +7 -7
- package/dist/{booleanFns-GfGGPjuF.js → booleanFns-7rIed0u7.js} +3 -3
- package/dist/{booleanFns-DHFR4zO7.cjs → booleanFns-Bv06tE2O.cjs} +3 -3
- package/dist/brepjs.cjs +114 -32
- package/dist/brepjs.js +126 -44
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-C1oci6gb.cjs → cornerFinder-Ci8VuZvA.cjs} +1 -1
- package/dist/{cornerFinder-Bke7uLr6.js → cornerFinder-HW6Pd4KN.js} +1 -1
- package/dist/{curveFns-BteO-W-V.js → curveFns-DimdPJLf.js} +1 -1
- package/dist/{curveFns-DOhZedkN.cjs → curveFns-NHndvCbT.cjs} +1 -1
- package/dist/{drawFns-4kaeEGpt.cjs → drawFns-BBaIUkX4.cjs} +10 -10
- package/dist/{drawFns-D7fQtIj-.js → drawFns-D1j4FnWp.js} +10 -10
- package/dist/{faceFns-FViaMujJ.js → faceFns-BkJ2_drH.js} +1 -1
- package/dist/{faceFns-Cshr6Dql.cjs → faceFns-BxkKVWoi.cjs} +1 -1
- package/dist/{helpers-aY6tdIRv.cjs → helpers-BlW0S8kc.cjs} +4 -4
- package/dist/{helpers-j3ILUOP3.js → helpers-nNbxhw97.js} +4 -4
- package/dist/io/svgImportFns.d.ts.map +1 -1
- package/dist/io.cjs +9 -3
- package/dist/io.js +9 -3
- package/dist/kernel/advancedOps.d.ts +1 -0
- package/dist/kernel/advancedOps.d.ts.map +1 -1
- package/dist/kernel/brepkitAdapter.d.ts +2 -1
- package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
- package/dist/kernel/brepkitWasmTypes.d.ts +31 -10
- package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
- package/dist/kernel/defaultAdapter.d.ts +1 -0
- package/dist/kernel/defaultAdapter.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +3 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-CiXi_aga.js → loft-C8yS_NS6.js} +3 -3
- package/dist/{loft-6RVa269J.cjs → loft-CvTRTIDd.cjs} +3 -3
- package/dist/{measurement-BNrssBY_.js → measurement-4z0i9NjE.js} +2 -2
- package/dist/{measurement-Crrs7ULW.cjs → measurement-mWRWDA69.cjs} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-xdRr7G4g.cjs → meshFns-Bl6gXIPd.cjs} +2 -2
- package/dist/{meshFns-w1baxmAz.js → meshFns-D2eLJfd6.js} +2 -2
- package/dist/operations/loftFns.d.ts +1 -1
- package/dist/operations/loftFns.d.ts.map +1 -1
- package/dist/operations/multiSweepFns.d.ts.map +1 -1
- package/dist/operations/patternFns.d.ts +14 -0
- package/dist/operations/patternFns.d.ts.map +1 -1
- package/dist/operations/roofFns.d.ts.map +1 -1
- package/dist/{operations-CbE3WgWv.js → operations-6JJEKei9.js} +33 -5
- package/dist/{operations-Ds393Tne.cjs → operations-JLacBa4V.cjs} +33 -5
- package/dist/operations.cjs +3 -2
- package/dist/operations.d.ts +1 -1
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +3 -2
- package/dist/query.cjs +4 -4
- package/dist/query.js +5 -5
- package/dist/{shapeFns-DvwUGuOx.js → shapeFns-BO9NK6Oo.js} +2 -2
- package/dist/{shapeFns-BvxOc2M_.cjs → shapeFns-DdBZDjVs.cjs} +2 -2
- package/dist/{shapeTypes-CBhj5o2y.cjs → shapeTypes-DGDFzV7k.cjs} +1 -1
- package/dist/{shapeTypes-d-jYnZuW.js → shapeTypes-Dh_qy0wO.js} +1 -1
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{surfaceBuilders-mE9oGh7r.cjs → surfaceBuilders-BQScH37x.cjs} +2 -2
- package/dist/{surfaceBuilders-C67Q29Gt.js → surfaceBuilders-CX69g8_x.js} +2 -2
- package/dist/{topology-DKWBbtZ3.cjs → topology-In3-XjPz.cjs} +6 -6
- package/dist/{topology-z4wgJE7T.js → topology-JKo9WLos.js} +6 -6
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +6 -6
- package/package.json +2 -1
package/dist/2d.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Blueprint = require("./Blueprint-
|
|
4
|
-
const boolean2D = require("./boolean2D-
|
|
3
|
+
const Blueprint = require("./Blueprint-CKGR_t7l.cjs");
|
|
4
|
+
const boolean2D = require("./boolean2D-DXpQlTbC.cjs");
|
|
5
5
|
function reverseCurve(curve) {
|
|
6
6
|
const cloned = curve.clone();
|
|
7
7
|
cloned.reverse();
|
package/dist/2d.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as Blueprint } from "./Blueprint-
|
|
2
|
-
import { d, C } from "./Blueprint-
|
|
3
|
-
import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-
|
|
1
|
+
import { B as Blueprint } from "./Blueprint-Bx9F-b3M.js";
|
|
2
|
+
import { d, C } from "./Blueprint-Bx9F-b3M.js";
|
|
3
|
+
import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-iR7ADbYD.js";
|
|
4
4
|
function reverseCurve(curve) {
|
|
5
5
|
const cloned = curve.clone();
|
|
6
6
|
cloned.reverse();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as resolvePlane } from "./vectors-B8RRTytu.js";
|
|
2
2
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
3
|
-
import { q as getKernel, y as getKernel2D, z as registerForCleanup, A as unregisterFromCleanup, s as createEdge, r as createWire } from "./shapeTypes-
|
|
4
|
-
import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-
|
|
5
|
-
import { g as getOrientation } from "./curveFns-
|
|
3
|
+
import { q as getKernel, y as getKernel2D, z as registerForCleanup, A as unregisterFromCleanup, s as createEdge, r as createWire } from "./shapeTypes-Dh_qy0wO.js";
|
|
4
|
+
import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-BkJ2_drH.js";
|
|
5
|
+
import { g as getOrientation } from "./curveFns-DimdPJLf.js";
|
|
6
6
|
import { o as ok, e as err, b as computationError, u as unwrap, x as validationError } from "./errors-lBwyc8YG.js";
|
|
7
|
-
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-
|
|
7
|
+
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, n as normalize2d, e as subtract2d, g as getSingleFace } from "./helpers-nNbxhw97.js";
|
|
8
8
|
import { R as RAD2DEG, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
9
|
-
import { m as makeFace } from "./surfaceBuilders-
|
|
9
|
+
import { m as makeFace } from "./surfaceBuilders-CX69g8_x.js";
|
|
10
10
|
import { bug } from "./result.js";
|
|
11
11
|
function makePlane(plane, origin) {
|
|
12
12
|
if (plane && typeof plane !== "string") {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vectors = require("./vectors-DqQXtR8s.cjs");
|
|
3
3
|
const types = require("./types-CA_xrgDq.cjs");
|
|
4
|
-
const shapeTypes = require("./shapeTypes-
|
|
5
|
-
const faceFns = require("./faceFns-
|
|
6
|
-
const curveFns = require("./curveFns-
|
|
4
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
5
|
+
const faceFns = require("./faceFns-BxkKVWoi.cjs");
|
|
6
|
+
const curveFns = require("./curveFns-NHndvCbT.cjs");
|
|
7
7
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
8
|
-
const helpers = require("./helpers-
|
|
8
|
+
const helpers = require("./helpers-BlW0S8kc.cjs");
|
|
9
9
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
10
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
+
const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
|
|
11
11
|
const result = require("./result.cjs");
|
|
12
12
|
function makePlane(plane, origin) {
|
|
13
13
|
if (plane && typeof plane !== "string") {
|
|
@@ -46,16 +46,16 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
46
46
|
};
|
|
47
47
|
const vectors = require("./vectors-DqQXtR8s.cjs");
|
|
48
48
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
49
|
-
const faceFns = require("./faceFns-
|
|
49
|
+
const faceFns = require("./faceFns-BxkKVWoi.cjs");
|
|
50
50
|
const types = require("./types-CA_xrgDq.cjs");
|
|
51
51
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
52
|
-
const loft = require("./loft-
|
|
53
|
-
const shapeTypes = require("./shapeTypes-
|
|
54
|
-
const curveFns = require("./curveFns-
|
|
55
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
52
|
+
const loft = require("./loft-CvTRTIDd.cjs");
|
|
53
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
54
|
+
const curveFns = require("./curveFns-NHndvCbT.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
|
|
56
56
|
const result = require("./result.cjs");
|
|
57
|
-
const helpers = require("./helpers-
|
|
58
|
-
const Blueprint = require("./Blueprint-
|
|
57
|
+
const helpers = require("./helpers-BlW0S8kc.cjs");
|
|
58
|
+
const Blueprint = require("./Blueprint-CKGR_t7l.cjs");
|
|
59
59
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
60
60
|
if (first.boundingBox.isOut(second.boundingBox))
|
|
61
61
|
return errors.ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
@@ -45,16 +45,16 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
45
45
|
};
|
|
46
46
|
import { a as createPlane } from "./vectors-B8RRTytu.js";
|
|
47
47
|
import { o as ok, e as err, b as computationError, u as unwrap, g as isOk } from "./errors-lBwyc8YG.js";
|
|
48
|
-
import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-
|
|
48
|
+
import { d as downcast, u as uvBounds, p as pointOnSurface, n as normalAt } from "./faceFns-BkJ2_drH.js";
|
|
49
49
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
50
50
|
import { n as vecScale, j as vecNormalize, b as vecCross, D as DEG2RAD, R as RAD2DEG } from "./vecOps-ZDdZWbwT.js";
|
|
51
|
-
import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-
|
|
52
|
-
import { y as getKernel2D, t as createFace, r as createWire, q as getKernel, s as createEdge, D as DisposalScope } from "./shapeTypes-
|
|
53
|
-
import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-
|
|
54
|
-
import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-
|
|
51
|
+
import { r as revolution, c as complexExtrude, t as twistExtrude, b as basicFaceExtrusion, g as genericSweep, l as loft } from "./loft-C8yS_NS6.js";
|
|
52
|
+
import { y as getKernel2D, t as createFace, r as createWire, q as getKernel, s as createEdge, D as DisposalScope } from "./shapeTypes-Dh_qy0wO.js";
|
|
53
|
+
import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-DimdPJLf.js";
|
|
54
|
+
import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-CX69g8_x.js";
|
|
55
55
|
import { bug } from "./result.js";
|
|
56
|
-
import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-
|
|
57
|
-
import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-
|
|
56
|
+
import { s as samePoint$1, n as normalize2d, e as subtract2d, c as add2d, i as crossProduct2d, b as scalarMultiply2d, f as polarToCartesian, r as rotate2d, j as cartesianToPolar, d as distance2d, p as polarAngle2d, k as PRECISION_INTERSECTION } from "./helpers-nNbxhw97.js";
|
|
57
|
+
import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, n as asSVG, B as Blueprint, o as make2dEllipseArc, p as make2dTangentArc, q as make2dBezierCurve, r as removeDuplicatePoints } from "./Blueprint-Bx9F-b3M.js";
|
|
58
58
|
const intersectCurves = (first, second, precision = 1e-9) => {
|
|
59
59
|
if (first.boundingBox.isOut(second.boundingBox))
|
|
60
60
|
return ok({ intersections: [], commonSegments: [], commonSegmentsPoints: [] });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { q as getKernel, c as castShape, j as isShape3D } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, c as castShape, j as isShape3D } from "./shapeTypes-Dh_qy0wO.js";
|
|
2
2
|
import { o as ok, d as isErr, e as err, x as validationError, B as BrepErrorCode, p as typeCastError, k as kernelError } from "./errors-lBwyc8YG.js";
|
|
3
3
|
import { r as resolvePlane } from "./vectors-B8RRTytu.js";
|
|
4
4
|
import { H as HASH_CODE_MAX, n as vecScale, v as vecAdd } from "./vecOps-ZDdZWbwT.js";
|
|
5
|
-
import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-
|
|
6
|
-
import { m as makeFace } from "./surfaceBuilders-
|
|
5
|
+
import { a as getFaces, p as propagateOriginsFromEvolution, b as propagateOriginsByHash, g as getFaceOrigins, c as getWires, d as getEdges, e as getVertices } from "./shapeFns-BO9NK6Oo.js";
|
|
6
|
+
import { m as makeFace } from "./surfaceBuilders-CX69g8_x.js";
|
|
7
7
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
function hasFaceTags(shape) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
3
3
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
4
4
|
const vectors = require("./vectors-DqQXtR8s.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const shapeFns = require("./shapeFns-
|
|
7
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
6
|
+
const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
|
|
7
|
+
const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
|
|
8
8
|
const shapeTagStore = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
const tagMetadataStore = /* @__PURE__ */ new WeakMap();
|
|
10
10
|
function hasFaceTags(shape) {
|
package/dist/brepjs.cjs
CHANGED
|
@@ -45,30 +45,30 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
45
45
|
return next();
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
48
|
-
const shapeTypes = require("./shapeTypes-
|
|
48
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
49
49
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
50
50
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
51
|
-
const Blueprint = require("./Blueprint-
|
|
52
|
-
const loft$2 = require("./loft-
|
|
53
|
-
const operations = require("./operations-
|
|
54
|
-
const boolean2D = require("./boolean2D-
|
|
51
|
+
const Blueprint = require("./Blueprint-CKGR_t7l.cjs");
|
|
52
|
+
const loft$2 = require("./loft-CvTRTIDd.cjs");
|
|
53
|
+
const operations = require("./operations-JLacBa4V.cjs");
|
|
54
|
+
const boolean2D = require("./boolean2D-DXpQlTbC.cjs");
|
|
55
55
|
const _2d = require("./2d.cjs");
|
|
56
|
-
const helpers = require("./helpers-
|
|
56
|
+
const helpers = require("./helpers-BlW0S8kc.cjs");
|
|
57
57
|
const io = require("./io.cjs");
|
|
58
|
-
const drawFns = require("./drawFns-
|
|
58
|
+
const drawFns = require("./drawFns-BBaIUkX4.cjs");
|
|
59
59
|
const types = require("./types-CA_xrgDq.cjs");
|
|
60
60
|
const vectors = require("./vectors-DqQXtR8s.cjs");
|
|
61
|
-
const shapeFns = require("./shapeFns-
|
|
62
|
-
const booleanFns = require("./booleanFns-
|
|
63
|
-
const topology = require("./topology-
|
|
64
|
-
const curveFns = require("./curveFns-
|
|
65
|
-
const faceFns = require("./faceFns-
|
|
66
|
-
const meshFns = require("./meshFns-
|
|
67
|
-
const measurement = require("./measurement-
|
|
68
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
61
|
+
const shapeFns = require("./shapeFns-DdBZDjVs.cjs");
|
|
62
|
+
const booleanFns = require("./booleanFns-Bv06tE2O.cjs");
|
|
63
|
+
const topology = require("./topology-In3-XjPz.cjs");
|
|
64
|
+
const curveFns = require("./curveFns-NHndvCbT.cjs");
|
|
65
|
+
const faceFns = require("./faceFns-BxkKVWoi.cjs");
|
|
66
|
+
const meshFns = require("./meshFns-Bl6gXIPd.cjs");
|
|
67
|
+
const measurement = require("./measurement-mWRWDA69.cjs");
|
|
68
|
+
const surfaceBuilders = require("./surfaceBuilders-BQScH37x.cjs");
|
|
69
69
|
const query = require("./query.cjs");
|
|
70
70
|
const result = require("./result.cjs");
|
|
71
|
-
const cornerFinder = require("./cornerFinder-
|
|
71
|
+
const cornerFinder = require("./cornerFinder-Ci8VuZvA.cjs");
|
|
72
72
|
const worker = require("./worker.cjs");
|
|
73
73
|
function supportsProjection(kernel) {
|
|
74
74
|
return "projectShape" in kernel;
|
|
@@ -659,7 +659,30 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
659
659
|
)
|
|
660
660
|
);
|
|
661
661
|
}
|
|
662
|
-
const { solid: solid2 = true, ruled = false, tolerance
|
|
662
|
+
const { solid: solid2 = true, ruled = false, tolerance = 1e-6 } = options ?? {};
|
|
663
|
+
const explicitLocations = sections.map((s) => s.location);
|
|
664
|
+
for (let i = 0; i < explicitLocations.length; i++) {
|
|
665
|
+
const loc = explicitLocations[i];
|
|
666
|
+
if (loc !== void 0 && (loc < 0 || loc > 1)) {
|
|
667
|
+
return errors.err(
|
|
668
|
+
errors.validationError(
|
|
669
|
+
errors.BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
670
|
+
`Section ${i} location ${loc} is out of range [0, 1]`
|
|
671
|
+
)
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
const definedLocs = explicitLocations.filter((l) => l !== void 0);
|
|
676
|
+
for (let i = 1; i < definedLocs.length; i++) {
|
|
677
|
+
if ((definedLocs[i] ?? 0) <= (definedLocs[i - 1] ?? 0)) {
|
|
678
|
+
return errors.err(
|
|
679
|
+
errors.validationError(
|
|
680
|
+
errors.BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
681
|
+
"Section locations must be strictly increasing"
|
|
682
|
+
)
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
663
686
|
try {
|
|
664
687
|
const kernel = shapeTypes.getKernel();
|
|
665
688
|
const [uFirst, uLast] = kernel.curveParameters(spine.wrapped);
|
|
@@ -678,7 +701,7 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
678
701
|
const positioned = kernel.positionOnCurve(section2.wire.wrapped, spine.wrapped, param);
|
|
679
702
|
positionedWires.push(kernel.downcast(positioned, "wire"));
|
|
680
703
|
}
|
|
681
|
-
const loftResult = kernel.loftAdvanced(positionedWires, { solid: solid2, ruled });
|
|
704
|
+
const loftResult = kernel.loftAdvanced(positionedWires, { solid: solid2, ruled, tolerance });
|
|
682
705
|
const result2 = shapeTypes.castShape(loftResult);
|
|
683
706
|
if (!shapeTypes.isShape3D(result2)) {
|
|
684
707
|
return errors.err(
|
|
@@ -1082,6 +1105,66 @@ function fanTriangulate(count) {
|
|
|
1082
1105
|
}
|
|
1083
1106
|
return tris;
|
|
1084
1107
|
}
|
|
1108
|
+
function cross2d(ax, ay, bx, by, cx, cy) {
|
|
1109
|
+
return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
|
|
1110
|
+
}
|
|
1111
|
+
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) {
|
|
1112
|
+
const d1 = cross2d(ax, ay, bx, by, px, py);
|
|
1113
|
+
const d2 = cross2d(bx, by, cx, cy, px, py);
|
|
1114
|
+
const d3 = cross2d(cx, cy, ax, ay, px, py);
|
|
1115
|
+
const hasNeg = d1 < 0 || d2 < 0 || d3 < 0;
|
|
1116
|
+
const hasPos = d1 > 0 || d2 > 0 || d3 > 0;
|
|
1117
|
+
return !(hasNeg && hasPos);
|
|
1118
|
+
}
|
|
1119
|
+
function earClipTriangulate(poly) {
|
|
1120
|
+
const n = poly.length;
|
|
1121
|
+
if (n < 3) return [];
|
|
1122
|
+
if (n === 3) return [[0, 1, 2]];
|
|
1123
|
+
let area2 = 0;
|
|
1124
|
+
for (let i = 0; i < n; i++) {
|
|
1125
|
+
const a = poly[i];
|
|
1126
|
+
const b = poly[(i + 1) % n];
|
|
1127
|
+
if (a && b) area2 += a.x * b.y - b.x * a.y;
|
|
1128
|
+
}
|
|
1129
|
+
const tris = [];
|
|
1130
|
+
const idx = Array.from({ length: n }, (_, i) => i);
|
|
1131
|
+
if (area2 < 0) idx.reverse();
|
|
1132
|
+
const isEar = (prev, curr, next) => {
|
|
1133
|
+
const a = poly[prev];
|
|
1134
|
+
const b = poly[curr];
|
|
1135
|
+
const c = poly[next];
|
|
1136
|
+
if (!a || !b || !c) return false;
|
|
1137
|
+
if (cross2d(a.x, a.y, b.x, b.y, c.x, c.y) <= 0) return false;
|
|
1138
|
+
for (const vi of idx) {
|
|
1139
|
+
if (vi === prev || vi === curr || vi === next) continue;
|
|
1140
|
+
const p = poly[vi];
|
|
1141
|
+
if (!p) continue;
|
|
1142
|
+
if (pointInTriangle(p.x, p.y, a.x, a.y, b.x, b.y, c.x, c.y)) return false;
|
|
1143
|
+
}
|
|
1144
|
+
return true;
|
|
1145
|
+
};
|
|
1146
|
+
while (idx.length > 3) {
|
|
1147
|
+
let clipped = false;
|
|
1148
|
+
for (let i = 0; i < idx.length; i++) {
|
|
1149
|
+
const prev = idx[(i - 1 + idx.length) % idx.length];
|
|
1150
|
+
const curr = idx[i];
|
|
1151
|
+
const next = idx[(i + 1) % idx.length];
|
|
1152
|
+
if (prev === void 0 || curr === void 0 || next === void 0) continue;
|
|
1153
|
+
if (isEar(prev, curr, next)) {
|
|
1154
|
+
tris.push([prev, curr, next]);
|
|
1155
|
+
idx.splice(i, 1);
|
|
1156
|
+
clipped = true;
|
|
1157
|
+
break;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (!clipped) break;
|
|
1161
|
+
}
|
|
1162
|
+
if (idx.length === 3) {
|
|
1163
|
+
const [a, b, c] = idx;
|
|
1164
|
+
if (a !== void 0 && b !== void 0 && c !== void 0) tris.push([a, b, c]);
|
|
1165
|
+
}
|
|
1166
|
+
return tris;
|
|
1167
|
+
}
|
|
1085
1168
|
function roof(w, options) {
|
|
1086
1169
|
const angle = (options?.angle ?? 45) * (Math.PI / 180);
|
|
1087
1170
|
const tanAngle = Math.tan(angle);
|
|
@@ -1134,19 +1217,17 @@ function roof(w, options) {
|
|
|
1134
1217
|
}
|
|
1135
1218
|
}
|
|
1136
1219
|
}
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
triFaces.push(triFace);
|
|
1149
|
-
}
|
|
1220
|
+
for (const [ai, bi, ci] of earClipTriangulate(polygon2)) {
|
|
1221
|
+
const pa = polygon2[ai];
|
|
1222
|
+
const pb = polygon2[bi];
|
|
1223
|
+
const pc = polygon2[ci];
|
|
1224
|
+
if (!pa || !pb || !pc) continue;
|
|
1225
|
+
const va = [pa.x, pa.y, 0];
|
|
1226
|
+
const vb = [pb.x, pb.y, 0];
|
|
1227
|
+
const vc = [pc.x, pc.y, 0];
|
|
1228
|
+
const triFace = kernel.buildTriFace(va, vc, vb);
|
|
1229
|
+
if (triFace !== null) {
|
|
1230
|
+
triFaces.push(triFace);
|
|
1150
1231
|
}
|
|
1151
1232
|
}
|
|
1152
1233
|
if (triFaces.length === 0) {
|
|
@@ -2266,7 +2347,7 @@ function isValid(shape2) {
|
|
|
2266
2347
|
function isEmpty(shape2) {
|
|
2267
2348
|
return shapeFns.isEmpty(resolve(shape2));
|
|
2268
2349
|
}
|
|
2269
|
-
function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance
|
|
2350
|
+
function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
2270
2351
|
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
2271
2352
|
return errors.err(errors.validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
2272
2353
|
}
|
|
@@ -2279,6 +2360,7 @@ function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance: _toleran
|
|
|
2279
2360
|
{
|
|
2280
2361
|
solid: !returnShell,
|
|
2281
2362
|
ruled,
|
|
2363
|
+
tolerance,
|
|
2282
2364
|
...startVertex ? { startVertex } : {},
|
|
2283
2365
|
...endVertex ? { endVertex } : {}
|
|
2284
2366
|
}
|
package/dist/brepjs.js
CHANGED
|
@@ -43,45 +43,45 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
43
43
|
};
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
|
-
import { c as castShape, D as DisposalScope, q as getKernel, e as isFace, k as isShell, l as isSolid, j as isShape3D, x as createSolid, r as createWire, d as isEdge, n as isWire } from "./shapeTypes-
|
|
47
|
-
import { u, s, t, a, b, B, v, g, C, i, f, h, m, E, F, w, o, p } from "./shapeTypes-
|
|
46
|
+
import { c as castShape, D as DisposalScope, q as getKernel, e as isFace, k as isShell, l as isSolid, j as isShape3D, x as createSolid, r as createWire, d as isEdge, n as isWire } from "./shapeTypes-Dh_qy0wO.js";
|
|
47
|
+
import { u, s, t, a, b, B, v, g, C, i, f, h, m, E, F, w, o, p } from "./shapeTypes-Dh_qy0wO.js";
|
|
48
48
|
import { o as ok, y as translateKernelError, e as err, p as typeCastError, q as queryError, x as validationError, B as BrepErrorCode, k as kernelError, i as ioError, d as isErr, u as unwrap } from "./errors-lBwyc8YG.js";
|
|
49
49
|
import { O, z, a as a2, c, b as b2, f as f2, A, g as g2, m as m2, h as h2, j, l, C as C2, D, E as E2, s as s2, F as F2, G, t as t2, n, r, v as v2, w as w2, H } from "./errors-lBwyc8YG.js";
|
|
50
50
|
import { c as vecDistance, D as DEG2RAD, H as HASH_CODE_MAX, n as vecScale, j as vecNormalize, f as vecIsZero } from "./vecOps-ZDdZWbwT.js";
|
|
51
51
|
import { R, v as v3, a as a3, b as b3, d, e, g as g3, h as h3, i as i2, k, l as l2, m as m3, o as o2 } from "./vecOps-ZDdZWbwT.js";
|
|
52
|
-
import { B as B2, d as d2, C as C3, s as s3 } from "./Blueprint-
|
|
53
|
-
import { m as makeCompound, d as makeCone, e as makeCylinder, f as makeEllipsoid, h as makeOffset, w as weldShellsAndFaces, a as makeSolid, i as makeSphere, j as makeTorus, k as makeVertex } from "./loft-
|
|
54
|
-
import { b as b4, g as g4, r as r2 } from "./loft-
|
|
55
|
-
import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-
|
|
56
|
-
import { a as a4, b as b5, d as d3, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n2, o as o3, p as p2, q, t as t3, u as u2, v as v4, x, y, z as z2, A as A2, B as B3, C as C4, D as D2, E as E3, F as F3, G as G2 } from "./operations-
|
|
57
|
-
import { B as B4, a as a5, e as e2, C as C5, F as F4, S, f as f4, l as l3, g as g6, n as n3, k as k3, q as q2, o as o4, p as p3, r as r3 } from "./boolean2D-
|
|
52
|
+
import { B as B2, d as d2, C as C3, s as s3 } from "./Blueprint-Bx9F-b3M.js";
|
|
53
|
+
import { m as makeCompound, d as makeCone, e as makeCylinder, f as makeEllipsoid, h as makeOffset, w as weldShellsAndFaces, a as makeSolid, i as makeSphere, j as makeTorus, k as makeVertex } from "./loft-C8yS_NS6.js";
|
|
54
|
+
import { b as b4, g as g4, r as r2 } from "./loft-C8yS_NS6.js";
|
|
55
|
+
import { w as walkAssembly, e as extrude$1, r as revolve$1, s as sweep, c as circularPattern, l as linearPattern } from "./operations-6JJEKei9.js";
|
|
56
|
+
import { a as a4, b as b5, d as d3, f as f3, g as g5, h as h4, i as i3, j as j2, k as k2, m as m4, n as n2, o as o3, p as p2, q, t as t3, u as u2, v as v4, x, y, z as z2, A as A2, B as B3, C as C4, D as D2, E as E3, F as F3, G as G2 } from "./operations-6JJEKei9.js";
|
|
57
|
+
import { B as B4, a as a5, e as e2, C as C5, F as F4, S, f as f4, l as l3, g as g6, n as n3, k as k3, q as q2, o as o4, p as p3, r as r3 } from "./boolean2D-iR7ADbYD.js";
|
|
58
58
|
import { createBlueprint, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, getBounds2D, getOrientation2D, isInside2D, mirror2D, reverseCurve, rotate2D, scale2D, sketch2DOnFace, sketch2DOnPlane, stretch2D, toSVGPathD, translate2D } from "./2d.js";
|
|
59
|
-
import { l as createTypedFinder, m as faceFinder } from "./helpers-
|
|
60
|
-
import { g as g7 } from "./helpers-
|
|
59
|
+
import { l as createTypedFinder, m as faceFinder } from "./helpers-nNbxhw97.js";
|
|
60
|
+
import { g as g7 } from "./helpers-nNbxhw97.js";
|
|
61
61
|
import { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportOBJ, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD } from "./io.js";
|
|
62
|
-
import { C as C6, D as D3, a as a6, S as S2, b as b6, X, Y, c as c2, d as d4, e as e3, f as f5, Z, g as g8, h as h5, i as i4, j as j3, k as k4, l as l4, m as m5, n as n4, o as o5, p as p4, q as q3, r as r4, s as s4, t as t4, u as u3, v as v5, w as w3, x as x2, y as y2, z as z3, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E4, a3 as a32, F as F5, G as G3, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-
|
|
62
|
+
import { C as C6, D as D3, a as a6, S as S2, b as b6, X, Y, c as c2, d as d4, e as e3, f as f5, Z, g as g8, h as h5, i as i4, j as j3, k as k4, l as l4, m as m5, n as n4, o as o5, p as p4, q as q3, r as r4, s as s4, t as t4, u as u3, v as v5, w as w3, x as x2, y as y2, z as z3, _, $, a0, a1, A as A3, a2 as a22, B as B5, E as E4, a3 as a32, F as F5, G as G3, H as H2, I, J, K, L, M, N, O as O2, P, Q, R as R2, T, U, a4 as a42, V, a5 as a52, a6 as a62, W } from "./drawFns-D1j4FnWp.js";
|
|
63
63
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
64
64
|
import { r as r5, t as t5 } from "./types-CWDdqcrq.js";
|
|
65
65
|
import { c as c3, a as a7, p as p5, r as r6, t as t6 } from "./vectors-B8RRTytu.js";
|
|
66
|
-
import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, t as translate$1, p as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, q as toBREP$1, u as transformCopy$1, c as getWires } from "./shapeFns-
|
|
67
|
-
import { w as w4, f as f6, x as x3, i as i5, y as y3, z as z4, A as A4, B as B6, C as C7, D as D4 } from "./shapeFns-
|
|
68
|
-
import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-
|
|
69
|
-
import { l as l5, m as m6, n as n5, o as o6, q as q4, r as r7, t as t7, u as u4, v as v6 } from "./booleanFns-
|
|
70
|
-
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-
|
|
71
|
-
import { a as a8, b as b7, e as e4, f as f7, d as d5, g as g9, j as j4, s as s5, t as t8, k as k5, l as l6, v as v7, w as w5 } from "./topology-
|
|
72
|
-
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-
|
|
73
|
-
import { j as j5, k as k6, l as l7, f as f8, b as b8, g as g10, m as m7, o as o7 } from "./curveFns-
|
|
74
|
-
import { i as iterTopo, e as faceCenter, n as normalAt, j as fromBREP$1, k as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-
|
|
75
|
-
import { l as l8, c as c4, m as m8, d as d6, f as f9, q as q5, r as r8, s as s6, p as p6, t as t9, v as v8, u as u5, h as h6 } from "./faceFns-
|
|
76
|
-
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-
|
|
77
|
-
import { c as c5, b as b9, e as e5, d as d7, f as f10 } from "./meshFns-
|
|
78
|
-
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-
|
|
79
|
-
import { d as d8, e as e6, f as f11, g as g11, h as h7, i as i6 } from "./measurement-
|
|
80
|
-
import { h as addHolesInFace, g as makeBezierCurve, k as makeBSplineApproximation, i as makeCircle, j as makeEllipse, f as makeEllipseArc, m as makeFace, n as makeNonPlanarFace, c as makeHelix, a as makeLine, o as makePolygon, l as makeNewFaceWithinFace, e as makeTangentArc, d as makeThreePointArc, b as assembleWire } from "./surfaceBuilders-
|
|
81
|
-
import { p as p7 } from "./surfaceBuilders-
|
|
66
|
+
import { v as vertexPosition, a as getFaces, e as getVertices, d as getEdges, h as getBounds, t as translate$1, p as propagateOriginsFromEvolution, g as getFaceOrigins, j as applyMatrix$1, k as clone$1, l as describe$1, m as isEmpty$1, n as mirror$1, r as rotate$1, s as scale$1, o as simplify$1, q as toBREP$1, u as transformCopy$1, c as getWires } from "./shapeFns-BO9NK6Oo.js";
|
|
67
|
+
import { w as w4, f as f6, x as x3, i as i5, y as y3, z as z4, A as A4, B as B6, C as C7, D as D4 } from "./shapeFns-BO9NK6Oo.js";
|
|
68
|
+
import { p as propagateFaceTagsFromEvolution, a as propagateColorsFromEvolution, h as hasFaceTags, b as hasColorMetadata, c as cut$1, f as fuse$1, i as intersect$1, s as section$1, d as sectionToFace$1, e as slice$1, g as split$1, j as fuseAll, k as cutAll } from "./booleanFns-7rIed0u7.js";
|
|
69
|
+
import { l as l5, m as m6, n as n5, o as o6, q as q4, r as r7, t as t7, u as u4, v as v6 } from "./booleanFns-7rIed0u7.js";
|
|
70
|
+
import { c as chamferDistAngle, h as heal$1, i as isValid$1 } from "./topology-JKo9WLos.js";
|
|
71
|
+
import { a as a8, b as b7, e as e4, f as f7, d as d5, g as g9, j as j4, s as s5, t as t8, k as k5, l as l6, v as v7, w as w5 } from "./topology-JKo9WLos.js";
|
|
72
|
+
import { e as curveIsClosed, d as curveStartPoint, c as curveTangentAt, h as curvePointAt, a as curveEndPoint, i as curveLength } from "./curveFns-DimdPJLf.js";
|
|
73
|
+
import { j as j5, k as k6, l as l7, f as f8, b as b8, g as g10, m as m7, o as o7 } from "./curveFns-DimdPJLf.js";
|
|
74
|
+
import { i as iterTopo, e as faceCenter, n as normalAt, j as fromBREP$1, k as innerWires, o as outerWire, g as getSurfaceType } from "./faceFns-BkJ2_drH.js";
|
|
75
|
+
import { l as l8, c as c4, m as m8, d as d6, f as f9, q as q5, r as r8, s as s6, p as p6, t as t9, v as v8, u as u5, h as h6 } from "./faceFns-BkJ2_drH.js";
|
|
76
|
+
import { m as mesh$1, a as meshEdges$1 } from "./meshFns-D2eLJfd6.js";
|
|
77
|
+
import { c as c5, b as b9, e as e5, d as d7, f as f10 } from "./meshFns-D2eLJfd6.js";
|
|
78
|
+
import { m as measureArea, a as measureSurfaceProps, b as measureVolumeProps, c as measureVolume } from "./measurement-4z0i9NjE.js";
|
|
79
|
+
import { d as d8, e as e6, f as f11, g as g11, h as h7, i as i6 } from "./measurement-4z0i9NjE.js";
|
|
80
|
+
import { h as addHolesInFace, g as makeBezierCurve, k as makeBSplineApproximation, i as makeCircle, j as makeEllipse, f as makeEllipseArc, m as makeFace, n as makeNonPlanarFace, c as makeHelix, a as makeLine, o as makePolygon, l as makeNewFaceWithinFace, e as makeTangentArc, d as makeThreePointArc, b as assembleWire } from "./surfaceBuilders-CX69g8_x.js";
|
|
81
|
+
import { p as p7 } from "./surfaceBuilders-CX69g8_x.js";
|
|
82
82
|
import { edgeFinder } from "./query.js";
|
|
83
83
|
import { BrepBugError, bug } from "./result.js";
|
|
84
|
-
import { c as c6 } from "./cornerFinder-
|
|
84
|
+
import { c as c6 } from "./cornerFinder-HW6Pd4KN.js";
|
|
85
85
|
import { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll } from "./worker.js";
|
|
86
86
|
function supportsProjection(kernel) {
|
|
87
87
|
return "projectShape" in kernel;
|
|
@@ -672,7 +672,30 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
672
672
|
)
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
|
-
const { solid: solid2 = true, ruled = false, tolerance
|
|
675
|
+
const { solid: solid2 = true, ruled = false, tolerance = 1e-6 } = options ?? {};
|
|
676
|
+
const explicitLocations = sections.map((s7) => s7.location);
|
|
677
|
+
for (let i7 = 0; i7 < explicitLocations.length; i7++) {
|
|
678
|
+
const loc = explicitLocations[i7];
|
|
679
|
+
if (loc !== void 0 && (loc < 0 || loc > 1)) {
|
|
680
|
+
return err(
|
|
681
|
+
validationError(
|
|
682
|
+
BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
683
|
+
`Section ${i7} location ${loc} is out of range [0, 1]`
|
|
684
|
+
)
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
const definedLocs = explicitLocations.filter((l9) => l9 !== void 0);
|
|
689
|
+
for (let i7 = 1; i7 < definedLocs.length; i7++) {
|
|
690
|
+
if ((definedLocs[i7] ?? 0) <= (definedLocs[i7 - 1] ?? 0)) {
|
|
691
|
+
return err(
|
|
692
|
+
validationError(
|
|
693
|
+
BrepErrorCode.MULTI_SWEEP_FAILED,
|
|
694
|
+
"Section locations must be strictly increasing"
|
|
695
|
+
)
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
676
699
|
try {
|
|
677
700
|
const kernel = getKernel();
|
|
678
701
|
const [uFirst, uLast] = kernel.curveParameters(spine.wrapped);
|
|
@@ -691,7 +714,7 @@ function multiSectionSweep(sections, spine, options) {
|
|
|
691
714
|
const positioned = kernel.positionOnCurve(section2.wire.wrapped, spine.wrapped, param);
|
|
692
715
|
positionedWires.push(kernel.downcast(positioned, "wire"));
|
|
693
716
|
}
|
|
694
|
-
const loftResult = kernel.loftAdvanced(positionedWires, { solid: solid2, ruled });
|
|
717
|
+
const loftResult = kernel.loftAdvanced(positionedWires, { solid: solid2, ruled, tolerance });
|
|
695
718
|
const result = castShape(loftResult);
|
|
696
719
|
if (!isShape3D(result)) {
|
|
697
720
|
return err(
|
|
@@ -1095,6 +1118,66 @@ function fanTriangulate(count) {
|
|
|
1095
1118
|
}
|
|
1096
1119
|
return tris;
|
|
1097
1120
|
}
|
|
1121
|
+
function cross2d(ax, ay, bx, by, cx, cy) {
|
|
1122
|
+
return (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
|
|
1123
|
+
}
|
|
1124
|
+
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) {
|
|
1125
|
+
const d1 = cross2d(ax, ay, bx, by, px, py);
|
|
1126
|
+
const d22 = cross2d(bx, by, cx, cy, px, py);
|
|
1127
|
+
const d32 = cross2d(cx, cy, ax, ay, px, py);
|
|
1128
|
+
const hasNeg = d1 < 0 || d22 < 0 || d32 < 0;
|
|
1129
|
+
const hasPos = d1 > 0 || d22 > 0 || d32 > 0;
|
|
1130
|
+
return !(hasNeg && hasPos);
|
|
1131
|
+
}
|
|
1132
|
+
function earClipTriangulate(poly) {
|
|
1133
|
+
const n6 = poly.length;
|
|
1134
|
+
if (n6 < 3) return [];
|
|
1135
|
+
if (n6 === 3) return [[0, 1, 2]];
|
|
1136
|
+
let area2 = 0;
|
|
1137
|
+
for (let i7 = 0; i7 < n6; i7++) {
|
|
1138
|
+
const a9 = poly[i7];
|
|
1139
|
+
const b10 = poly[(i7 + 1) % n6];
|
|
1140
|
+
if (a9 && b10) area2 += a9.x * b10.y - b10.x * a9.y;
|
|
1141
|
+
}
|
|
1142
|
+
const tris = [];
|
|
1143
|
+
const idx = Array.from({ length: n6 }, (_2, i7) => i7);
|
|
1144
|
+
if (area2 < 0) idx.reverse();
|
|
1145
|
+
const isEar = (prev, curr, next) => {
|
|
1146
|
+
const a9 = poly[prev];
|
|
1147
|
+
const b10 = poly[curr];
|
|
1148
|
+
const c7 = poly[next];
|
|
1149
|
+
if (!a9 || !b10 || !c7) return false;
|
|
1150
|
+
if (cross2d(a9.x, a9.y, b10.x, b10.y, c7.x, c7.y) <= 0) return false;
|
|
1151
|
+
for (const vi of idx) {
|
|
1152
|
+
if (vi === prev || vi === curr || vi === next) continue;
|
|
1153
|
+
const p8 = poly[vi];
|
|
1154
|
+
if (!p8) continue;
|
|
1155
|
+
if (pointInTriangle(p8.x, p8.y, a9.x, a9.y, b10.x, b10.y, c7.x, c7.y)) return false;
|
|
1156
|
+
}
|
|
1157
|
+
return true;
|
|
1158
|
+
};
|
|
1159
|
+
while (idx.length > 3) {
|
|
1160
|
+
let clipped = false;
|
|
1161
|
+
for (let i7 = 0; i7 < idx.length; i7++) {
|
|
1162
|
+
const prev = idx[(i7 - 1 + idx.length) % idx.length];
|
|
1163
|
+
const curr = idx[i7];
|
|
1164
|
+
const next = idx[(i7 + 1) % idx.length];
|
|
1165
|
+
if (prev === void 0 || curr === void 0 || next === void 0) continue;
|
|
1166
|
+
if (isEar(prev, curr, next)) {
|
|
1167
|
+
tris.push([prev, curr, next]);
|
|
1168
|
+
idx.splice(i7, 1);
|
|
1169
|
+
clipped = true;
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
if (!clipped) break;
|
|
1174
|
+
}
|
|
1175
|
+
if (idx.length === 3) {
|
|
1176
|
+
const [a9, b10, c7] = idx;
|
|
1177
|
+
if (a9 !== void 0 && b10 !== void 0 && c7 !== void 0) tris.push([a9, b10, c7]);
|
|
1178
|
+
}
|
|
1179
|
+
return tris;
|
|
1180
|
+
}
|
|
1098
1181
|
function roof(w6, options) {
|
|
1099
1182
|
const angle = (options?.angle ?? 45) * (Math.PI / 180);
|
|
1100
1183
|
const tanAngle = Math.tan(angle);
|
|
@@ -1147,19 +1230,17 @@ function roof(w6, options) {
|
|
|
1147
1230
|
}
|
|
1148
1231
|
}
|
|
1149
1232
|
}
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
triFaces.push(triFace);
|
|
1162
|
-
}
|
|
1233
|
+
for (const [ai, bi, ci] of earClipTriangulate(polygon2)) {
|
|
1234
|
+
const pa = polygon2[ai];
|
|
1235
|
+
const pb = polygon2[bi];
|
|
1236
|
+
const pc = polygon2[ci];
|
|
1237
|
+
if (!pa || !pb || !pc) continue;
|
|
1238
|
+
const va = [pa.x, pa.y, 0];
|
|
1239
|
+
const vb = [pb.x, pb.y, 0];
|
|
1240
|
+
const vc = [pc.x, pc.y, 0];
|
|
1241
|
+
const triFace = kernel.buildTriFace(va, vc, vb);
|
|
1242
|
+
if (triFace !== null) {
|
|
1243
|
+
triFaces.push(triFace);
|
|
1163
1244
|
}
|
|
1164
1245
|
}
|
|
1165
1246
|
if (triFaces.length === 0) {
|
|
@@ -2279,7 +2360,7 @@ function isValid(shape2) {
|
|
|
2279
2360
|
function isEmpty(shape2) {
|
|
2280
2361
|
return isEmpty$1(resolve(shape2));
|
|
2281
2362
|
}
|
|
2282
|
-
function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance
|
|
2363
|
+
function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance = 1e-6 } = {}, returnShell = false) {
|
|
2283
2364
|
if (wires.length === 0 && !startPoint && !endPoint) {
|
|
2284
2365
|
return err(validationError("LOFT_EMPTY", "Loft requires at least one wire or start/end point"));
|
|
2285
2366
|
}
|
|
@@ -2292,6 +2373,7 @@ function loft$1(wires, { ruled = true, startPoint, endPoint, tolerance: _toleran
|
|
|
2292
2373
|
{
|
|
2293
2374
|
solid: !returnShell,
|
|
2294
2375
|
ruled,
|
|
2376
|
+
tolerance,
|
|
2295
2377
|
...startVertex ? { startVertex } : {},
|
|
2296
2378
|
...endVertex ? { endVertex } : {}
|
|
2297
2379
|
}
|
package/dist/core.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const types = require("./types-CA_xrgDq.cjs");
|
|
|
4
4
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
5
5
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
6
6
|
const vectors = require("./vectors-DqQXtR8s.cjs");
|
|
7
|
-
const shapeTypes = require("./shapeTypes-
|
|
7
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
8
8
|
const result = require("./result.cjs");
|
|
9
9
|
exports.resolveDirection = types.resolveDirection;
|
|
10
10
|
exports.toVec2 = types.toVec2;
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r, t, a } from "./types-CWDdqcrq.js";
|
|
|
2
2
|
import { D, H, R, v, a as a2, b, c, d, e, f, g, h, i, j, k, l, m, n, o } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
import { O, a as a3, c as c2, b as b2, e as e2, f as f2, i as i2, d as d2, g as g2, k as k2, m as m2, h as h2, j as j2, l as l2, o as o2, q, s, t as t2, n as n2, p, u, r as r2, v as v2, w, x } from "./errors-lBwyc8YG.js";
|
|
4
4
|
import { c as c3, a as a4, p as p2, r as r3, t as t3 } from "./vectors-B8RRTytu.js";
|
|
5
|
-
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, w as w2, o as o3, p as p3 } from "./shapeTypes-
|
|
5
|
+
import { D as D2, c as c4, a as a5, b as b3, g as g3, i as i3, d as d3, e as e3, f as f3, h as h3, j as j3, k as k3, l as l3, m as m3, n as n3, w as w2, o as o3, p as p3 } from "./shapeTypes-Dh_qy0wO.js";
|
|
6
6
|
import { BrepBugError, bug } from "./result.js";
|
|
7
7
|
export {
|
|
8
8
|
BrepBugError,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-
|
|
1
|
+
import { a as angle2d, s as samePoint, d as distance2d } from "./helpers-nNbxhw97.js";
|
|
2
2
|
import { D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
|
|
3
3
|
const PI_2 = 2 * Math.PI;
|
|
4
4
|
function positiveHalfAngle(angle) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as getKernel, c as castShape, d as isEdge, n as isWire } from "./shapeTypes-
|
|
1
|
+
import { q as getKernel, c as castShape, d as isEdge, n as isWire } from "./shapeTypes-Dh_qy0wO.js";
|
|
2
2
|
import { e as err, p as typeCastError, o as ok } from "./errors-lBwyc8YG.js";
|
|
3
3
|
function getCurveType(shape) {
|
|
4
4
|
return getKernel().curveType(shape.wrapped);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const shapeTypes = require("./shapeTypes-
|
|
2
|
+
const shapeTypes = require("./shapeTypes-DGDFzV7k.cjs");
|
|
3
3
|
const errors = require("./errors-DiTn5EoC.cjs");
|
|
4
4
|
function getCurveType(shape) {
|
|
5
5
|
return shapeTypes.getKernel().curveType(shape.wrapped);
|