brepjs 18.111.0 → 18.112.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/brepjs.cjs +146 -22
- package/dist/brepjs.js +146 -26
- package/dist/{healingFns-CPm_VFck.js → healingFns-D00TPE9p.js} +62 -1
- package/dist/{healingFns-C4UE1ZyM.cjs → healingFns-x1sHV-HO.cjs} +73 -0
- package/dist/index.d.ts +3 -3
- package/dist/topology/adjacencyFns.d.ts +15 -0
- package/dist/topology/shapeRef/index.d.ts +2 -1
- package/dist/topology/shapeRef/roleLookup.d.ts +9 -0
- package/dist/topology/shapeRef/shapeRefTypes.d.ts +29 -1
- package/dist/topology/shapeRef/vertexRefFns.d.ts +14 -0
- package/dist/topology/topologyQueryFns.d.ts +5 -0
- package/dist/topology.cjs +1 -1
- package/dist/topology.js +1 -1
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const require_meshFns = require("./meshFns-1hQSn1p2.cjs");
|
|
|
16
16
|
const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
|
|
17
17
|
const require_surfaceBuilders = require("./surfaceBuilders-UyyfZy8w.cjs");
|
|
18
18
|
const require_solidBuilders = require("./solidBuilders-DiUv_mD0.cjs");
|
|
19
|
-
const require_healingFns = require("./healingFns-
|
|
19
|
+
const require_healingFns = require("./healingFns-x1sHV-HO.cjs");
|
|
20
20
|
const require_threadFns = require("./threadFns-C8bErjVC.cjs");
|
|
21
21
|
const require_blueprintSketcher = require("./blueprintSketcher-RK-cH6ps.cjs");
|
|
22
22
|
const require_helpers = require("./helpers-BSLPCflF.cjs");
|
|
@@ -1175,6 +1175,28 @@ function withKernelDir(v, fn) {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
1177
|
//#endregion
|
|
1178
|
+
//#region src/topology/shapeRef/roleLookup.ts
|
|
1179
|
+
/** Euclidean distance between two points. */
|
|
1180
|
+
function distance(a, b) {
|
|
1181
|
+
const dx = a[0] - b[0];
|
|
1182
|
+
const dy = a[1] - b[1];
|
|
1183
|
+
const dz = a[2] - b[2];
|
|
1184
|
+
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1185
|
+
}
|
|
1186
|
+
/** The role whose tracked hashes include this face (reverse lookup). */
|
|
1187
|
+
function roleOfFace(face, origin, roles) {
|
|
1188
|
+
const originRoles = roles.get(origin);
|
|
1189
|
+
if (!originRoles) return void 0;
|
|
1190
|
+
const hash = require_shapeFns.getHashCode(face);
|
|
1191
|
+
for (const [role, hashes] of originRoles) if (hashes.includes(hash)) return role;
|
|
1192
|
+
}
|
|
1193
|
+
/** Current faces a role resolves to — its tracked successors present in `shape`. */
|
|
1194
|
+
function facesForRole(shape, origin, role, roles) {
|
|
1195
|
+
const hashes = roles.get(origin)?.get(role);
|
|
1196
|
+
if (hashes === void 0 || hashes.length === 0) return [];
|
|
1197
|
+
return require_topologyQueryFns.getFaces(shape).filter((f) => hashes.includes(require_shapeFns.getHashCode(f)));
|
|
1198
|
+
}
|
|
1199
|
+
//#endregion
|
|
1178
1200
|
//#region src/topology/shapeRef/edgeRefFns.ts
|
|
1179
1201
|
/** Midpoint of an edge's endpoint vertices (a closed edge collapses to one). */
|
|
1180
1202
|
function endpointMidpoint(verts) {
|
|
@@ -1195,12 +1217,6 @@ function endpointMidpoint(verts) {
|
|
|
1195
1217
|
z / n
|
|
1196
1218
|
];
|
|
1197
1219
|
}
|
|
1198
|
-
function distance(a, b) {
|
|
1199
|
-
const dx = a[0] - b[0];
|
|
1200
|
-
const dy = a[1] - b[1];
|
|
1201
|
-
const dz = a[2] - b[2];
|
|
1202
|
-
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1203
|
-
}
|
|
1204
1220
|
function captureEdgeHint(edge) {
|
|
1205
1221
|
const lengthResult = require_measureFns.measureLength(edge);
|
|
1206
1222
|
return {
|
|
@@ -1209,19 +1225,6 @@ function captureEdgeHint(edge) {
|
|
|
1209
1225
|
midpoint: endpointMidpoint(require_healingFns.verticesOfEdge(edge))
|
|
1210
1226
|
};
|
|
1211
1227
|
}
|
|
1212
|
-
/** Reverse the role table: the role whose tracked hashes include this face. */
|
|
1213
|
-
function roleOfFace(face, origin, roles) {
|
|
1214
|
-
const originRoles = roles.get(origin);
|
|
1215
|
-
if (!originRoles) return void 0;
|
|
1216
|
-
const hash = require_shapeFns.getHashCode(face);
|
|
1217
|
-
for (const [role, hashes] of originRoles) if (hashes.includes(hash)) return role;
|
|
1218
|
-
}
|
|
1219
|
-
/** Current faces a role resolves to (its tracked successors present in `shape`). */
|
|
1220
|
-
function facesForRole(shape, origin, role, roles) {
|
|
1221
|
-
const hashes = roles.get(origin)?.get(role);
|
|
1222
|
-
if (hashes === void 0 || hashes.length === 0) return [];
|
|
1223
|
-
return require_topologyQueryFns.getFaces(shape).filter((f) => hashes.includes(require_shapeFns.getHashCode(f)));
|
|
1224
|
-
}
|
|
1225
1228
|
function dedupeEdges(edges) {
|
|
1226
1229
|
const seen = /* @__PURE__ */ new Set();
|
|
1227
1230
|
const out = [];
|
|
@@ -1235,7 +1238,7 @@ function dedupeEdges(edges) {
|
|
|
1235
1238
|
return out;
|
|
1236
1239
|
}
|
|
1237
1240
|
/** Hint scores closer than this are treated as indistinguishable (→ ambiguous). */
|
|
1238
|
-
var HINT_MARGIN = 1e-6;
|
|
1241
|
+
var HINT_MARGIN$1 = 1e-6;
|
|
1239
1242
|
/**
|
|
1240
1243
|
* Pick the candidate edge closest to the hint (length + endpoint midpoint).
|
|
1241
1244
|
* Returns undefined when it genuinely can't discriminate — the hint carries no
|
|
@@ -1263,7 +1266,7 @@ function bestByHint(candidates, hint) {
|
|
|
1263
1266
|
best = edge;
|
|
1264
1267
|
} else if (score < secondScore) secondScore = score;
|
|
1265
1268
|
}
|
|
1266
|
-
if (best === void 0 || secondScore - bestScore < HINT_MARGIN) return void 0;
|
|
1269
|
+
if (best === void 0 || secondScore - bestScore < HINT_MARGIN$1) return void 0;
|
|
1267
1270
|
return best;
|
|
1268
1271
|
}
|
|
1269
1272
|
/**
|
|
@@ -1325,6 +1328,123 @@ function resolveEdgeRef(ref, roles, shape) {
|
|
|
1325
1328
|
};
|
|
1326
1329
|
}
|
|
1327
1330
|
//#endregion
|
|
1331
|
+
//#region src/topology/shapeRef/vertexRefFns.ts
|
|
1332
|
+
/** A corner needs at least this many faces to pin a unique point. */
|
|
1333
|
+
var MIN_VERTEX_FACES = 3;
|
|
1334
|
+
/** Hint distances closer than this are indistinguishable (→ ambiguous). */
|
|
1335
|
+
var HINT_MARGIN = 1e-6;
|
|
1336
|
+
/** Hashes of all vertices across `faces`, recording one handle per hash. */
|
|
1337
|
+
function vertexHashes(faces, handles) {
|
|
1338
|
+
const hashes = /* @__PURE__ */ new Set();
|
|
1339
|
+
for (const f of faces) for (const v of require_healingFns.verticesOfFace(f)) {
|
|
1340
|
+
const h = require_shapeFns.getHashCode(v);
|
|
1341
|
+
hashes.add(h);
|
|
1342
|
+
if (!handles.has(h)) handles.set(h, v);
|
|
1343
|
+
}
|
|
1344
|
+
return hashes;
|
|
1345
|
+
}
|
|
1346
|
+
function intersect$2(a, b) {
|
|
1347
|
+
const out = /* @__PURE__ */ new Set();
|
|
1348
|
+
for (const h of a) if (b.has(h)) out.add(h);
|
|
1349
|
+
return out;
|
|
1350
|
+
}
|
|
1351
|
+
/** Vertices present in (a face of) every face-set — the shared corner(s). */
|
|
1352
|
+
function commonVertices(faceSets) {
|
|
1353
|
+
const handles = /* @__PURE__ */ new Map();
|
|
1354
|
+
let common;
|
|
1355
|
+
for (const faces of faceSets) {
|
|
1356
|
+
const hashes = vertexHashes(faces, handles);
|
|
1357
|
+
common = common === void 0 ? hashes : intersect$2(common, hashes);
|
|
1358
|
+
}
|
|
1359
|
+
if (common === void 0) return [];
|
|
1360
|
+
const result = [];
|
|
1361
|
+
for (const h of common) {
|
|
1362
|
+
const v = handles.get(h);
|
|
1363
|
+
if (v !== void 0) result.push(v);
|
|
1364
|
+
}
|
|
1365
|
+
return result;
|
|
1366
|
+
}
|
|
1367
|
+
/** Nearest candidate to the hint position; undefined if no signal or a tie. */
|
|
1368
|
+
function nearestToHint(vertices, hint) {
|
|
1369
|
+
if (hint.position === void 0) return void 0;
|
|
1370
|
+
let best;
|
|
1371
|
+
let bestDist = Infinity;
|
|
1372
|
+
let secondDist = Infinity;
|
|
1373
|
+
for (const v of vertices) {
|
|
1374
|
+
const d = distance(require_topologyQueryFns.vertexPosition(v), hint.position);
|
|
1375
|
+
if (d < bestDist) {
|
|
1376
|
+
secondDist = bestDist;
|
|
1377
|
+
bestDist = d;
|
|
1378
|
+
best = v;
|
|
1379
|
+
} else if (d < secondDist) secondDist = d;
|
|
1380
|
+
}
|
|
1381
|
+
if (best === void 0 || secondDist - bestDist < HINT_MARGIN) return void 0;
|
|
1382
|
+
return best;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Capture a lineage-based reference to `vertex`: the roles of the ≥3 faces
|
|
1386
|
+
* meeting at it, plus a position hint. Returns undefined when fewer than three
|
|
1387
|
+
* named faces meet there (a 2-face "vertex" is ambiguous — an edge has two).
|
|
1388
|
+
*/
|
|
1389
|
+
function createVertexRef(origin, vertex, shape, roles) {
|
|
1390
|
+
const faces = require_healingFns.facesOfVertex(shape, vertex);
|
|
1391
|
+
if (faces.length < MIN_VERTEX_FACES) return void 0;
|
|
1392
|
+
const roleSet = /* @__PURE__ */ new Set();
|
|
1393
|
+
for (const f of faces) {
|
|
1394
|
+
const role = roleOfFace(f, origin, roles);
|
|
1395
|
+
if (role !== void 0) roleSet.add(role);
|
|
1396
|
+
}
|
|
1397
|
+
if (roleSet.size < MIN_VERTEX_FACES) return void 0;
|
|
1398
|
+
return {
|
|
1399
|
+
origin,
|
|
1400
|
+
faceRoles: [...roleSet].sort(),
|
|
1401
|
+
hint: {
|
|
1402
|
+
entityType: "vertex",
|
|
1403
|
+
position: require_topologyQueryFns.vertexPosition(vertex)
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Resolve a VertexRef in `shape`: gather the current faces of each role, then
|
|
1409
|
+
* return the vertex common to all of them. One common vertex → exact; several →
|
|
1410
|
+
* disambiguate by hint position; none, or a missing role → broken.
|
|
1411
|
+
*/
|
|
1412
|
+
function resolveVertexRef(ref, roles, shape) {
|
|
1413
|
+
const faceSets = [];
|
|
1414
|
+
for (const role of ref.faceRoles) {
|
|
1415
|
+
const faces = facesForRole(shape, ref.origin, role, roles);
|
|
1416
|
+
if (faces.length === 0) return {
|
|
1417
|
+
ref,
|
|
1418
|
+
reason: "not-found"
|
|
1419
|
+
};
|
|
1420
|
+
faceSets.push(faces);
|
|
1421
|
+
}
|
|
1422
|
+
const common = commonVertices(faceSets);
|
|
1423
|
+
if (common.length === 1) {
|
|
1424
|
+
const [only] = common;
|
|
1425
|
+
if (only !== void 0) return {
|
|
1426
|
+
vertex: only,
|
|
1427
|
+
confidence: "exact"
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
if (common.length > 1) {
|
|
1431
|
+
const best = nearestToHint(common, ref.hint);
|
|
1432
|
+
if (best !== void 0) return {
|
|
1433
|
+
vertex: best,
|
|
1434
|
+
confidence: "geometric-fallback"
|
|
1435
|
+
};
|
|
1436
|
+
return {
|
|
1437
|
+
ref,
|
|
1438
|
+
reason: "ambiguous",
|
|
1439
|
+
candidates: common
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
return {
|
|
1443
|
+
ref,
|
|
1444
|
+
reason: "not-found"
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
//#endregion
|
|
1328
1448
|
//#region src/topology/surfaceFns.ts
|
|
1329
1449
|
/**
|
|
1330
1450
|
* Surface creation functions — generate faces from height-map grids.
|
|
@@ -7045,6 +7165,7 @@ exports.createShell = require_shapeTypes.createShell;
|
|
|
7045
7165
|
exports.createSolid = require_shapeTypes.createSolid;
|
|
7046
7166
|
exports.createTaskQueue = require_workerPool.createTaskQueue;
|
|
7047
7167
|
exports.createVertex = require_shapeTypes.createVertex;
|
|
7168
|
+
exports.createVertexRef = createVertexRef;
|
|
7048
7169
|
exports.createWire = require_shapeTypes.createWire;
|
|
7049
7170
|
exports.createWorkerClient = require_workerPool.createWorkerClient;
|
|
7050
7171
|
exports.createWorkerHandler = require_workerPool.createWorkerHandler;
|
|
@@ -7136,6 +7257,7 @@ exports.faceFinder = require_helpers.faceFinder;
|
|
|
7136
7257
|
exports.faceGeomType = require_faceFns.faceGeomType;
|
|
7137
7258
|
exports.faceOrientation = require_faceFns.faceOrientation;
|
|
7138
7259
|
exports.facesOfEdge = require_healingFns.facesOfEdge;
|
|
7260
|
+
exports.facesOfVertex = require_healingFns.facesOfVertex;
|
|
7139
7261
|
exports.fieldBoolean = fieldBoolean;
|
|
7140
7262
|
exports.fieldContour = fieldContour;
|
|
7141
7263
|
exports.fieldOffset = fieldOffset;
|
|
@@ -7421,6 +7543,7 @@ exports.resolveDirection = require_types.resolveDirection;
|
|
|
7421
7543
|
exports.resolveEdgeRef = resolveEdgeRef;
|
|
7422
7544
|
exports.resolvePlane = require_planeOps.resolvePlane;
|
|
7423
7545
|
exports.resolveRef = require_shapeRefFns.resolveRef;
|
|
7546
|
+
exports.resolveVertexRef = resolveVertexRef;
|
|
7424
7547
|
exports.reverseCurve = require_blueprintFns.reverseCurve;
|
|
7425
7548
|
exports.revoluteJoint = require_threadFns.revoluteJoint;
|
|
7426
7549
|
exports.revolve = revolve;
|
|
@@ -7570,6 +7693,7 @@ exports.vertex = require_primitiveFns.vertex;
|
|
|
7570
7693
|
exports.vertexFinder = vertexFinder;
|
|
7571
7694
|
exports.vertexPosition = require_topologyQueryFns.vertexPosition;
|
|
7572
7695
|
exports.verticesOfEdge = require_healingFns.verticesOfEdge;
|
|
7696
|
+
exports.verticesOfFace = require_healingFns.verticesOfFace;
|
|
7573
7697
|
exports.voxelBoolean = voxelBoolean;
|
|
7574
7698
|
exports.voxelBooleanField = voxelBooleanField;
|
|
7575
7699
|
exports.voxelBooleanFieldShapes = voxelBooleanFieldShapes;
|
package/dist/brepjs.js
CHANGED
|
@@ -13,8 +13,8 @@ import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as get
|
|
|
13
13
|
import { a as meshEdges$1, c as meshMultiLOD, d as createMeshCache, i as mesh$1, l as buildMeshCacheKey, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as clearMeshCache } from "./meshFns-DbmidUzH.js";
|
|
14
14
|
import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
|
|
15
15
|
import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-rkE-jE90.js";
|
|
16
|
-
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$
|
|
17
|
-
import { A as edgesOfFace, B as
|
|
16
|
+
import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$3, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-C32wXQWG.js";
|
|
17
|
+
import { A as edgesOfFace, B as toLODGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as verticesOfFace, H as toLineGeometryData, I as wiresOfFace, L as chamferDistAngle, M as facesOfVertex, N as sharedEdges, O as getNurbsSurfaceData, P as verticesOfEdge, R as toBufferGeometryData, S as intersectWithEvolution, T as cutAllBisect, V as toLODGeometryLevels, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toGroupedBufferGeometryData } from "./healingFns-D00TPE9p.js";
|
|
18
18
|
import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-bCOhVQLb.js";
|
|
19
19
|
import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-7rtwqUHZ.js";
|
|
20
20
|
import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-DhJwFrkC.js";
|
|
@@ -1186,6 +1186,28 @@ function withKernelDir(v, fn) {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
//#endregion
|
|
1189
|
+
//#region src/topology/shapeRef/roleLookup.ts
|
|
1190
|
+
/** Euclidean distance between two points. */
|
|
1191
|
+
function distance(a, b) {
|
|
1192
|
+
const dx = a[0] - b[0];
|
|
1193
|
+
const dy = a[1] - b[1];
|
|
1194
|
+
const dz = a[2] - b[2];
|
|
1195
|
+
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1196
|
+
}
|
|
1197
|
+
/** The role whose tracked hashes include this face (reverse lookup). */
|
|
1198
|
+
function roleOfFace(face, origin, roles) {
|
|
1199
|
+
const originRoles = roles.get(origin);
|
|
1200
|
+
if (!originRoles) return void 0;
|
|
1201
|
+
const hash = getHashCode(face);
|
|
1202
|
+
for (const [role, hashes] of originRoles) if (hashes.includes(hash)) return role;
|
|
1203
|
+
}
|
|
1204
|
+
/** Current faces a role resolves to — its tracked successors present in `shape`. */
|
|
1205
|
+
function facesForRole(shape, origin, role, roles) {
|
|
1206
|
+
const hashes = roles.get(origin)?.get(role);
|
|
1207
|
+
if (hashes === void 0 || hashes.length === 0) return [];
|
|
1208
|
+
return getFaces(shape).filter((f) => hashes.includes(getHashCode(f)));
|
|
1209
|
+
}
|
|
1210
|
+
//#endregion
|
|
1189
1211
|
//#region src/topology/shapeRef/edgeRefFns.ts
|
|
1190
1212
|
/** Midpoint of an edge's endpoint vertices (a closed edge collapses to one). */
|
|
1191
1213
|
function endpointMidpoint(verts) {
|
|
@@ -1206,12 +1228,6 @@ function endpointMidpoint(verts) {
|
|
|
1206
1228
|
z / n
|
|
1207
1229
|
];
|
|
1208
1230
|
}
|
|
1209
|
-
function distance(a, b) {
|
|
1210
|
-
const dx = a[0] - b[0];
|
|
1211
|
-
const dy = a[1] - b[1];
|
|
1212
|
-
const dz = a[2] - b[2];
|
|
1213
|
-
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1214
|
-
}
|
|
1215
1231
|
function captureEdgeHint(edge) {
|
|
1216
1232
|
const lengthResult = measureLength(edge);
|
|
1217
1233
|
return {
|
|
@@ -1220,19 +1236,6 @@ function captureEdgeHint(edge) {
|
|
|
1220
1236
|
midpoint: endpointMidpoint(verticesOfEdge(edge))
|
|
1221
1237
|
};
|
|
1222
1238
|
}
|
|
1223
|
-
/** Reverse the role table: the role whose tracked hashes include this face. */
|
|
1224
|
-
function roleOfFace(face, origin, roles) {
|
|
1225
|
-
const originRoles = roles.get(origin);
|
|
1226
|
-
if (!originRoles) return void 0;
|
|
1227
|
-
const hash = getHashCode(face);
|
|
1228
|
-
for (const [role, hashes] of originRoles) if (hashes.includes(hash)) return role;
|
|
1229
|
-
}
|
|
1230
|
-
/** Current faces a role resolves to (its tracked successors present in `shape`). */
|
|
1231
|
-
function facesForRole(shape, origin, role, roles) {
|
|
1232
|
-
const hashes = roles.get(origin)?.get(role);
|
|
1233
|
-
if (hashes === void 0 || hashes.length === 0) return [];
|
|
1234
|
-
return getFaces(shape).filter((f) => hashes.includes(getHashCode(f)));
|
|
1235
|
-
}
|
|
1236
1239
|
function dedupeEdges(edges) {
|
|
1237
1240
|
const seen = /* @__PURE__ */ new Set();
|
|
1238
1241
|
const out = [];
|
|
@@ -1246,7 +1249,7 @@ function dedupeEdges(edges) {
|
|
|
1246
1249
|
return out;
|
|
1247
1250
|
}
|
|
1248
1251
|
/** Hint scores closer than this are treated as indistinguishable (→ ambiguous). */
|
|
1249
|
-
var HINT_MARGIN = 1e-6;
|
|
1252
|
+
var HINT_MARGIN$1 = 1e-6;
|
|
1250
1253
|
/**
|
|
1251
1254
|
* Pick the candidate edge closest to the hint (length + endpoint midpoint).
|
|
1252
1255
|
* Returns undefined when it genuinely can't discriminate — the hint carries no
|
|
@@ -1274,7 +1277,7 @@ function bestByHint(candidates, hint) {
|
|
|
1274
1277
|
best = edge;
|
|
1275
1278
|
} else if (score < secondScore) secondScore = score;
|
|
1276
1279
|
}
|
|
1277
|
-
if (best === void 0 || secondScore - bestScore < HINT_MARGIN) return void 0;
|
|
1280
|
+
if (best === void 0 || secondScore - bestScore < HINT_MARGIN$1) return void 0;
|
|
1278
1281
|
return best;
|
|
1279
1282
|
}
|
|
1280
1283
|
/**
|
|
@@ -1336,6 +1339,123 @@ function resolveEdgeRef(ref, roles, shape) {
|
|
|
1336
1339
|
};
|
|
1337
1340
|
}
|
|
1338
1341
|
//#endregion
|
|
1342
|
+
//#region src/topology/shapeRef/vertexRefFns.ts
|
|
1343
|
+
/** A corner needs at least this many faces to pin a unique point. */
|
|
1344
|
+
var MIN_VERTEX_FACES = 3;
|
|
1345
|
+
/** Hint distances closer than this are indistinguishable (→ ambiguous). */
|
|
1346
|
+
var HINT_MARGIN = 1e-6;
|
|
1347
|
+
/** Hashes of all vertices across `faces`, recording one handle per hash. */
|
|
1348
|
+
function vertexHashes(faces, handles) {
|
|
1349
|
+
const hashes = /* @__PURE__ */ new Set();
|
|
1350
|
+
for (const f of faces) for (const v of verticesOfFace(f)) {
|
|
1351
|
+
const h = getHashCode(v);
|
|
1352
|
+
hashes.add(h);
|
|
1353
|
+
if (!handles.has(h)) handles.set(h, v);
|
|
1354
|
+
}
|
|
1355
|
+
return hashes;
|
|
1356
|
+
}
|
|
1357
|
+
function intersect$2(a, b) {
|
|
1358
|
+
const out = /* @__PURE__ */ new Set();
|
|
1359
|
+
for (const h of a) if (b.has(h)) out.add(h);
|
|
1360
|
+
return out;
|
|
1361
|
+
}
|
|
1362
|
+
/** Vertices present in (a face of) every face-set — the shared corner(s). */
|
|
1363
|
+
function commonVertices(faceSets) {
|
|
1364
|
+
const handles = /* @__PURE__ */ new Map();
|
|
1365
|
+
let common;
|
|
1366
|
+
for (const faces of faceSets) {
|
|
1367
|
+
const hashes = vertexHashes(faces, handles);
|
|
1368
|
+
common = common === void 0 ? hashes : intersect$2(common, hashes);
|
|
1369
|
+
}
|
|
1370
|
+
if (common === void 0) return [];
|
|
1371
|
+
const result = [];
|
|
1372
|
+
for (const h of common) {
|
|
1373
|
+
const v = handles.get(h);
|
|
1374
|
+
if (v !== void 0) result.push(v);
|
|
1375
|
+
}
|
|
1376
|
+
return result;
|
|
1377
|
+
}
|
|
1378
|
+
/** Nearest candidate to the hint position; undefined if no signal or a tie. */
|
|
1379
|
+
function nearestToHint(vertices, hint) {
|
|
1380
|
+
if (hint.position === void 0) return void 0;
|
|
1381
|
+
let best;
|
|
1382
|
+
let bestDist = Infinity;
|
|
1383
|
+
let secondDist = Infinity;
|
|
1384
|
+
for (const v of vertices) {
|
|
1385
|
+
const d = distance(vertexPosition(v), hint.position);
|
|
1386
|
+
if (d < bestDist) {
|
|
1387
|
+
secondDist = bestDist;
|
|
1388
|
+
bestDist = d;
|
|
1389
|
+
best = v;
|
|
1390
|
+
} else if (d < secondDist) secondDist = d;
|
|
1391
|
+
}
|
|
1392
|
+
if (best === void 0 || secondDist - bestDist < HINT_MARGIN) return void 0;
|
|
1393
|
+
return best;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Capture a lineage-based reference to `vertex`: the roles of the ≥3 faces
|
|
1397
|
+
* meeting at it, plus a position hint. Returns undefined when fewer than three
|
|
1398
|
+
* named faces meet there (a 2-face "vertex" is ambiguous — an edge has two).
|
|
1399
|
+
*/
|
|
1400
|
+
function createVertexRef(origin, vertex, shape, roles) {
|
|
1401
|
+
const faces = facesOfVertex(shape, vertex);
|
|
1402
|
+
if (faces.length < MIN_VERTEX_FACES) return void 0;
|
|
1403
|
+
const roleSet = /* @__PURE__ */ new Set();
|
|
1404
|
+
for (const f of faces) {
|
|
1405
|
+
const role = roleOfFace(f, origin, roles);
|
|
1406
|
+
if (role !== void 0) roleSet.add(role);
|
|
1407
|
+
}
|
|
1408
|
+
if (roleSet.size < MIN_VERTEX_FACES) return void 0;
|
|
1409
|
+
return {
|
|
1410
|
+
origin,
|
|
1411
|
+
faceRoles: [...roleSet].sort(),
|
|
1412
|
+
hint: {
|
|
1413
|
+
entityType: "vertex",
|
|
1414
|
+
position: vertexPosition(vertex)
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Resolve a VertexRef in `shape`: gather the current faces of each role, then
|
|
1420
|
+
* return the vertex common to all of them. One common vertex → exact; several →
|
|
1421
|
+
* disambiguate by hint position; none, or a missing role → broken.
|
|
1422
|
+
*/
|
|
1423
|
+
function resolveVertexRef(ref, roles, shape) {
|
|
1424
|
+
const faceSets = [];
|
|
1425
|
+
for (const role of ref.faceRoles) {
|
|
1426
|
+
const faces = facesForRole(shape, ref.origin, role, roles);
|
|
1427
|
+
if (faces.length === 0) return {
|
|
1428
|
+
ref,
|
|
1429
|
+
reason: "not-found"
|
|
1430
|
+
};
|
|
1431
|
+
faceSets.push(faces);
|
|
1432
|
+
}
|
|
1433
|
+
const common = commonVertices(faceSets);
|
|
1434
|
+
if (common.length === 1) {
|
|
1435
|
+
const [only] = common;
|
|
1436
|
+
if (only !== void 0) return {
|
|
1437
|
+
vertex: only,
|
|
1438
|
+
confidence: "exact"
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
if (common.length > 1) {
|
|
1442
|
+
const best = nearestToHint(common, ref.hint);
|
|
1443
|
+
if (best !== void 0) return {
|
|
1444
|
+
vertex: best,
|
|
1445
|
+
confidence: "geometric-fallback"
|
|
1446
|
+
};
|
|
1447
|
+
return {
|
|
1448
|
+
ref,
|
|
1449
|
+
reason: "ambiguous",
|
|
1450
|
+
candidates: common
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
return {
|
|
1454
|
+
ref,
|
|
1455
|
+
reason: "not-found"
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1339
1459
|
//#region src/topology/surfaceFns.ts
|
|
1340
1460
|
/**
|
|
1341
1461
|
* Surface creation functions — generate faces from height-map grids.
|
|
@@ -3664,7 +3784,7 @@ function cutAll(base, tools, options) {
|
|
|
3664
3784
|
}
|
|
3665
3785
|
/** Compute the intersection of two shapes (boolean common). */
|
|
3666
3786
|
function intersect(a, b, options) {
|
|
3667
|
-
return intersect$
|
|
3787
|
+
return intersect$3(resolve(a), resolve(b), {
|
|
3668
3788
|
...options,
|
|
3669
3789
|
unsafe: true
|
|
3670
3790
|
});
|
|
@@ -5781,7 +5901,7 @@ function evalIntersect(node, ctx) {
|
|
|
5781
5901
|
if (!a.ok) return a;
|
|
5782
5902
|
const b = resolveOperand(ctx, node.b, "Intersect.b");
|
|
5783
5903
|
if (!b.ok) return b;
|
|
5784
|
-
return intersect$
|
|
5904
|
+
return intersect$3(a.value, b.value, boolOptions(node, ctx));
|
|
5785
5905
|
}
|
|
5786
5906
|
function resolveAll(ctx, nodes, where) {
|
|
5787
5907
|
const out = [];
|
|
@@ -6936,4 +7056,4 @@ var csg_exports = /* @__PURE__ */ __exportAll({
|
|
|
6936
7056
|
withEvaluator: () => withEvaluator
|
|
6937
7057
|
});
|
|
6938
7058
|
//#endregion
|
|
6939
|
-
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createEdgeRef, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isBatchRequest, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshLODsProgressive, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolveEdgeRef, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
7059
|
+
export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createEdgeRef, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createVertexRef, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, facesOfVertex, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isBatchRequest, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshLODsProgressive, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolveEdgeRef, resolvePlane, resolveRef, resolveVertexRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, verticesOfFace, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
|
|
@@ -220,6 +220,30 @@ function getEdgeToFacesMap(parent) {
|
|
|
220
220
|
return edgeToFaces;
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
|
+
* Build or retrieve the cached vertex→faces adjacency map for a parent shape —
|
|
224
|
+
* the vertex analogue of {@link getEdgeToFacesMap}.
|
|
225
|
+
*/
|
|
226
|
+
function getVertexToFacesMap(parent) {
|
|
227
|
+
const cache = getOrCreateCache(parent);
|
|
228
|
+
if (cache.vertexToFaces) return cache.vertexToFaces;
|
|
229
|
+
const kernel = getKernel();
|
|
230
|
+
const vertexToFaces = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const f of kernel.iterShapes(parent.wrapped, "face")) for (const v of kernel.iterShapes(f, "vertex")) {
|
|
232
|
+
const hash = kernel.hashCode(v, HASH_CODE_MAX);
|
|
233
|
+
let bucket = vertexToFaces.get(hash);
|
|
234
|
+
if (!bucket) {
|
|
235
|
+
bucket = [];
|
|
236
|
+
vertexToFaces.set(hash, bucket);
|
|
237
|
+
}
|
|
238
|
+
if (!bucket.some((entry) => kernel.isSame(entry.vertex, v) && kernel.isSame(entry.face, f))) bucket.push({
|
|
239
|
+
vertex: v,
|
|
240
|
+
face: f
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
cache.vertexToFaces = vertexToFaces;
|
|
244
|
+
return vertexToFaces;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
223
247
|
* Get all faces adjacent to a given edge within a parent shape.
|
|
224
248
|
*
|
|
225
249
|
* An edge typically borders exactly two faces in a solid, or one face
|
|
@@ -251,6 +275,35 @@ function facesOfEdge(parent, edge) {
|
|
|
251
275
|
return wrapAll(results, "face");
|
|
252
276
|
}
|
|
253
277
|
/**
|
|
278
|
+
* Get all faces meeting at a vertex (≥3 for a solid corner, fewer on a
|
|
279
|
+
* boundary), via the cached vertex→faces map. The vertex equivalent of
|
|
280
|
+
* {@link facesOfEdge}, with the same hash-bucket + isSame verification.
|
|
281
|
+
*
|
|
282
|
+
* @param parent - The parent shape to search within.
|
|
283
|
+
* @param vertex - The vertex whose adjacent faces to find.
|
|
284
|
+
*/
|
|
285
|
+
function facesOfVertex(parent, vertex) {
|
|
286
|
+
const kernel = getKernel();
|
|
287
|
+
const vertexToFaces = getVertexToFacesMap(parent);
|
|
288
|
+
const hash = kernel.hashCode(vertex.wrapped, HASH_CODE_MAX);
|
|
289
|
+
const bucket = vertexToFaces.get(hash) ?? [];
|
|
290
|
+
const results = [];
|
|
291
|
+
const seen = /* @__PURE__ */ new Map();
|
|
292
|
+
for (const entry of bucket) {
|
|
293
|
+
if (!kernel.isSame(entry.vertex, vertex.wrapped)) continue;
|
|
294
|
+
const fHash = kernel.hashCode(entry.face, HASH_CODE_MAX);
|
|
295
|
+
const fBucket = seen.get(fHash);
|
|
296
|
+
if (!fBucket) {
|
|
297
|
+
seen.set(fHash, [entry.face]);
|
|
298
|
+
results.push(entry.face);
|
|
299
|
+
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
300
|
+
fBucket.push(entry.face);
|
|
301
|
+
results.push(entry.face);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return wrapAll(results, "face");
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
254
307
|
* Get all edges bounding a face.
|
|
255
308
|
*
|
|
256
309
|
* @param face - The face whose edges to enumerate.
|
|
@@ -260,6 +313,14 @@ function edgesOfFace(face) {
|
|
|
260
313
|
return deduplicatedSubShapes(face.wrapped, "edge");
|
|
261
314
|
}
|
|
262
315
|
/**
|
|
316
|
+
* Get all vertices of a face. The vertex equivalent of {@link edgesOfFace}.
|
|
317
|
+
*
|
|
318
|
+
* @param face - The face whose vertices to enumerate.
|
|
319
|
+
*/
|
|
320
|
+
function verticesOfFace(face) {
|
|
321
|
+
return deduplicatedSubShapes(face.wrapped, "vertex");
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
263
324
|
* Get all wires of a face (outer wire + inner hole wires).
|
|
264
325
|
* All wires bounding a face are closed by definition.
|
|
265
326
|
*
|
|
@@ -1376,4 +1437,4 @@ function fixSelfIntersection(wire) {
|
|
|
1376
1437
|
}
|
|
1377
1438
|
}
|
|
1378
1439
|
//#endregion
|
|
1379
|
-
export { edgesOfFace as A,
|
|
1440
|
+
export { edgesOfFace as A, toLODGeometryData as B, shellWithEvolution as C, getNurbsCurveData as D, fuseAllBisect as E, verticesOfFace as F, toLineGeometryData as H, wiresOfFace as I, chamferDistAngle as L, facesOfVertex as M, sharedEdges as N, getNurbsSurfaceData as O, verticesOfEdge as P, toBufferGeometryData as R, intersectWithEvolution as S, cutAllBisect as T, toLODGeometryLevels as V, positionOnCurve as _, healFace as a, filletWithEvolution as b, isValid as c, draft as d, fillet as f, variableFillet as g, thicken as h, heal as i, facesOfEdge as j, adjacentFaces as k, solidFromShell as l, shell as m, fixSelfIntersection as n, healSolid as o, offset as p, fixShape as r, healWire as s, autoHeal as t, chamfer as u, chamferWithEvolution as v, checkBoolean as w, fuseWithEvolution as x, cutWithEvolution as y, toGroupedBufferGeometryData as z };
|
|
@@ -220,6 +220,30 @@ function getEdgeToFacesMap(parent) {
|
|
|
220
220
|
return edgeToFaces;
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
|
+
* Build or retrieve the cached vertex→faces adjacency map for a parent shape —
|
|
224
|
+
* the vertex analogue of {@link getEdgeToFacesMap}.
|
|
225
|
+
*/
|
|
226
|
+
function getVertexToFacesMap(parent) {
|
|
227
|
+
const cache = require_topologyQueryFns.getOrCreateCache(parent);
|
|
228
|
+
if (cache.vertexToFaces) return cache.vertexToFaces;
|
|
229
|
+
const kernel = require_shapeTypes.getKernel();
|
|
230
|
+
const vertexToFaces = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const f of kernel.iterShapes(parent.wrapped, "face")) for (const v of kernel.iterShapes(f, "vertex")) {
|
|
232
|
+
const hash = kernel.hashCode(v, require_constants.HASH_CODE_MAX);
|
|
233
|
+
let bucket = vertexToFaces.get(hash);
|
|
234
|
+
if (!bucket) {
|
|
235
|
+
bucket = [];
|
|
236
|
+
vertexToFaces.set(hash, bucket);
|
|
237
|
+
}
|
|
238
|
+
if (!bucket.some((entry) => kernel.isSame(entry.vertex, v) && kernel.isSame(entry.face, f))) bucket.push({
|
|
239
|
+
vertex: v,
|
|
240
|
+
face: f
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
cache.vertexToFaces = vertexToFaces;
|
|
244
|
+
return vertexToFaces;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
223
247
|
* Get all faces adjacent to a given edge within a parent shape.
|
|
224
248
|
*
|
|
225
249
|
* An edge typically borders exactly two faces in a solid, or one face
|
|
@@ -251,6 +275,35 @@ function facesOfEdge(parent, edge) {
|
|
|
251
275
|
return wrapAll(results, "face");
|
|
252
276
|
}
|
|
253
277
|
/**
|
|
278
|
+
* Get all faces meeting at a vertex (≥3 for a solid corner, fewer on a
|
|
279
|
+
* boundary), via the cached vertex→faces map. The vertex equivalent of
|
|
280
|
+
* {@link facesOfEdge}, with the same hash-bucket + isSame verification.
|
|
281
|
+
*
|
|
282
|
+
* @param parent - The parent shape to search within.
|
|
283
|
+
* @param vertex - The vertex whose adjacent faces to find.
|
|
284
|
+
*/
|
|
285
|
+
function facesOfVertex(parent, vertex) {
|
|
286
|
+
const kernel = require_shapeTypes.getKernel();
|
|
287
|
+
const vertexToFaces = getVertexToFacesMap(parent);
|
|
288
|
+
const hash = kernel.hashCode(vertex.wrapped, require_constants.HASH_CODE_MAX);
|
|
289
|
+
const bucket = vertexToFaces.get(hash) ?? [];
|
|
290
|
+
const results = [];
|
|
291
|
+
const seen = /* @__PURE__ */ new Map();
|
|
292
|
+
for (const entry of bucket) {
|
|
293
|
+
if (!kernel.isSame(entry.vertex, vertex.wrapped)) continue;
|
|
294
|
+
const fHash = kernel.hashCode(entry.face, require_constants.HASH_CODE_MAX);
|
|
295
|
+
const fBucket = seen.get(fHash);
|
|
296
|
+
if (!fBucket) {
|
|
297
|
+
seen.set(fHash, [entry.face]);
|
|
298
|
+
results.push(entry.face);
|
|
299
|
+
} else if (!fBucket.some((r) => kernel.isSame(r, entry.face))) {
|
|
300
|
+
fBucket.push(entry.face);
|
|
301
|
+
results.push(entry.face);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return wrapAll(results, "face");
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
254
307
|
* Get all edges bounding a face.
|
|
255
308
|
*
|
|
256
309
|
* @param face - The face whose edges to enumerate.
|
|
@@ -260,6 +313,14 @@ function edgesOfFace(face) {
|
|
|
260
313
|
return deduplicatedSubShapes(face.wrapped, "edge");
|
|
261
314
|
}
|
|
262
315
|
/**
|
|
316
|
+
* Get all vertices of a face. The vertex equivalent of {@link edgesOfFace}.
|
|
317
|
+
*
|
|
318
|
+
* @param face - The face whose vertices to enumerate.
|
|
319
|
+
*/
|
|
320
|
+
function verticesOfFace(face) {
|
|
321
|
+
return deduplicatedSubShapes(face.wrapped, "vertex");
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
263
324
|
* Get all wires of a face (outer wire + inner hole wires).
|
|
264
325
|
* All wires bounding a face are closed by definition.
|
|
265
326
|
*
|
|
@@ -1442,6 +1503,12 @@ Object.defineProperty(exports, "facesOfEdge", {
|
|
|
1442
1503
|
return facesOfEdge;
|
|
1443
1504
|
}
|
|
1444
1505
|
});
|
|
1506
|
+
Object.defineProperty(exports, "facesOfVertex", {
|
|
1507
|
+
enumerable: true,
|
|
1508
|
+
get: function() {
|
|
1509
|
+
return facesOfVertex;
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1445
1512
|
Object.defineProperty(exports, "fillet", {
|
|
1446
1513
|
enumerable: true,
|
|
1447
1514
|
get: function() {
|
|
@@ -1610,6 +1677,12 @@ Object.defineProperty(exports, "verticesOfEdge", {
|
|
|
1610
1677
|
return verticesOfEdge;
|
|
1611
1678
|
}
|
|
1612
1679
|
});
|
|
1680
|
+
Object.defineProperty(exports, "verticesOfFace", {
|
|
1681
|
+
enumerable: true,
|
|
1682
|
+
get: function() {
|
|
1683
|
+
return verticesOfFace;
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1613
1686
|
Object.defineProperty(exports, "wiresOfFace", {
|
|
1614
1687
|
enumerable: true,
|
|
1615
1688
|
get: function() {
|
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export { tagFaces, findFacesByTag, getFaceTags, setTagMetadata, getTagMetadata,
|
|
|
87
87
|
export { colorFaces, colorShape, getFaceColor, getShapeColor, } from './topology/metadata/colorFns.js';
|
|
88
88
|
export type { Color, ColorInput } from './topology/metadata/colorFns.js';
|
|
89
89
|
export { chamferDistAngle as chamferDistAngleShape } from './topology/chamferAngleFns.js';
|
|
90
|
-
export { facesOfEdge, edgesOfFace, wiresOfFace, verticesOfEdge, adjacentFaces, sharedEdges, } from './topology/adjacencyFns.js';
|
|
90
|
+
export { facesOfEdge, edgesOfFace, wiresOfFace, verticesOfEdge, verticesOfFace, facesOfVertex, adjacentFaces, sharedEdges, } from './topology/adjacencyFns.js';
|
|
91
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';
|
|
@@ -102,8 +102,8 @@ export { checkBoolean } from './topology/booleanDiagnosticFns.js';
|
|
|
102
102
|
export type { CheckBooleanResult, BooleanIssue, BooleanOpType, BooleanDiagnostics, } from './kernel/types.js';
|
|
103
103
|
export { fuseWithEvolution, cutWithEvolution, intersectWithEvolution, filletWithEvolution, chamferWithEvolution, shellWithEvolution, type EvolutionResult, } from './topology/evolutionFns.js';
|
|
104
104
|
export type { ShapeEvolution } from './kernel/types.js';
|
|
105
|
-
export { captureHint, assignRoles, createRef, updateRoles, resolveRef, defaultScorer, createEdgeRef, resolveEdgeRef, } from './topology/shapeRef/index.js';
|
|
106
|
-
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, FaceScorer, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, } from './topology/shapeRef/index.js';
|
|
105
|
+
export { captureHint, assignRoles, createRef, updateRoles, resolveRef, defaultScorer, createEdgeRef, resolveEdgeRef, createVertexRef, resolveVertexRef, } from './topology/shapeRef/index.js';
|
|
106
|
+
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, FaceScorer, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, VertexHint, VertexRef, ResolvedVertexRef, BrokenVertexRef, } from './topology/shapeRef/index.js';
|
|
107
107
|
export { surfaceFromGrid, surfaceFromImage, type SurfaceFromGridOptions, type SurfaceFromImageOptions, } from './topology/surfaceFns.js';
|
|
108
108
|
export { hull, type HullOptions } from './topology/hullFns.js';
|
|
109
109
|
export { convexHull } from './operations/convexHullFns.js';
|
|
@@ -10,6 +10,15 @@ import { AnyShape, ClosedWire, Dimension, Edge, Face, Vertex } from '../core/sha
|
|
|
10
10
|
* @returns Array of unique faces containing the given edge.
|
|
11
11
|
*/
|
|
12
12
|
export declare function facesOfEdge<D extends Dimension>(parent: AnyShape<D>, edge: Edge<D>): Face<D>[];
|
|
13
|
+
/**
|
|
14
|
+
* Get all faces meeting at a vertex (≥3 for a solid corner, fewer on a
|
|
15
|
+
* boundary), via the cached vertex→faces map. The vertex equivalent of
|
|
16
|
+
* {@link facesOfEdge}, with the same hash-bucket + isSame verification.
|
|
17
|
+
*
|
|
18
|
+
* @param parent - The parent shape to search within.
|
|
19
|
+
* @param vertex - The vertex whose adjacent faces to find.
|
|
20
|
+
*/
|
|
21
|
+
export declare function facesOfVertex<D extends Dimension>(parent: AnyShape<D>, vertex: Vertex<D>): Face<D>[];
|
|
13
22
|
/**
|
|
14
23
|
* Get all edges bounding a face.
|
|
15
24
|
*
|
|
@@ -17,6 +26,12 @@ export declare function facesOfEdge<D extends Dimension>(parent: AnyShape<D>, ed
|
|
|
17
26
|
* @returns Array of unique edges forming the face boundary.
|
|
18
27
|
*/
|
|
19
28
|
export declare function edgesOfFace<D extends Dimension>(face: Face<D>): Edge<D>[];
|
|
29
|
+
/**
|
|
30
|
+
* Get all vertices of a face. The vertex equivalent of {@link edgesOfFace}.
|
|
31
|
+
*
|
|
32
|
+
* @param face - The face whose vertices to enumerate.
|
|
33
|
+
*/
|
|
34
|
+
export declare function verticesOfFace<D extends Dimension>(face: Face<D>): Vertex<D>[];
|
|
20
35
|
/**
|
|
21
36
|
* Get all wires of a face (outer wire + inner hole wires).
|
|
22
37
|
* All wires bounding a face are closed by definition.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ShapeRef — stable, serializable face references for parametric replay.
|
|
3
3
|
*/
|
|
4
|
-
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, } from './shapeRefTypes.js';
|
|
4
|
+
export type { GeometricHint, ShapeRef, RoleTable, ResolvedRef, BrokenRef, EdgeHint, EdgeRef, ResolvedEdgeRef, BrokenEdgeRef, VertexHint, VertexRef, ResolvedVertexRef, BrokenVertexRef, } from './shapeRefTypes.js';
|
|
5
5
|
export { type FaceScorer, defaultScorer } from './scoring.js';
|
|
6
6
|
export { captureHint, assignRoles, createRef, updateRoles, resolveRef } from './shapeRefFns.js';
|
|
7
7
|
export { createEdgeRef, resolveEdgeRef } from './edgeRefFns.js';
|
|
8
|
+
export { createVertexRef, resolveVertexRef } from './vertexRefFns.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Face, Shape3D } from '../../core/shapeTypes.js';
|
|
2
|
+
import { Vec3 } from '../../core/types.js';
|
|
3
|
+
import { RoleTable } from './shapeRefTypes.js';
|
|
4
|
+
/** Euclidean distance between two points. */
|
|
5
|
+
export declare function distance(a: Vec3, b: Vec3): number;
|
|
6
|
+
/** The role whose tracked hashes include this face (reverse lookup). */
|
|
7
|
+
export declare function roleOfFace(face: Face, origin: string, roles: RoleTable): string | undefined;
|
|
8
|
+
/** Current faces a role resolves to — its tracked successors present in `shape`. */
|
|
9
|
+
export declare function facesForRole(shape: Shape3D, origin: string, role: string, roles: RoleTable): Face[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vec3 } from '../../core/types.js';
|
|
2
2
|
import { SurfaceType } from '../faceFns.js';
|
|
3
|
-
import { Face, Edge } from '../../core/shapeTypes.js';
|
|
3
|
+
import { Face, Edge, Vertex } from '../../core/shapeTypes.js';
|
|
4
4
|
/** Geometric snapshot of a face, used for fallback matching when hashes change. */
|
|
5
5
|
export interface GeometricHint {
|
|
6
6
|
readonly entityType: 'face';
|
|
@@ -76,3 +76,31 @@ export interface BrokenEdgeRef {
|
|
|
76
76
|
readonly reason: 'ambiguous' | 'not-found';
|
|
77
77
|
readonly candidates?: readonly Edge[];
|
|
78
78
|
}
|
|
79
|
+
/** Geometric snapshot of a vertex — a tiebreaker when several candidates survive. */
|
|
80
|
+
export interface VertexHint {
|
|
81
|
+
readonly entityType: 'vertex';
|
|
82
|
+
readonly position?: Vec3 | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A stable reference to a vertex, identified by the roles of the faces meeting
|
|
86
|
+
* at it. A solid corner is where **≥3** faces meet at a point; two faces meet
|
|
87
|
+
* along an *edge* (two endpoints → ambiguous), so a vertex needs ≥3 face-roles.
|
|
88
|
+
* Resolves by finding the vertex common to those roles' current faces.
|
|
89
|
+
*/
|
|
90
|
+
export interface VertexRef {
|
|
91
|
+
readonly origin: string;
|
|
92
|
+
/** Roles of the ≥3 faces meeting at this vertex (sorted). */
|
|
93
|
+
readonly faceRoles: readonly string[];
|
|
94
|
+
readonly hint: VertexHint;
|
|
95
|
+
}
|
|
96
|
+
/** A successfully resolved vertex reference. */
|
|
97
|
+
export interface ResolvedVertexRef {
|
|
98
|
+
readonly vertex: Vertex;
|
|
99
|
+
readonly confidence: 'exact' | 'geometric-fallback';
|
|
100
|
+
}
|
|
101
|
+
/** A vertex reference that could not be resolved. */
|
|
102
|
+
export interface BrokenVertexRef {
|
|
103
|
+
readonly ref: VertexRef;
|
|
104
|
+
readonly reason: 'ambiguous' | 'not-found';
|
|
105
|
+
readonly candidates?: readonly Vertex[];
|
|
106
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Shape3D, Vertex } from '../../core/shapeTypes.js';
|
|
2
|
+
import { VertexRef, ResolvedVertexRef, BrokenVertexRef, RoleTable } from './shapeRefTypes.js';
|
|
3
|
+
/**
|
|
4
|
+
* Capture a lineage-based reference to `vertex`: the roles of the ≥3 faces
|
|
5
|
+
* meeting at it, plus a position hint. Returns undefined when fewer than three
|
|
6
|
+
* named faces meet there (a 2-face "vertex" is ambiguous — an edge has two).
|
|
7
|
+
*/
|
|
8
|
+
export declare function createVertexRef(origin: string, vertex: Vertex, shape: Shape3D, roles: RoleTable): VertexRef | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a VertexRef in `shape`: gather the current faces of each role, then
|
|
11
|
+
* return the vertex common to all of them. One common vertex → exact; several →
|
|
12
|
+
* disambiguate by hint position; none, or a missing role → broken.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveVertexRef(ref: VertexRef, roles: RoleTable, shape: Shape3D): ResolvedVertexRef | BrokenVertexRef;
|
|
@@ -20,6 +20,11 @@ export interface TopoCacheEntry {
|
|
|
20
20
|
edge: KernelShape;
|
|
21
21
|
face: KernelShape;
|
|
22
22
|
}>>;
|
|
23
|
+
/** Vertex hash → vertex-face pairs — the vertex analogue of {@link edgeToFaces}. */
|
|
24
|
+
vertexToFaces?: Map<number, Array<{
|
|
25
|
+
vertex: KernelShape;
|
|
26
|
+
face: KernelShape;
|
|
27
|
+
}>>;
|
|
23
28
|
}
|
|
24
29
|
/** @internal Get or create a cache entry for a shape. Used by originTrackingFns. */
|
|
25
30
|
export declare function getOrCreateCache(shape: AnyShape<Dimension>): TopoCacheEntry;
|
package/dist/topology.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const require_shapeFns = require("./shapeFns-ybo0INGL.cjs");
|
|
|
5
5
|
const require_curveFns = require("./curveFns-DgUJpH4z.cjs");
|
|
6
6
|
const require_meshFns = require("./meshFns-1hQSn1p2.cjs");
|
|
7
7
|
const require_solidBuilders = require("./solidBuilders-DiUv_mD0.cjs");
|
|
8
|
-
const require_healingFns = require("./healingFns-
|
|
8
|
+
const require_healingFns = require("./healingFns-x1sHV-HO.cjs");
|
|
9
9
|
const require_primitiveFns = require("./primitiveFns-DLIWtQWA.cjs");
|
|
10
10
|
exports.addHoles = require_primitiveFns.addHoles;
|
|
11
11
|
exports.adjacentFaces = require_healingFns.adjacentFaces;
|
package/dist/topology.js
CHANGED
|
@@ -4,6 +4,6 @@ import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFn
|
|
|
4
4
|
import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-CcSn4-Rf.js";
|
|
5
5
|
import { d as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES, u as clearMeshCache } from "./meshFns-DbmidUzH.js";
|
|
6
6
|
import { h as fuseAll, p as cutAll } from "./solidBuilders-C32wXQWG.js";
|
|
7
|
-
import { A as edgesOfFace,
|
|
7
|
+
import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, H as toLineGeometryData, I as wiresOfFace, L as chamferDistAngle, N as sharedEdges, O as getNurbsSurfaceData, P as verticesOfEdge, R as toBufferGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toGroupedBufferGeometryData } from "./healingFns-D00TPE9p.js";
|
|
8
8
|
import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-CBrOyk5S.js";
|
|
9
9
|
export { addHoles, adjacentFaces, approximateCurve, asTopo, autoHeal, bezier, box, bsplineApprox, cast, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkBoolean, circle, classifyPointOnFace, clearMeshCache, compound, cone, createMeshCache, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cutAll, cutAllBisect, cutWithEvolution, cylinder, fromBREP as deserializeShape, downcast, edgesOfFace, ellipse, ellipseArc, ellipsoid, exportIGES, exportSTEP, exportSTL, face, faceAxis, faceCenter, faceGeomType, faceOrientation, facesOfEdge, filledFace, filletWithEvolution, fixSelfIntersection, fixShape, flipFaceOrientation, flipOrientation, fuseAll, fuseAllBisect, fuseWithEvolution, getBounds, getCurveType, getEdges, getFaces, getHashCode, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getSurfaceType, getVertices, getWires, healFace, healSolid, healWire, helix, innerWires, interpolateCurve, intersectWithEvolution, invalidateShapeCache, isCompSolid, isEqualShape, isSameShape, iterEdges, iterFaces, iterTopo, iterVertices, iterWires, line, normalAt, offsetFace, offsetWire2D, outerWire, pointOnSurface, polygon, positionOnCurve, projectPointOnFace, sewShells, shapeType, sharedEdges, shellWithEvolution, solid, solidFromShell, sphere, subFace, tangentArc, threePointArc, toBufferGeometryData, toGroupedBufferGeometryData, toLineGeometryData, torus, uvBounds, uvCoordinates, variableFillet, vertex, vertexPosition, verticesOfEdge, wire, wireLoop, wiresOfFace };
|