brepjs 18.75.1 → 18.77.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/README.md +22 -22
- package/dist/2d.cjs +6 -6
- package/dist/2d.js +6 -6
- package/dist/{blueprint-DiaBfB57.cjs → blueprint-BE93BNYE.cjs} +5 -5
- package/dist/{blueprint-OgMkiq7a.js → blueprint-BVe9JU-L.js} +5 -5
- package/dist/{blueprintFns-uYr43qo4.cjs → blueprintFns-B_7kKwEZ.cjs} +2 -2
- package/dist/{blueprintFns-C3EQ12Ix.js → blueprintFns-DWinspVK.js} +2 -2
- package/dist/{blueprintSketcher-CZqT7_gf.cjs → blueprintSketcher-D75tuXkF.cjs} +3 -3
- package/dist/{blueprintSketcher-Bp3oMzVW.js → blueprintSketcher-DL-wgnVs.js} +3 -3
- package/dist/{boolean2D-4fXjKx5f.cjs → boolean2D-C4Txi8U1.cjs} +4 -4
- package/dist/{boolean2D-DXti_c7k.js → boolean2D-OtHT7POp.js} +4 -4
- package/dist/{booleanFns-DxnTjP19.cjs → booleanFns-CFa3bgbG.cjs} +4 -4
- package/dist/{booleanFns-Cu-J1THp.js → booleanFns-D7Xgt-Og.js} +4 -4
- package/dist/brepjs.cjs +32 -25
- package/dist/brepjs.js +32 -26
- package/dist/{cameraFns-Ctxe8ev-.js → cameraFns-DCXqzH_m.js} +2 -2
- package/dist/{cameraFns-G2lc5c9M.cjs → cameraFns-DfSRnD1k.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{cornerFinder-CmXx269_.js → cornerFinder-DPkLU1Of.js} +1 -1
- package/dist/{cornerFinder-CAoT1uIs.cjs → cornerFinder-KuLU-4pQ.cjs} +1 -1
- package/dist/{curveFns-C7t4yHtQ.js → curveFns-B4KEYU1M.js} +60 -2
- package/dist/{curveFns-DQlllRhs.cjs → curveFns-C0oCmjV2.cjs} +65 -1
- package/dist/{drawFns-B7l3h4FX.js → drawFns-BBoTkSta.js} +12 -12
- package/dist/{drawFns-SddAG_uY.cjs → drawFns-DNokXs9U.cjs} +12 -12
- package/dist/{extrudeFns-b7JHaMsv.cjs → extrudeFns-BJSW3EaV.cjs} +1 -1
- package/dist/{extrudeFns-msxcCUm2.js → extrudeFns-CSWqlW-n.js} +1 -1
- package/dist/{faceFns-BJ0mbRh5.js → faceFns-BJ2hzXJp.js} +2 -2
- package/dist/{faceFns-CZvemlPW.cjs → faceFns-p0lyVuyw.cjs} +2 -2
- package/dist/{helpers-CYSAsvRe.js → helpers-C78MY-s6.js} +6 -6
- package/dist/{helpers-CRBTGZO7.cjs → helpers-DTBDjbdR.cjs} +6 -6
- package/dist/{historyFns-xUNAdUYV.cjs → historyFns-4ggYGJB2.cjs} +4 -4
- package/dist/{historyFns-BV5sQxft.js → historyFns-Ck2tXVAL.js} +4 -4
- package/dist/{importFns-BY0rgGAN.cjs → importFns-CUAiLgt_.cjs} +2 -2
- package/dist/{importFns-eHSyuIJF.js → importFns-Rv22QSn6.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/io.cjs +2 -2
- package/dist/io.js +2 -2
- package/dist/kernel/occt/geometryQueryOps.d.ts +5 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
- package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
- package/dist/kernel/occtWasm/surfaceOps.d.ts +5 -1
- package/dist/{measureFns-DYeTPyHr.js → measureFns-C8c6xRUE.js} +3 -3
- package/dist/{measureFns-CRS3U8gj.cjs → measureFns-DnxobCbD.cjs} +3 -3
- package/dist/measurement.cjs +1 -1
- package/dist/measurement.js +1 -1
- package/dist/{meshFns-CvmTzMPL.cjs → meshFns-BawS1xNA.cjs} +3 -3
- package/dist/{meshFns-CLQL2D95.js → meshFns-CuYzpojl.js} +3 -3
- package/dist/{occtWasmAdapter-m4Nua92H.js → occtWasmAdapter-BrTkhQYK.js} +83 -6
- package/dist/{occtWasmAdapter-DdghAlnN.cjs → occtWasmAdapter-W86SRBpi.cjs} +83 -6
- package/dist/operations.cjs +2 -2
- package/dist/operations.js +2 -2
- package/dist/{primitiveFns-B6Q6lx9-.js → primitiveFns-DWIzRvTY.js} +7 -7
- package/dist/{primitiveFns-FudrSXrp.cjs → primitiveFns-ItlGYe3M.cjs} +7 -7
- package/dist/projection.cjs +1 -1
- package/dist/projection.js +1 -1
- package/dist/query.cjs +2 -2
- package/dist/query.js +2 -2
- package/dist/{shapeFns-CQmd2W5F.cjs → shapeFns-D5WNrq3s.cjs} +2 -2
- package/dist/{shapeFns-CQRGTifg.js → shapeFns-DZ6poxP7.js} +2 -2
- package/dist/shapeRef.cjs +1 -1
- package/dist/shapeRef.js +1 -1
- package/dist/{shapeRefFns-DoPplxoN.cjs → shapeRefFns-BOWP8n4j.cjs} +4 -4
- package/dist/{shapeRefFns-DvIvS0do.js → shapeRefFns-ClsyeZp4.js} +4 -4
- package/dist/{shapeTypes-C4cMKLoj.cjs → shapeTypes-CxSqNvHA.cjs} +55 -26
- package/dist/{shapeTypes-VCBsDI43.js → shapeTypes-CyTY0prh.js} +55 -26
- package/dist/sketching.cjs +3 -3
- package/dist/sketching.js +3 -3
- package/dist/{solidBuilders-DBsHetmI.js → solidBuilders-BtEFUFQ9.js} +2 -2
- package/dist/{solidBuilders-B0Hzin8a.cjs → solidBuilders-diw2zyyN.cjs} +2 -2
- package/dist/{surfaceBuilders-QK_Cnn_u.cjs → surfaceBuilders-CPHOXRLE.cjs} +2 -2
- package/dist/{surfaceBuilders-DllH3kXs.js → surfaceBuilders-Do0rypyD.js} +2 -2
- package/dist/text.cjs +2 -2
- package/dist/text.js +2 -2
- package/dist/{textBlueprints-C9ne8G24.js → textBlueprints-CYc0xi6l.js} +7 -7
- package/dist/{textBlueprints-BxbCj29U.cjs → textBlueprints-D31dKTZS.cjs} +7 -7
- package/dist/{textMetrics-DRfvY1yT.cjs → textMetrics-CjbXCzpg.cjs} +1 -1
- package/dist/{textMetrics-Ddpxhy0z.js → textMetrics-DfxB-y9A.js} +1 -1
- package/dist/topology/curveFns.d.ts +12 -0
- package/dist/topology/index.d.ts +1 -1
- package/dist/topology.cjs +8 -7
- package/dist/topology.d.ts +1 -1
- package/dist/topology.js +8 -8
- package/dist/{topologyQueryFns-BtfhAVY2.js → topologyQueryFns-BomrmBie.js} +1 -1
- package/dist/{topologyQueryFns-Bj5wpC75.cjs → topologyQueryFns-Dzxrwn-E.cjs} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as getKernel, f as isEdge, t as castShape, y as isWire } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, f as isEdge, t as castShape, y as isWire } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, b as err, l as typeCastError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
//#region src/topology/curveFns.ts
|
|
4
4
|
/**
|
|
@@ -45,6 +45,64 @@ function curveTangentAt(shape, position = .5) {
|
|
|
45
45
|
function curveLength(shape) {
|
|
46
46
|
return getKernel().length(shape.wrapped);
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Axis of a circular edge: the circle's center plus the unit normal of its
|
|
50
|
+
* plane. Returns null for non-circular curves.
|
|
51
|
+
*
|
|
52
|
+
* Derived kernel-agnostically from three sampled points (the circumcenter of a
|
|
53
|
+
* triangle determines the unique circle through its vertices), so it works for
|
|
54
|
+
* full circles and arcs alike without an analytic circle accessor.
|
|
55
|
+
*/
|
|
56
|
+
function curveAxis(shape) {
|
|
57
|
+
if (getCurveType(shape) !== "CIRCLE") return null;
|
|
58
|
+
const a = curvePointAt(shape, 0);
|
|
59
|
+
const b = curvePointAt(shape, 1 / 3);
|
|
60
|
+
const c = curvePointAt(shape, 2 / 3);
|
|
61
|
+
const ab = [
|
|
62
|
+
b[0] - a[0],
|
|
63
|
+
b[1] - a[1],
|
|
64
|
+
b[2] - a[2]
|
|
65
|
+
];
|
|
66
|
+
const ac = [
|
|
67
|
+
c[0] - a[0],
|
|
68
|
+
c[1] - a[1],
|
|
69
|
+
c[2] - a[2]
|
|
70
|
+
];
|
|
71
|
+
const m = [
|
|
72
|
+
ab[1] * ac[2] - ab[2] * ac[1],
|
|
73
|
+
ab[2] * ac[0] - ab[0] * ac[2],
|
|
74
|
+
ab[0] * ac[1] - ab[1] * ac[0]
|
|
75
|
+
];
|
|
76
|
+
const mLenSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2];
|
|
77
|
+
if (mLenSq < 1e-18) return null;
|
|
78
|
+
const abSq = ab[0] * ab[0] + ab[1] * ab[1] + ab[2] * ab[2];
|
|
79
|
+
const acSq = ac[0] * ac[0] + ac[1] * ac[1] + ac[2] * ac[2];
|
|
80
|
+
const d = [
|
|
81
|
+
abSq * ac[0] - acSq * ab[0],
|
|
82
|
+
abSq * ac[1] - acSq * ab[1],
|
|
83
|
+
abSq * ac[2] - acSq * ab[2]
|
|
84
|
+
];
|
|
85
|
+
const dxm = [
|
|
86
|
+
d[1] * m[2] - d[2] * m[1],
|
|
87
|
+
d[2] * m[0] - d[0] * m[2],
|
|
88
|
+
d[0] * m[1] - d[1] * m[0]
|
|
89
|
+
];
|
|
90
|
+
const inv = 1 / (2 * mLenSq);
|
|
91
|
+
const origin = [
|
|
92
|
+
a[0] + dxm[0] * inv,
|
|
93
|
+
a[1] + dxm[1] * inv,
|
|
94
|
+
a[2] + dxm[2] * inv
|
|
95
|
+
];
|
|
96
|
+
const mLen = Math.sqrt(mLenSq);
|
|
97
|
+
return {
|
|
98
|
+
origin,
|
|
99
|
+
direction: [
|
|
100
|
+
m[0] / mLen,
|
|
101
|
+
m[1] / mLen,
|
|
102
|
+
m[2] / mLen
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
48
106
|
/** Check if the curve is closed. */
|
|
49
107
|
function curveIsClosed(shape) {
|
|
50
108
|
return getKernel().curveIsClosed(shape.wrapped);
|
|
@@ -121,4 +179,4 @@ function offsetWire2D(wire, offset, kind = "arc") {
|
|
|
121
179
|
return ok(wrapped);
|
|
122
180
|
}
|
|
123
181
|
//#endregion
|
|
124
|
-
export {
|
|
182
|
+
export { curveIsPeriodic as a, curvePointAt as c, flipOrientation as d, getCurveType as f, offsetWire2D as h, curveIsClosed as i, curveStartPoint as l, interpolateCurve as m, curveAxis as n, curveLength as o, getOrientation as p, curveEndPoint as r, curvePeriod as s, approximateCurve as t, curveTangentAt as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
//#region src/topology/curveFns.ts
|
|
4
4
|
/**
|
|
@@ -45,6 +45,64 @@ function curveTangentAt(shape, position = .5) {
|
|
|
45
45
|
function curveLength(shape) {
|
|
46
46
|
return require_shapeTypes.getKernel().length(shape.wrapped);
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Axis of a circular edge: the circle's center plus the unit normal of its
|
|
50
|
+
* plane. Returns null for non-circular curves.
|
|
51
|
+
*
|
|
52
|
+
* Derived kernel-agnostically from three sampled points (the circumcenter of a
|
|
53
|
+
* triangle determines the unique circle through its vertices), so it works for
|
|
54
|
+
* full circles and arcs alike without an analytic circle accessor.
|
|
55
|
+
*/
|
|
56
|
+
function curveAxis(shape) {
|
|
57
|
+
if (getCurveType(shape) !== "CIRCLE") return null;
|
|
58
|
+
const a = curvePointAt(shape, 0);
|
|
59
|
+
const b = curvePointAt(shape, 1 / 3);
|
|
60
|
+
const c = curvePointAt(shape, 2 / 3);
|
|
61
|
+
const ab = [
|
|
62
|
+
b[0] - a[0],
|
|
63
|
+
b[1] - a[1],
|
|
64
|
+
b[2] - a[2]
|
|
65
|
+
];
|
|
66
|
+
const ac = [
|
|
67
|
+
c[0] - a[0],
|
|
68
|
+
c[1] - a[1],
|
|
69
|
+
c[2] - a[2]
|
|
70
|
+
];
|
|
71
|
+
const m = [
|
|
72
|
+
ab[1] * ac[2] - ab[2] * ac[1],
|
|
73
|
+
ab[2] * ac[0] - ab[0] * ac[2],
|
|
74
|
+
ab[0] * ac[1] - ab[1] * ac[0]
|
|
75
|
+
];
|
|
76
|
+
const mLenSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2];
|
|
77
|
+
if (mLenSq < 1e-18) return null;
|
|
78
|
+
const abSq = ab[0] * ab[0] + ab[1] * ab[1] + ab[2] * ab[2];
|
|
79
|
+
const acSq = ac[0] * ac[0] + ac[1] * ac[1] + ac[2] * ac[2];
|
|
80
|
+
const d = [
|
|
81
|
+
abSq * ac[0] - acSq * ab[0],
|
|
82
|
+
abSq * ac[1] - acSq * ab[1],
|
|
83
|
+
abSq * ac[2] - acSq * ab[2]
|
|
84
|
+
];
|
|
85
|
+
const dxm = [
|
|
86
|
+
d[1] * m[2] - d[2] * m[1],
|
|
87
|
+
d[2] * m[0] - d[0] * m[2],
|
|
88
|
+
d[0] * m[1] - d[1] * m[0]
|
|
89
|
+
];
|
|
90
|
+
const inv = 1 / (2 * mLenSq);
|
|
91
|
+
const origin = [
|
|
92
|
+
a[0] + dxm[0] * inv,
|
|
93
|
+
a[1] + dxm[1] * inv,
|
|
94
|
+
a[2] + dxm[2] * inv
|
|
95
|
+
];
|
|
96
|
+
const mLen = Math.sqrt(mLenSq);
|
|
97
|
+
return {
|
|
98
|
+
origin,
|
|
99
|
+
direction: [
|
|
100
|
+
m[0] / mLen,
|
|
101
|
+
m[1] / mLen,
|
|
102
|
+
m[2] / mLen
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
48
106
|
/** Check if the curve is closed. */
|
|
49
107
|
function curveIsClosed(shape) {
|
|
50
108
|
return require_shapeTypes.getKernel().curveIsClosed(shape.wrapped);
|
|
@@ -127,6 +185,12 @@ Object.defineProperty(exports, "approximateCurve", {
|
|
|
127
185
|
return approximateCurve;
|
|
128
186
|
}
|
|
129
187
|
});
|
|
188
|
+
Object.defineProperty(exports, "curveAxis", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function() {
|
|
191
|
+
return curveAxis;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
130
194
|
Object.defineProperty(exports, "curveEndPoint", {
|
|
131
195
|
enumerable: true,
|
|
132
196
|
get: function() {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { R as DisposalScope, Y as _usingCtx, Z as getKernel, a as createEdge, o as createFace, u as createWire } from "./shapeTypes-
|
|
1
|
+
import { R as DisposalScope, Y as _usingCtx, Z as getKernel, a as createEdge, o as createFace, u as createWire } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { n as wasmIndex } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { R as unwrap, h as bug, s as safeIndex } from "./errors-DNWJsfVU.js";
|
|
4
|
-
import { s as getEdges } from "./topologyQueryFns-
|
|
4
|
+
import { s as getEdges } from "./topologyQueryFns-BomrmBie.js";
|
|
5
5
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
6
6
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
7
7
|
import { d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-SKPRvPH-.js";
|
|
8
8
|
import { a as planeToWorld, o as resolvePlane } from "./planeOps-DSjjtrjg.js";
|
|
9
|
-
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as downcast } from "./faceFns-
|
|
10
|
-
import {
|
|
9
|
+
import { d as pointOnSurface, l as normalAt, m as uvBounds, r as faceCenter, u as outerWire, v as downcast } from "./faceFns-BJ2hzXJp.js";
|
|
10
|
+
import { h as offsetWire2D, i as curveIsClosed, l as curveStartPoint } from "./curveFns-B4KEYU1M.js";
|
|
11
11
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
12
|
-
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-
|
|
13
|
-
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-
|
|
14
|
-
import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-
|
|
15
|
-
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-
|
|
16
|
-
import { t as cornerFinder } from "./cornerFinder-
|
|
17
|
-
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-
|
|
18
|
-
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-
|
|
19
|
-
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-
|
|
12
|
+
import { c as makeBSplineApproximation, d as makeCircle, f as makeEllipse, m as makeHelix, r as makeFace, s as assembleWire } from "./surfaceBuilders-Do0rypyD.js";
|
|
13
|
+
import { a as Blueprints, c as make2dOffset, i as CompoundBlueprint, l as intersectCurves, n as BaseSketcher2d, o as chamferCurves, s as filletCurves, u as Flatbush } from "./blueprintSketcher-DL-wgnVs.js";
|
|
14
|
+
import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-C78MY-s6.js";
|
|
15
|
+
import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-BVe9JU-L.js";
|
|
16
|
+
import { t as cornerFinder } from "./cornerFinder-DPkLU1Of.js";
|
|
17
|
+
import { c as roundedRectangleBlueprint, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D } from "./boolean2D-OtHT7POp.js";
|
|
18
|
+
import { _ as wrapSketchDataArray, a as Sketch, g as wrapSketchData, i as Sketches, t as textBlueprints } from "./textBlueprints-CYc0xi6l.js";
|
|
19
|
+
import { i as projectEdges, t as cameraFromPlane } from "./cameraFns-DCXqzH_m.js";
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const require_textBlueprints = require("./textBlueprints-
|
|
2
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_textBlueprints = require("./textBlueprints-D31dKTZS.cjs");
|
|
2
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
3
3
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
4
4
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
5
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
5
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Dzxrwn-E.cjs");
|
|
6
6
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
7
7
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
8
8
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
9
9
|
const require_planeOps = require("./planeOps-BA4HfgQu.cjs");
|
|
10
|
-
const require_faceFns = require("./faceFns-
|
|
11
|
-
const require_curveFns = require("./curveFns-
|
|
10
|
+
const require_faceFns = require("./faceFns-p0lyVuyw.cjs");
|
|
11
|
+
const require_curveFns = require("./curveFns-C0oCmjV2.cjs");
|
|
12
12
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
13
|
-
const require_surfaceBuilders = require("./surfaceBuilders-
|
|
14
|
-
const require_blueprintSketcher = require("./blueprintSketcher-
|
|
15
|
-
const require_helpers = require("./helpers-
|
|
16
|
-
const require_blueprint = require("./blueprint-
|
|
17
|
-
const require_cornerFinder = require("./cornerFinder-
|
|
18
|
-
const require_boolean2D = require("./boolean2D-
|
|
19
|
-
const require_cameraFns = require("./cameraFns-
|
|
13
|
+
const require_surfaceBuilders = require("./surfaceBuilders-CPHOXRLE.cjs");
|
|
14
|
+
const require_blueprintSketcher = require("./blueprintSketcher-D75tuXkF.cjs");
|
|
15
|
+
const require_helpers = require("./helpers-DTBDjbdR.cjs");
|
|
16
|
+
const require_blueprint = require("./blueprint-BE93BNYE.cjs");
|
|
17
|
+
const require_cornerFinder = require("./cornerFinder-KuLU-4pQ.cjs");
|
|
18
|
+
const require_boolean2D = require("./boolean2D-C4Txi8U1.cjs");
|
|
19
|
+
const require_cameraFns = require("./cameraFns-DfSRnD1k.cjs");
|
|
20
20
|
//#region src/2d/lib/stitching.ts
|
|
21
21
|
/**
|
|
22
22
|
* Group a flat list of curves into connected chains by matching endpoints.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
4
4
|
//#region src/operations/extrudeUtils.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as getKernel, c as createSolid, h as isShape3D, t as castShape, y as isWire } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, c as createSolid, h as isShape3D, t as castShape, y as isWire } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode, w as isErr } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { c as vecLength, d as vecNormalize, t as vecAdd } from "./vecOps-SKPRvPH-.js";
|
|
4
4
|
//#region src/operations/extrudeUtils.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, t as castShape } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, R as unwrap, b as err, l as typeCastError } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { a as getCachedSurfaceType } from "./topologyQueryFns-
|
|
3
|
+
import { a as getCachedSurfaceType } from "./topologyQueryFns-BomrmBie.js";
|
|
4
4
|
import { r as toVec3 } from "./types-D24Y27N0.js";
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Dzxrwn-E.cjs");
|
|
4
4
|
const require_types = require("./types-KjA8tY4Y.cjs");
|
|
5
5
|
//#region src/topology/cast.ts
|
|
6
6
|
var TOPO_ENUM = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Z as getKernel, p as isFace } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, p as isFace } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, T as isOk, b as err, h as bug, o as queryError } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-
|
|
3
|
+
import { c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-BomrmBie.js";
|
|
4
4
|
import { t as DEG2RAD } from "./constants-ITRzCnCp.js";
|
|
5
5
|
import { a as vecDot, d as vecNormalize } from "./vecOps-SKPRvPH-.js";
|
|
6
|
-
import { l as normalAt, s as getSurfaceType } from "./faceFns-
|
|
7
|
-
import { a as isSameShape, n as getHashCode } from "./shapeFns-
|
|
8
|
-
import {
|
|
9
|
-
import { n as measureArea } from "./measureFns-
|
|
6
|
+
import { l as normalAt, s as getSurfaceType } from "./faceFns-BJ2hzXJp.js";
|
|
7
|
+
import { a as isSameShape, n as getHashCode } from "./shapeFns-DZ6poxP7.js";
|
|
8
|
+
import { f as getCurveType, i as curveIsClosed, o as curveLength } from "./curveFns-B4KEYU1M.js";
|
|
9
|
+
import { n as measureArea } from "./measureFns-C8c6xRUE.js";
|
|
10
10
|
//#region src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Dzxrwn-E.cjs");
|
|
4
4
|
const require_constants = require("./constants-BOVyEYGH.cjs");
|
|
5
5
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
6
|
-
const require_faceFns = require("./faceFns-
|
|
7
|
-
const require_shapeFns = require("./shapeFns-
|
|
8
|
-
const require_curveFns = require("./curveFns-
|
|
9
|
-
const require_measureFns = require("./measureFns-
|
|
6
|
+
const require_faceFns = require("./faceFns-p0lyVuyw.cjs");
|
|
7
|
+
const require_shapeFns = require("./shapeFns-D5WNrq3s.cjs");
|
|
8
|
+
const require_curveFns = require("./curveFns-C0oCmjV2.cjs");
|
|
9
|
+
const require_measureFns = require("./measureFns-DnxobCbD.cjs");
|
|
10
10
|
//#region src/utils/vec2d.ts
|
|
11
11
|
/** Precision for curve intersection and parameter operations. */
|
|
12
12
|
var PRECISION_INTERSECTION = 1e-9;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
3
|
const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
5
|
-
const require_shapeFns = require("./shapeFns-
|
|
6
|
-
const require_booleanFns = require("./booleanFns-
|
|
4
|
+
const require_faceFns = require("./faceFns-p0lyVuyw.cjs");
|
|
5
|
+
const require_shapeFns = require("./shapeFns-D5WNrq3s.cjs");
|
|
6
|
+
const require_booleanFns = require("./booleanFns-CFa3bgbG.cjs");
|
|
7
7
|
//#region src/utils/uuid.ts
|
|
8
8
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
9
|
function uuidv() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as createKernelHandle, Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { B as createKernelHandle, Z as getKernel, t as castShape } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, n as computationError, r as ioError } from "./errors-DNWJsfVU.js";
|
|
3
3
|
import { d as vecNormalize, s as vecIsZero } from "./vecOps-SKPRvPH-.js";
|
|
4
|
-
import { y as fromBREP } from "./faceFns-
|
|
5
|
-
import { s as toBREP } from "./shapeFns-
|
|
6
|
-
import { a as fuseAll } from "./booleanFns-
|
|
4
|
+
import { y as fromBREP } from "./faceFns-BJ2hzXJp.js";
|
|
5
|
+
import { s as toBREP } from "./shapeFns-DZ6poxP7.js";
|
|
6
|
+
import { a as fuseAll } from "./booleanFns-D7Xgt-Og.js";
|
|
7
7
|
//#region src/utils/uuid.ts
|
|
8
8
|
/** Generate a v4-style UUID string using `crypto.getRandomValues`. */
|
|
9
9
|
function uuidv() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_vec3 = require("./vec3-CFwOI0ZI.cjs");
|
|
3
3
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
4
4
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
5
|
-
const require_blueprint = require("./blueprint-
|
|
5
|
+
const require_blueprint = require("./blueprint-BE93BNYE.cjs");
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Z as getKernel, t as castShape } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, t as castShape } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { n as wasmIndex, t as vec3At$1 } from "./vec3-Dpha8d5k.js";
|
|
3
3
|
import { A as ok, b as err, r as ioError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
4
4
|
import { n as getAtOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
5
|
-
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-
|
|
5
|
+
import { f as make2dSegmentCurve, m as make2dThreePointArc, s as make2dBezierCurve, t as Blueprint } from "./blueprint-BVe9JU-L.js";
|
|
6
6
|
//#region src/io/objExportFns.ts
|
|
7
7
|
/** Read a vec3 from a typed array at the given vertex index. */
|
|
8
8
|
function vec3At(arr, i) {
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export { colorFaces, colorShape, getFaceColor, getShapeColor, } from './topology
|
|
|
88
88
|
export type { Color, ColorInput } from './topology/metadata/colorFns.js';
|
|
89
89
|
export { chamferDistAngle as chamferDistAngleShape } from './topology/chamferAngleFns.js';
|
|
90
90
|
export { facesOfEdge, edgesOfFace, wiresOfFace, verticesOfEdge, adjacentFaces, sharedEdges, } from './topology/adjacencyFns.js';
|
|
91
|
-
export { getCurveType, curveStartPoint, curveEndPoint, curvePointAt, curveTangentAt, curveLength, curveIsClosed, curveIsPeriodic, curvePeriod, getOrientation, flipOrientation, offsetWire2D, interpolateCurve, approximateCurve, type InterpolateCurveOptions, type ApproximateCurveOptions, } from './topology/curveFns.js';
|
|
91
|
+
export { getCurveType, curveStartPoint, curveEndPoint, curvePointAt, curveTangentAt, curveAxis, curveLength, curveIsClosed, curveIsPeriodic, curvePeriod, getOrientation, flipOrientation, offsetWire2D, interpolateCurve, approximateCurve, type InterpolateCurveOptions, type ApproximateCurveOptions, } from './topology/curveFns.js';
|
|
92
92
|
export { getNurbsCurveData, getNurbsSurfaceData } from './topology/nurbsFns.js';
|
|
93
93
|
export type { NurbsCurveData, NurbsSurfaceData } from './kernel/types.js';
|
|
94
94
|
export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
|
package/dist/io.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_meshFns = require("./meshFns-
|
|
3
|
-
const require_importFns = require("./importFns-
|
|
2
|
+
const require_meshFns = require("./meshFns-BawS1xNA.cjs");
|
|
3
|
+
const require_importFns = require("./importFns-CUAiLgt_.cjs");
|
|
4
4
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
5
5
|
exports.exportDXF = require_importFns.exportDXF;
|
|
6
6
|
exports.exportGlb = require_importFns.exportGlb;
|
package/dist/io.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-
|
|
2
|
-
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-
|
|
1
|
+
import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-CuYzpojl.js";
|
|
2
|
+
import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-Rv22QSn6.js";
|
|
3
3
|
export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
|
|
@@ -69,7 +69,11 @@ export declare function getSurfaceCylinderData(oc: KernelInstance, surface: Kern
|
|
|
69
69
|
radius: number;
|
|
70
70
|
isDirect: boolean;
|
|
71
71
|
} | null;
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Get the axis of symmetry (point on axis + unit direction) for an analytic
|
|
74
|
+
* face that has one: cylinder, cone, torus, or surface of revolution. Null
|
|
75
|
+
* otherwise (plane, sphere, free-form).
|
|
76
|
+
*/
|
|
73
77
|
export declare function getSurfaceAxis(oc: KernelInstance, face: KernelShape): {
|
|
74
78
|
origin: [number, number, number];
|
|
75
79
|
direction: [number, number, number];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_occtWasmAdapter = require("../../occtWasmAdapter-
|
|
2
|
+
const require_occtWasmAdapter = require("../../occtWasmAdapter-W86SRBpi.cjs");
|
|
3
3
|
exports.OcctWasmAdapter = require_occtWasmAdapter.OcctWasmAdapter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as OcctWasmAdapter } from "../../occtWasmAdapter-
|
|
1
|
+
import { t as OcctWasmAdapter } from "../../occtWasmAdapter-BrTkhQYK.js";
|
|
2
2
|
export { OcctWasmAdapter };
|
|
@@ -12,7 +12,11 @@ export declare function outerWire(k: OcctKernelWasm, face: KernelShape): KernelS
|
|
|
12
12
|
export declare function surfaceNormal(k: OcctKernelWasm, face: KernelShape, u: number, v: number): [number, number, number];
|
|
13
13
|
export declare function pointOnSurface(k: OcctKernelWasm, face: KernelShape, u: number, v: number): [number, number, number];
|
|
14
14
|
type V3 = [number, number, number];
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Axis of symmetry (point on axis + unit direction) for an analytic face that
|
|
17
|
+
* has one. Cylinders use the exact normal-cross derivation; cones, tori, and
|
|
18
|
+
* surfaces of revolution fall back to circle-center sampling. Null otherwise.
|
|
19
|
+
*/
|
|
16
20
|
export declare function getSurfaceAxis(k: OcctKernelWasm, face: KernelShape): {
|
|
17
21
|
origin: V3;
|
|
18
22
|
direction: V3;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Z as getKernel } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, b as err, d as validationError, t as BrepErrorCode } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { w as kernelCallRaw } from "./topologyQueryFns-
|
|
4
|
-
import { m as uvBounds } from "./faceFns-
|
|
3
|
+
import { w as kernelCallRaw } from "./topologyQueryFns-BomrmBie.js";
|
|
4
|
+
import { m as uvBounds } from "./faceFns-BJ2hzXJp.js";
|
|
5
5
|
//#region src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_faceFns = require("./faceFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Dzxrwn-E.cjs");
|
|
4
|
+
const require_faceFns = require("./faceFns-p0lyVuyw.cjs");
|
|
5
5
|
//#region src/measurement/measureCache.ts
|
|
6
6
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function getCachedMeasurement(shape, key) {
|
package/dist/measurement.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_measureFns = require("./measureFns-
|
|
2
|
+
const require_measureFns = require("./measureFns-DnxobCbD.cjs");
|
|
3
3
|
exports.createDistanceQuery = require_measureFns.createDistanceQuery;
|
|
4
4
|
exports.measureArea = require_measureFns.measureArea;
|
|
5
5
|
exports.measureDistance = require_measureFns.measureDistance;
|
package/dist/measurement.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-
|
|
1
|
+
import { a as measureDistance, c as measureLinearProps, d as measureVolumeProps, l as measureSurfaceProps, n as measureArea, o as measureDistanceProps, s as measureLength, t as createDistanceQuery, u as measureVolume } from "./measureFns-C8c6xRUE.js";
|
|
2
2
|
export { createDistanceQuery, measureArea, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_shapeTypes = require("./shapeTypes-
|
|
1
|
+
const require_shapeTypes = require("./shapeTypes-CxSqNvHA.cjs");
|
|
2
2
|
const require_errors = require("./errors-CXJtc4I7.cjs");
|
|
3
|
-
const require_topologyQueryFns = require("./topologyQueryFns-
|
|
4
|
-
const require_shapeFns = require("./shapeFns-
|
|
3
|
+
const require_topologyQueryFns = require("./topologyQueryFns-Dzxrwn-E.cjs");
|
|
4
|
+
const require_shapeFns = require("./shapeFns-D5WNrq3s.cjs");
|
|
5
5
|
//#region src/topology/meshCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Z as getKernel, gt as qualityDeflection } from "./shapeTypes-
|
|
1
|
+
import { Z as getKernel, gt as qualityDeflection } from "./shapeTypes-CyTY0prh.js";
|
|
2
2
|
import { A as ok, b as err, r as ioError } from "./errors-DNWJsfVU.js";
|
|
3
|
-
import { d as getSolids, n as getBounds } from "./topologyQueryFns-
|
|
4
|
-
import { O as getFaceOrigins } from "./shapeFns-
|
|
3
|
+
import { d as getSolids, n as getBounds } from "./topologyQueryFns-BomrmBie.js";
|
|
4
|
+
import { O as getFaceOrigins } from "./shapeFns-DZ6poxP7.js";
|
|
5
5
|
//#region src/topology/meshCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Build a parameter key for the inner cache map (excludes shape identity).
|
|
@@ -1842,13 +1842,90 @@ function deriveCylinder(k, face) {
|
|
|
1842
1842
|
isDirect: (shapeOrientation(k, face) === "reversed" ? -1 : 1) * dotV(n1, subV(p1, origin)) > 0
|
|
1843
1843
|
};
|
|
1844
1844
|
}
|
|
1845
|
-
/**
|
|
1845
|
+
/** Circumcenter of three points (the center of the unique circle through them). */
|
|
1846
|
+
function circumcenter(a, p, q) {
|
|
1847
|
+
const ab = subV(p, a);
|
|
1848
|
+
const ac = subV(q, a);
|
|
1849
|
+
const m = crossV(ab, ac);
|
|
1850
|
+
const mSq = dotV(m, m);
|
|
1851
|
+
if (mSq < 1e-18) return null;
|
|
1852
|
+
const abSq = dotV(ab, ab);
|
|
1853
|
+
const acSq = dotV(ac, ac);
|
|
1854
|
+
const dxm = crossV([
|
|
1855
|
+
abSq * ac[0] - acSq * ab[0],
|
|
1856
|
+
abSq * ac[1] - acSq * ab[1],
|
|
1857
|
+
abSq * ac[2] - acSq * ab[2]
|
|
1858
|
+
], m);
|
|
1859
|
+
const inv = 1 / (2 * mSq);
|
|
1860
|
+
return [
|
|
1861
|
+
a[0] + dxm[0] * inv,
|
|
1862
|
+
a[1] + dxm[1] * inv,
|
|
1863
|
+
a[2] + dxm[2] * inv
|
|
1864
|
+
];
|
|
1865
|
+
}
|
|
1866
|
+
/** Center of the iso-v circle at height v (three u-samples → circumcenter). */
|
|
1867
|
+
function isoCircleCenter(k, face, uMin, uMax, v) {
|
|
1868
|
+
return circumcenter(pointOnSurface(k, face, uMin + .1 * (uMax - uMin), v), pointOnSurface(k, face, uMin + .45 * (uMax - uMin), v), pointOnSurface(k, face, uMin + .8 * (uMax - uMin), v));
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Axis of a surface of revolution (cone, torus, general revolution) by sampling.
|
|
1872
|
+
* occt-wasm exposes no analytic accessor for these. Their U parameter is the
|
|
1873
|
+
* angle of revolution, so the iso-v curve at a fixed v is a circle centered on
|
|
1874
|
+
* the axis; two such centers at different heights span the axis.
|
|
1875
|
+
*
|
|
1876
|
+
* Samples three v-levels and uses the farthest-apart pair of centers. Two levels
|
|
1877
|
+
* suffice for a cone or general revolution (v is monotonic along the axis), but
|
|
1878
|
+
* a torus parameterizes v as the tube angle: on a v-symmetric partial torus (a
|
|
1879
|
+
* half-torus, v in [0, pi]) two symmetric samples land at equal heights and
|
|
1880
|
+
* their centers coincide. A third level breaks that symmetry. Avoids the v
|
|
1881
|
+
* extremes so a cone apex (a degenerate zero-radius circle) is not sampled.
|
|
1882
|
+
*/
|
|
1883
|
+
function deriveAxisBySampling(k, face) {
|
|
1884
|
+
const b = uvBounds(k, face);
|
|
1885
|
+
const centers = [
|
|
1886
|
+
.2,
|
|
1887
|
+
.5,
|
|
1888
|
+
.8
|
|
1889
|
+
].map((f) => isoCircleCenter(k, face, b.uMin, b.uMax, b.vMin + f * (b.vMax - b.vMin))).filter((c) => c !== null);
|
|
1890
|
+
if (centers.length < 2) return null;
|
|
1891
|
+
let best = null;
|
|
1892
|
+
let bestLen = 1e-9;
|
|
1893
|
+
for (let i = 0; i < centers.length; i++) for (let j = i + 1; j < centers.length; j++) {
|
|
1894
|
+
const ci = centers[i];
|
|
1895
|
+
const cj = centers[j];
|
|
1896
|
+
if (!ci || !cj) continue;
|
|
1897
|
+
const d = subV(cj, ci);
|
|
1898
|
+
const len = lenV(d);
|
|
1899
|
+
if (len > bestLen) {
|
|
1900
|
+
bestLen = len;
|
|
1901
|
+
best = {
|
|
1902
|
+
origin: ci,
|
|
1903
|
+
direction: [
|
|
1904
|
+
d[0] / len,
|
|
1905
|
+
d[1] / len,
|
|
1906
|
+
d[2] / len
|
|
1907
|
+
]
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
return best;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Axis of symmetry (point on axis + unit direction) for an analytic face that
|
|
1915
|
+
* has one. Cylinders use the exact normal-cross derivation; cones, tori, and
|
|
1916
|
+
* surfaces of revolution fall back to circle-center sampling. Null otherwise.
|
|
1917
|
+
*/
|
|
1846
1918
|
function getSurfaceAxis(k, face) {
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1919
|
+
const type = surfaceType(k, face);
|
|
1920
|
+
if (type === "cylinder") {
|
|
1921
|
+
const cyl = deriveCylinder(k, face);
|
|
1922
|
+
return cyl ? {
|
|
1923
|
+
origin: cyl.origin,
|
|
1924
|
+
direction: cyl.direction
|
|
1925
|
+
} : null;
|
|
1926
|
+
}
|
|
1927
|
+
if (type === "cone" || type === "torus" || type === "revolution") return deriveAxisBySampling(k, face);
|
|
1928
|
+
return null;
|
|
1852
1929
|
}
|
|
1853
1930
|
/** Cylinder radius + handedness for a cylindrical surface. Null for non-cylinders. */
|
|
1854
1931
|
function getSurfaceCylinderData(k, surface) {
|