brepjs 12.2.12 → 12.3.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-BWAzjtvF.js → Blueprint-BBLKmtl9.js} +5 -5
- package/dist/{Blueprint-CX2oh-NE.cjs → Blueprint-Bh6166KA.cjs} +5 -5
- package/dist/{boolean2D-G9edb4Pw.cjs → boolean2D-Bl4iyJfa.cjs} +7 -7
- package/dist/{boolean2D-B17ZPZ63.js → boolean2D-D2s-G0Wm.js} +7 -7
- package/dist/{booleanFns-EsNGs4Zu.js → booleanFns-CKWVFBtF.js} +3 -3
- package/dist/{booleanFns-DQj7i7qb.cjs → booleanFns-DdbAk1KC.cjs} +3 -3
- package/dist/brepjs.cjs +142 -35
- package/dist/brepjs.js +182 -75
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-57qxNypG.js → cornerFinder-C-o3TN3q.js} +1 -1
- package/dist/{cornerFinder-NbeO5KWC.cjs → cornerFinder-zd2oBgyp.cjs} +1 -1
- package/dist/{curveFns-DRb_8jyd.js → curveFns-DyVPTb1r.js} +1 -1
- package/dist/{curveFns-BN9bWCIl.cjs → curveFns-p0x8jy0i.cjs} +1 -1
- package/dist/{drawFns-Br57GZWI.cjs → drawFns-DXwZzno9.cjs} +11 -11
- package/dist/{drawFns-DWTCgzlb.js → drawFns-DpAQM_F6.js} +11 -11
- package/dist/{faceFns-Dka8xvYk.js → faceFns-CvR-ZEQA.js} +6 -2
- package/dist/{faceFns-Cfvj4nxx.cjs → faceFns-SVADeb01.cjs} +5 -1
- package/dist/{helpers-Cu_7Qo9J.cjs → helpers-3fsqd4mW.cjs} +4 -4
- package/dist/{helpers-10HaneKK.js → helpers-F_D1WON3.js} +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/io.cjs +3 -3
- package/dist/io.js +3 -3
- package/dist/kernel/advancedOps.d.ts +2 -0
- package/dist/kernel/advancedOps.d.ts.map +1 -1
- package/dist/kernel/brepkitAdapter.d.ts +29 -0
- package/dist/kernel/brepkitAdapter.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/index.d.ts +2 -2
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/types.d.ts +17 -0
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/{loft-BDnb8toT.cjs → loft-98s9uwpg.cjs} +4 -4
- package/dist/{loft-DTFP5fVL.js → loft-BvZFfPqO.js} +4 -4
- package/dist/{measurement-ypLLNq5y.cjs → measurement-g8ldN7oe.cjs} +2 -2
- package/dist/{measurement-9v764TRE.js → measurement-vbHd9lpV.js} +2 -2
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-xWim4bEU.cjs → meshFns-CF-JdX5P.cjs} +2 -2
- package/dist/{meshFns-B1FRGCo4.js → meshFns-RN83Wiry.js} +2 -2
- package/dist/{operations-CLaaoj2N.cjs → operations-CrLZ6fyL.cjs} +5 -5
- package/dist/{operations-C0597E2p.js → operations-CxvdnWzU.js} +5 -5
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/query.cjs +4 -4
- package/dist/query.js +5 -5
- package/dist/{shapeFns-Dim8UTHh.js → shapeFns-38GljA_p.js} +2 -2
- package/dist/{shapeFns-ZbzAD8yC.cjs → shapeFns-BoN5g5Bx.cjs} +2 -2
- package/dist/{shapeTypes-ByN4-0Hp.js → shapeTypes-5DPsHB8i.js} +21 -0
- package/dist/{shapeTypes-BQGbhdgi.cjs → shapeTypes-DTGA0liC.cjs} +21 -0
- package/dist/sketching.cjs +2 -2
- package/dist/sketching.js +2 -2
- package/dist/{solidBuilders-Bc6kgqJ9.js → solidBuilders-BWkneWjU.js} +2 -2
- package/dist/{solidBuilders-CYEEZgiP.cjs → solidBuilders-CUc2rvWv.cjs} +2 -2
- package/dist/{surfaceBuilders-Bdn7iqv5.js → surfaceBuilders-CXbEDGBQ.js} +2 -2
- package/dist/{surfaceBuilders-CXarnCh8.cjs → surfaceBuilders-tYoe8sri.cjs} +2 -2
- package/dist/topology/faceFns.d.ts +5 -0
- package/dist/topology/faceFns.d.ts.map +1 -1
- package/dist/{topology-Cq1j_bp1.js → topology-Bq7mZh3W.js} +8 -8
- package/dist/{topology-CPYjaISY.cjs → topology-CH4LBfQg.cjs} +8 -8
- package/dist/topology.cjs +6 -6
- package/dist/topology.js +7 -7
- package/package.json +1 -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-Bh6166KA.cjs");
|
|
4
|
+
const boolean2D = require("./boolean2D-Bl4iyJfa.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-BBLKmtl9.js";
|
|
2
|
+
import { d, C } from "./Blueprint-BBLKmtl9.js";
|
|
3
|
+
import { e, C as C2, f, l, g, n, k, q, o, p, r } from "./boolean2D-D2s-G0Wm.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-cec8p8NQ.js";
|
|
2
2
|
import { a as toVec3 } from "./types-CWDdqcrq.js";
|
|
3
|
-
import { B as getKernel, J as getKernel2D, K as registerForCleanup, L as unregisterFromCleanup, H as createEdge, G 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 { B as getKernel, J as getKernel2D, K as registerForCleanup, L as unregisterFromCleanup, H as createEdge, G as createWire } from "./shapeTypes-5DPsHB8i.js";
|
|
4
|
+
import { u as uvBounds, f as faceGeomType, e as faceCenter, h as uvCoordinates, c as cast } from "./faceFns-CvR-ZEQA.js";
|
|
5
|
+
import { g as getOrientation } from "./curveFns-DyVPTb1r.js";
|
|
6
6
|
import { o as ok, e as err, b as computationError, r as unwrap, y as validationError } from "./errors-B7kgv0cd.js";
|
|
7
|
-
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, e as subtract2d, g as getSingleFace } from "./helpers-
|
|
7
|
+
import { d as distance2d, s as samePoint, b as scalarMultiply2d, c as add2d, e as subtract2d, g as getSingleFace } from "./helpers-F_D1WON3.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-CXbEDGBQ.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-TlfO1hu2.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-DTGA0liC.cjs");
|
|
5
|
+
const faceFns = require("./faceFns-SVADeb01.cjs");
|
|
6
|
+
const curveFns = require("./curveFns-p0x8jy0i.cjs");
|
|
7
7
|
const errors = require("./errors-9fDehDNc.cjs");
|
|
8
|
-
const helpers = require("./helpers-
|
|
8
|
+
const helpers = require("./helpers-3fsqd4mW.cjs");
|
|
9
9
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
10
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
10
|
+
const surfaceBuilders = require("./surfaceBuilders-tYoe8sri.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-TlfO1hu2.cjs");
|
|
48
48
|
const errors = require("./errors-9fDehDNc.cjs");
|
|
49
|
-
const faceFns = require("./faceFns-
|
|
49
|
+
const faceFns = require("./faceFns-SVADeb01.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-98s9uwpg.cjs");
|
|
53
|
+
const shapeTypes = require("./shapeTypes-DTGA0liC.cjs");
|
|
54
|
+
const curveFns = require("./curveFns-p0x8jy0i.cjs");
|
|
55
|
+
const surfaceBuilders = require("./surfaceBuilders-tYoe8sri.cjs");
|
|
56
56
|
const result = require("./result.cjs");
|
|
57
|
-
const helpers = require("./helpers-
|
|
58
|
-
const Blueprint = require("./Blueprint-
|
|
57
|
+
const helpers = require("./helpers-3fsqd4mW.cjs");
|
|
58
|
+
const Blueprint = require("./Blueprint-Bh6166KA.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-cec8p8NQ.js";
|
|
47
47
|
import { o as ok, e as err, b as computationError, r as unwrap, g as isOk } from "./errors-B7kgv0cd.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-CvR-ZEQA.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 { J as getKernel2D, I as createFace, G as createWire, B as getKernel, H 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-BvZFfPqO.js";
|
|
52
|
+
import { J as getKernel2D, I as createFace, G as createWire, B as getKernel, H as createEdge, D as DisposalScope } from "./shapeTypes-5DPsHB8i.js";
|
|
53
|
+
import { d as curveStartPoint, c as curveTangentAt, e as curveIsClosed } from "./curveFns-DyVPTb1r.js";
|
|
54
|
+
import { m as makeFace, l as makeNewFaceWithinFace, b as assembleWire, z as zip } from "./surfaceBuilders-CXbEDGBQ.js";
|
|
55
55
|
import { bug } from "./result.js";
|
|
56
|
-
import { s as samePoint$1, 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, n as normalize2d, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, o as asSVG, B as Blueprint, p as make2dEllipseArc, q as make2dTangentArc, r as make2dBezierCurve, s as removeDuplicatePoints } from "./Blueprint-
|
|
56
|
+
import { s as samePoint$1, 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-F_D1WON3.js";
|
|
57
|
+
import { C as Curve2D, a as make2dSegmentCurve, j as approximateAsBSpline, n as normalize2d, b as make2dArcFromCenter, k as isPoint2D, g as make2dCircle, l as make2dThreePointArc, d as BoundingBox2d, v as viewbox, o as asSVG, B as Blueprint, p as make2dEllipseArc, q as make2dTangentArc, r as make2dBezierCurve, s as removeDuplicatePoints } from "./Blueprint-BBLKmtl9.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 { B as getKernel, c as castShape, p as isShape3D } from "./shapeTypes-
|
|
1
|
+
import { B as getKernel, c as castShape, p as isShape3D } from "./shapeTypes-5DPsHB8i.js";
|
|
2
2
|
import { o as ok, d as isErr, e as err, y as validationError, B as BrepErrorCode, p as typeCastError, k as kernelError } from "./errors-B7kgv0cd.js";
|
|
3
3
|
import { r as resolvePlane } from "./vectors-cec8p8NQ.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 propagateOriginsByHash, b as propagateOriginsFromEvolution, c as getWires, d as getEdges, e as getVertices, g as getFaceOrigins } from "./shapeFns-
|
|
6
|
-
import { m as makeFace } from "./surfaceBuilders-
|
|
5
|
+
import { a as getFaces, p as propagateOriginsByHash, b as propagateOriginsFromEvolution, c as getWires, d as getEdges, e as getVertices, g as getFaceOrigins } from "./shapeFns-38GljA_p.js";
|
|
6
|
+
import { m as makeFace } from "./surfaceBuilders-CXbEDGBQ.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-DTGA0liC.cjs");
|
|
3
3
|
const errors = require("./errors-9fDehDNc.cjs");
|
|
4
4
|
const vectors = require("./vectors-TlfO1hu2.cjs");
|
|
5
5
|
const vecOps = require("./vecOps-CjRL1jau.cjs");
|
|
6
|
-
const shapeFns = require("./shapeFns-
|
|
7
|
-
const surfaceBuilders = require("./surfaceBuilders-
|
|
6
|
+
const shapeFns = require("./shapeFns-BoN5g5Bx.cjs");
|
|
7
|
+
const surfaceBuilders = require("./surfaceBuilders-tYoe8sri.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,35 +45,38 @@ 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-DTGA0liC.cjs");
|
|
49
49
|
const errors = require("./errors-9fDehDNc.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-Bh6166KA.cjs");
|
|
52
|
+
const loft$2 = require("./loft-98s9uwpg.cjs");
|
|
53
|
+
const operations = require("./operations-CrLZ6fyL.cjs");
|
|
54
|
+
const boolean2D = require("./boolean2D-Bl4iyJfa.cjs");
|
|
55
55
|
const _2d = require("./2d.cjs");
|
|
56
|
-
const helpers = require("./helpers-
|
|
56
|
+
const helpers = require("./helpers-3fsqd4mW.cjs");
|
|
57
57
|
const io = require("./io.cjs");
|
|
58
|
-
const drawFns = require("./drawFns-
|
|
58
|
+
const drawFns = require("./drawFns-DXwZzno9.cjs");
|
|
59
59
|
const types = require("./types-CA_xrgDq.cjs");
|
|
60
60
|
const vectors = require("./vectors-TlfO1hu2.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-BoN5g5Bx.cjs");
|
|
62
|
+
const booleanFns = require("./booleanFns-DdbAk1KC.cjs");
|
|
63
|
+
const topology = require("./topology-CH4LBfQg.cjs");
|
|
64
|
+
const curveFns = require("./curveFns-p0x8jy0i.cjs");
|
|
65
|
+
const faceFns = require("./faceFns-SVADeb01.cjs");
|
|
66
|
+
const meshFns = require("./meshFns-CF-JdX5P.cjs");
|
|
67
|
+
const measurement = require("./measurement-g8ldN7oe.cjs");
|
|
68
|
+
const surfaceBuilders = require("./surfaceBuilders-tYoe8sri.cjs");
|
|
69
69
|
const query = require("./query.cjs");
|
|
70
|
-
const solidBuilders = require("./solidBuilders-
|
|
70
|
+
const solidBuilders = require("./solidBuilders-CUc2rvWv.cjs");
|
|
71
71
|
const result = require("./result.cjs");
|
|
72
|
-
const cornerFinder = require("./cornerFinder-
|
|
72
|
+
const cornerFinder = require("./cornerFinder-zd2oBgyp.cjs");
|
|
73
73
|
const worker = require("./worker.cjs");
|
|
74
74
|
function supportsProjection(kernel) {
|
|
75
75
|
return "projectShape" in kernel;
|
|
76
76
|
}
|
|
77
|
+
function supportsConstraintSketch(kernel) {
|
|
78
|
+
return "sketchNew" in kernel && "sketchDof" in kernel;
|
|
79
|
+
}
|
|
77
80
|
function evaluateCurve2d(c, t) {
|
|
78
81
|
switch (c.__bk2d) {
|
|
79
82
|
case "line":
|
|
@@ -2037,7 +2040,7 @@ class BrepkitAdapter {
|
|
|
2037
2040
|
const deflection = options.tolerance || DEFAULT_DEFLECTION;
|
|
2038
2041
|
let result2;
|
|
2039
2042
|
if (bkHandle.type === "solid") {
|
|
2040
|
-
result2 = this.meshSolid(h, deflection);
|
|
2043
|
+
result2 = this.meshSolid(h, deflection, !!options.includeUVs);
|
|
2041
2044
|
} else if (bkHandle.type === "face") {
|
|
2042
2045
|
result2 = this.meshSingleFace(h, deflection, 0);
|
|
2043
2046
|
} else {
|
|
@@ -2988,8 +2991,10 @@ class BrepkitAdapter {
|
|
|
2988
2991
|
const id = this.bk.addHolesToFace(unwrap(face, "face"), wireIds);
|
|
2989
2992
|
return faceHandle(id);
|
|
2990
2993
|
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2994
|
+
removeHolesFromFace(face) {
|
|
2995
|
+
const id = this.bk.removeHolesFromFace(unwrap(face, "face"));
|
|
2996
|
+
return faceHandle(id);
|
|
2997
|
+
}
|
|
2993
2998
|
makeFaceOnSurface(_surface, wire) {
|
|
2994
2999
|
return this.makeFace(wire, true);
|
|
2995
3000
|
}
|
|
@@ -3250,9 +3255,25 @@ class BrepkitAdapter {
|
|
|
3250
3255
|
// ═══════════════════════════════════════════════════════════════════════
|
|
3251
3256
|
// Dispose
|
|
3252
3257
|
// ═══════════════════════════════════════════════════════════════════════
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3258
|
+
/**
|
|
3259
|
+
* Create an arena checkpoint. Returns checkpoint index.
|
|
3260
|
+
* Use {@link restoreCheckpoint} to roll back or {@link discardCheckpoint} to keep.
|
|
3261
|
+
*/
|
|
3262
|
+
checkpoint() {
|
|
3263
|
+
return this.bk.checkpoint();
|
|
3264
|
+
}
|
|
3265
|
+
/** Get the current number of active checkpoints. */
|
|
3266
|
+
checkpointCount() {
|
|
3267
|
+
return this.bk.checkpointCount();
|
|
3268
|
+
}
|
|
3269
|
+
/** Restore arena to a checkpoint, freeing all handles created after it. */
|
|
3270
|
+
restoreCheckpoint(cp) {
|
|
3271
|
+
this.bk.restore(cp);
|
|
3272
|
+
}
|
|
3273
|
+
/** Discard a checkpoint without restoring (keep all handles). */
|
|
3274
|
+
discardCheckpoint(cp) {
|
|
3275
|
+
this.bk.discardCheckpoint(cp);
|
|
3276
|
+
}
|
|
3256
3277
|
dispose(_handle) {
|
|
3257
3278
|
}
|
|
3258
3279
|
// ═══════════════════════════════════════════════════════════════════════
|
|
@@ -3879,22 +3900,62 @@ class BrepkitAdapter {
|
|
|
3879
3900
|
}
|
|
3880
3901
|
extractCurve2dFromEdge(edge, face) {
|
|
3881
3902
|
const eid = unwrap(edge, "edge");
|
|
3882
|
-
unwrap(face, "face");
|
|
3903
|
+
const fid = unwrap(face, "face");
|
|
3883
3904
|
const params = this.bk.getEdgeCurveParameters(eid);
|
|
3884
3905
|
const tMin = params[0] ?? 0;
|
|
3885
3906
|
const tMax = params[1] ?? 1;
|
|
3886
|
-
const
|
|
3887
|
-
const
|
|
3888
|
-
|
|
3889
|
-
|
|
3907
|
+
const BASE_N = 20;
|
|
3908
|
+
const MAX_N = 80;
|
|
3909
|
+
const REFINE_THRESHOLD = 0.05;
|
|
3910
|
+
const tValues = [];
|
|
3911
|
+
for (let i = 0; i <= BASE_N; i++) {
|
|
3912
|
+
tValues.push(tMin + (tMax - tMin) * i / BASE_N);
|
|
3913
|
+
}
|
|
3914
|
+
const evaluateUV = (t) => {
|
|
3890
3915
|
const pt = this.bk.evaluateEdgeCurve(eid, t);
|
|
3891
|
-
|
|
3916
|
+
const uv = this.bk.projectPointOnSurface(fid, pt[0], pt[1], pt[2]);
|
|
3917
|
+
return [uv[0], uv[1]];
|
|
3918
|
+
};
|
|
3919
|
+
const uvSamples = tValues.map((t) => ({
|
|
3920
|
+
t,
|
|
3921
|
+
uv: evaluateUV(t)
|
|
3922
|
+
}));
|
|
3923
|
+
let refinements = 0;
|
|
3924
|
+
while (uvSamples.length < MAX_N) {
|
|
3925
|
+
const insertions = [];
|
|
3926
|
+
for (let i = 0; i < uvSamples.length - 1; i++) {
|
|
3927
|
+
const a = uvSamples[i];
|
|
3928
|
+
const b = uvSamples[i + 1];
|
|
3929
|
+
const tMid = (a.t + b.t) / 2;
|
|
3930
|
+
const uvMid = evaluateUV(tMid);
|
|
3931
|
+
const interpU = (a.uv[0] + b.uv[0]) / 2;
|
|
3932
|
+
const interpV = (a.uv[1] + b.uv[1]) / 2;
|
|
3933
|
+
const deviation = Math.sqrt((uvMid[0] - interpU) ** 2 + (uvMid[1] - interpV) ** 2);
|
|
3934
|
+
if (deviation > REFINE_THRESHOLD) {
|
|
3935
|
+
insertions.push({ index: i + 1, t: tMid, uv: uvMid });
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
if (insertions.length === 0) break;
|
|
3939
|
+
let budget = MAX_N - uvSamples.length;
|
|
3940
|
+
for (let j = insertions.length - 1; j >= 0 && budget > 0; j--) {
|
|
3941
|
+
const ins = insertions[j];
|
|
3942
|
+
uvSamples.splice(ins.index, 0, { t: ins.t, uv: ins.uv });
|
|
3943
|
+
budget--;
|
|
3944
|
+
}
|
|
3945
|
+
refinements++;
|
|
3946
|
+
if (refinements > 3) break;
|
|
3892
3947
|
}
|
|
3948
|
+
const uvPoints = uvSamples.map((s) => s.uv);
|
|
3893
3949
|
if (uvPoints.length >= 2) {
|
|
3894
3950
|
return this.makeBSpline2d(uvPoints);
|
|
3895
3951
|
}
|
|
3896
3952
|
const verts = this.bk.getEdgeVertices(eid);
|
|
3897
|
-
|
|
3953
|
+
if (verts.length >= 6) {
|
|
3954
|
+
const uv1 = this.bk.projectPointOnSurface(fid, verts[0], verts[1], verts[2]);
|
|
3955
|
+
const uv2 = this.bk.projectPointOnSurface(fid, verts[3], verts[4], verts[5]);
|
|
3956
|
+
return makeLine2d(uv1[0], uv1[1], uv2[0], uv2[1]);
|
|
3957
|
+
}
|
|
3958
|
+
throw new Error(`brepkit: extractCurve2dFromEdge: degenerate edge (${verts.length} coords)`);
|
|
3898
3959
|
}
|
|
3899
3960
|
buildCurves3d(_wire) {
|
|
3900
3961
|
}
|
|
@@ -4011,9 +4072,9 @@ class BrepkitAdapter {
|
|
|
4011
4072
|
return result2;
|
|
4012
4073
|
}
|
|
4013
4074
|
/** Tessellate a solid with per-face groups for brepjs mesh format. */
|
|
4014
|
-
meshSolid(solidId, deflection) {
|
|
4075
|
+
meshSolid(solidId, deflection, includeUVs) {
|
|
4015
4076
|
try {
|
|
4016
|
-
return this.meshSolidGrouped(solidId, deflection);
|
|
4077
|
+
return this.meshSolidGrouped(solidId, deflection, includeUVs);
|
|
4017
4078
|
} catch (e) {
|
|
4018
4079
|
console.warn(
|
|
4019
4080
|
`brepkit: tessellateSolidGrouped failed (solidId=${solidId}), falling back to per-face:`,
|
|
@@ -4025,8 +4086,11 @@ class BrepkitAdapter {
|
|
|
4025
4086
|
/**
|
|
4026
4087
|
* Batch tessellation via `tessellateSolidGrouped` — single WASM call for
|
|
4027
4088
|
* all faces. Falls back to `meshSolidPerFace` on error.
|
|
4089
|
+
*
|
|
4090
|
+
* When `includeUVs` is true, makes an additional `tessellateSolidUV` call
|
|
4091
|
+
* to populate real surface parametrization coordinates.
|
|
4028
4092
|
*/
|
|
4029
|
-
meshSolidGrouped(solidId, deflection) {
|
|
4093
|
+
meshSolidGrouped(solidId, deflection, includeUVs) {
|
|
4030
4094
|
const json = this.bk.tessellateSolidGrouped(solidId, deflection);
|
|
4031
4095
|
const data = JSON.parse(json);
|
|
4032
4096
|
const faceIds = toArray(this.bk.getSolidFaces(solidId));
|
|
@@ -4047,12 +4111,26 @@ class BrepkitAdapter {
|
|
|
4047
4111
|
faceHash: faceIds[i] ?? 0
|
|
4048
4112
|
});
|
|
4049
4113
|
}
|
|
4114
|
+
let uvs = new Float32Array(0);
|
|
4115
|
+
if (includeUVs) {
|
|
4116
|
+
const expectedUvLen = data.positions.length / 3 * 2;
|
|
4117
|
+
try {
|
|
4118
|
+
const uvJson = this.bk.tessellateSolidUV(solidId, deflection);
|
|
4119
|
+
const uvData = JSON.parse(uvJson);
|
|
4120
|
+
if (uvData.uvs.length === expectedUvLen) {
|
|
4121
|
+
uvs = new Float32Array(uvData.uvs);
|
|
4122
|
+
} else {
|
|
4123
|
+
uvs = new Float32Array(expectedUvLen);
|
|
4124
|
+
}
|
|
4125
|
+
} catch {
|
|
4126
|
+
uvs = new Float32Array(expectedUvLen);
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4050
4129
|
return {
|
|
4051
4130
|
vertices: new Float32Array(data.positions),
|
|
4052
4131
|
normals: new Float32Array(data.normals),
|
|
4053
4132
|
triangles: new Uint32Array(data.indices),
|
|
4054
|
-
|
|
4055
|
-
uvs: new Float32Array(0),
|
|
4133
|
+
uvs,
|
|
4056
4134
|
faceGroups
|
|
4057
4135
|
};
|
|
4058
4136
|
}
|
|
@@ -4336,6 +4414,33 @@ class BrepkitAdapter {
|
|
|
4336
4414
|
}
|
|
4337
4415
|
return { point: [0, 0, 0], normal };
|
|
4338
4416
|
}
|
|
4417
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
4418
|
+
// Constraint sketch solver (brepkit-only capability)
|
|
4419
|
+
// ═══════════════════════════════════════════════════════════════════════
|
|
4420
|
+
/** Create a new constraint sketch. Returns an opaque sketch handle. */
|
|
4421
|
+
sketchNew() {
|
|
4422
|
+
return this.bk.sketchNew();
|
|
4423
|
+
}
|
|
4424
|
+
/** Add a point to a constraint sketch. Returns the point index. */
|
|
4425
|
+
sketchAddPoint(sketch, x, y, fixed) {
|
|
4426
|
+
return this.bk.sketchAddPoint(sketch, x, y, fixed);
|
|
4427
|
+
}
|
|
4428
|
+
/** Add a constraint to a sketch (JSON-encoded constraint descriptor). */
|
|
4429
|
+
sketchAddConstraint(sketch, constraintJson) {
|
|
4430
|
+
this.bk.sketchAddConstraint(sketch, constraintJson);
|
|
4431
|
+
}
|
|
4432
|
+
/**
|
|
4433
|
+
* Solve sketch constraints. Returns a JSON result with solved point positions.
|
|
4434
|
+
* @param maxIterations — solver iteration limit (e.g. 100)
|
|
4435
|
+
* @param tolerance — convergence tolerance (e.g. 1e-10)
|
|
4436
|
+
*/
|
|
4437
|
+
sketchSolve(sketch, maxIterations, tolerance) {
|
|
4438
|
+
return this.bk.sketchSolve(sketch, maxIterations, tolerance);
|
|
4439
|
+
}
|
|
4440
|
+
/** Get degrees of freedom remaining in a solved or partially-constrained sketch. */
|
|
4441
|
+
sketchDof(sketch) {
|
|
4442
|
+
return this.bk.sketchDof(sketch);
|
|
4443
|
+
}
|
|
4339
4444
|
}
|
|
4340
4445
|
function multiplyMatrices(a, b) {
|
|
4341
4446
|
const result2 = new Array(16).fill(0);
|
|
@@ -7222,6 +7327,7 @@ exports.normalAt = faceFns.normalAt;
|
|
|
7222
7327
|
exports.outerWire = faceFns.outerWire;
|
|
7223
7328
|
exports.pointOnSurface = faceFns.pointOnSurface;
|
|
7224
7329
|
exports.projectPointOnFace = faceFns.projectPointOnFace;
|
|
7330
|
+
exports.removeHolesFromFace = faceFns.removeHolesFromFace;
|
|
7225
7331
|
exports.shapeType = faceFns.shapeType;
|
|
7226
7332
|
exports.uvBounds = faceFns.uvBounds;
|
|
7227
7333
|
exports.uvCoordinates = faceFns.uvCoordinates;
|
|
@@ -7322,6 +7428,7 @@ exports.simplify = simplify;
|
|
|
7322
7428
|
exports.slice = slice;
|
|
7323
7429
|
exports.solveAssembly = solveAssembly;
|
|
7324
7430
|
exports.split = split;
|
|
7431
|
+
exports.supportsConstraintSketch = supportsConstraintSketch;
|
|
7325
7432
|
exports.supportsProjection = supportsProjection;
|
|
7326
7433
|
exports.surfaceFromGrid = surfaceFromGrid;
|
|
7327
7434
|
exports.surfaceFromImage = surfaceFromImage;
|