brepjs 18.113.0 → 18.114.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/adjacencyFns-BYnyXXqt.js +247 -0
- package/dist/adjacencyFns-d8ZabkvX.cjs +294 -0
- package/dist/brepjs.cjs +31 -406
- package/dist/brepjs.js +7 -390
- package/dist/{healingFns-D00TPE9p.js → healingFns-2TJHHDg5.js} +3 -246
- package/dist/{healingFns-x1sHV-HO.cjs → healingFns-xLJ6Cp_O.cjs} +0 -291
- package/dist/index.d.ts +2 -2
- package/dist/refResolveFns-BK5NSDFd.cjs +857 -0
- package/dist/refResolveFns-CayDQeug.js +738 -0
- package/dist/shapeRef.cjs +21 -7
- package/dist/shapeRef.d.ts +10 -2
- package/dist/shapeRef.js +2 -2
- package/dist/topology/shapeRef/index.d.ts +1 -0
- package/dist/topology/shapeRef/refResolveFns.d.ts +53 -0
- package/dist/topology.cjs +8 -7
- package/dist/topology.js +2 -1
- package/package.json +1 -1
- package/dist/shapeRefFns-ChMnsOAF.js +0 -248
- package/dist/shapeRefFns-CuepnFOm.cjs +0 -283
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-xLJ6Cp_O.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");
|
|
@@ -29,7 +29,8 @@ const require_importFns = require("./importFns-CgMQIi0z.cjs");
|
|
|
29
29
|
const require_loftFns = require("./loftFns-fpTmrIdd.cjs");
|
|
30
30
|
const require_cameraFns = require("./cameraFns-uo1sZbBT.cjs");
|
|
31
31
|
const require_textMetrics = require("./textMetrics-IC_IoI7l.cjs");
|
|
32
|
-
const
|
|
32
|
+
const require_adjacencyFns = require("./adjacencyFns-d8ZabkvX.cjs");
|
|
33
|
+
const require_refResolveFns = require("./refResolveFns-BK5NSDFd.cjs");
|
|
33
34
|
const require_workerPool = require("./workerPool-D30NsiIW.cjs");
|
|
34
35
|
const require_primitiveFns = require("./primitiveFns-DLIWtQWA.cjs");
|
|
35
36
|
//#region src/topology/shapeBooleans.ts
|
|
@@ -1175,390 +1176,6 @@ function withKernelDir(v, fn) {
|
|
|
1175
1176
|
}
|
|
1176
1177
|
}
|
|
1177
1178
|
//#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
|
-
/** Mean of a set of vertices' positions (e.g. an edge's endpoints). */
|
|
1187
|
-
function vertexCentroid(verts) {
|
|
1188
|
-
if (verts.length === 0) return void 0;
|
|
1189
|
-
let x = 0;
|
|
1190
|
-
let y = 0;
|
|
1191
|
-
let z = 0;
|
|
1192
|
-
for (const v of verts) {
|
|
1193
|
-
const p = require_topologyQueryFns.vertexPosition(v);
|
|
1194
|
-
x += p[0];
|
|
1195
|
-
y += p[1];
|
|
1196
|
-
z += p[2];
|
|
1197
|
-
}
|
|
1198
|
-
const n = verts.length;
|
|
1199
|
-
return [
|
|
1200
|
-
x / n,
|
|
1201
|
-
y / n,
|
|
1202
|
-
z / n
|
|
1203
|
-
];
|
|
1204
|
-
}
|
|
1205
|
-
/** The role whose tracked hashes include this face (reverse lookup). */
|
|
1206
|
-
function roleOfFace(face, origin, roles) {
|
|
1207
|
-
const originRoles = roles.get(origin);
|
|
1208
|
-
if (!originRoles) return void 0;
|
|
1209
|
-
const hash = require_shapeFns.getHashCode(face);
|
|
1210
|
-
for (const [role, hashes] of originRoles) if (hashes.includes(hash)) return role;
|
|
1211
|
-
}
|
|
1212
|
-
/** Current faces a role resolves to — its tracked successors present in `shape`. */
|
|
1213
|
-
function facesForRole(shape, origin, role, roles) {
|
|
1214
|
-
const hashes = roles.get(origin)?.get(role);
|
|
1215
|
-
if (hashes === void 0 || hashes.length === 0) return [];
|
|
1216
|
-
return require_topologyQueryFns.getFaces(shape).filter((f) => hashes.includes(require_shapeFns.getHashCode(f)));
|
|
1217
|
-
}
|
|
1218
|
-
//#endregion
|
|
1219
|
-
//#region src/topology/shapeRef/edgeRefFns.ts
|
|
1220
|
-
function captureEdgeHint(edge) {
|
|
1221
|
-
const lengthResult = require_measureFns.measureLength(edge);
|
|
1222
|
-
return {
|
|
1223
|
-
entityType: "edge",
|
|
1224
|
-
length: lengthResult.ok ? lengthResult.value : void 0,
|
|
1225
|
-
midpoint: vertexCentroid(require_healingFns.verticesOfEdge(edge))
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
function dedupeEdges(edges) {
|
|
1229
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1230
|
-
const out = [];
|
|
1231
|
-
for (const e of edges) {
|
|
1232
|
-
const h = require_shapeFns.getHashCode(e);
|
|
1233
|
-
if (!seen.has(h)) {
|
|
1234
|
-
seen.add(h);
|
|
1235
|
-
out.push(e);
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
return out;
|
|
1239
|
-
}
|
|
1240
|
-
/** Hint scores closer than this are treated as indistinguishable (→ ambiguous). */
|
|
1241
|
-
var HINT_MARGIN$2 = 1e-6;
|
|
1242
|
-
/**
|
|
1243
|
-
* Pick the candidate edge closest to the hint (length + endpoint midpoint).
|
|
1244
|
-
* Returns undefined when it genuinely can't discriminate — the hint carries no
|
|
1245
|
-
* signal, or the two best candidates score within {@link HINT_MARGIN} — so the
|
|
1246
|
-
* caller can report `ambiguous` rather than committing to an arbitrary edge.
|
|
1247
|
-
*/
|
|
1248
|
-
function bestByHint(candidates, hint) {
|
|
1249
|
-
if (hint.length === void 0 && hint.midpoint === void 0) return void 0;
|
|
1250
|
-
let best;
|
|
1251
|
-
let bestScore = Infinity;
|
|
1252
|
-
let secondScore = Infinity;
|
|
1253
|
-
for (const edge of candidates) {
|
|
1254
|
-
let score = 0;
|
|
1255
|
-
if (hint.length !== void 0) {
|
|
1256
|
-
const len = require_measureFns.measureLength(edge);
|
|
1257
|
-
if (len.ok) score += Math.abs(len.value - hint.length);
|
|
1258
|
-
}
|
|
1259
|
-
if (hint.midpoint !== void 0) {
|
|
1260
|
-
const mid = vertexCentroid(require_healingFns.verticesOfEdge(edge));
|
|
1261
|
-
if (mid !== void 0) score += distance(hint.midpoint, mid);
|
|
1262
|
-
}
|
|
1263
|
-
if (score < bestScore) {
|
|
1264
|
-
secondScore = bestScore;
|
|
1265
|
-
bestScore = score;
|
|
1266
|
-
best = edge;
|
|
1267
|
-
} else if (score < secondScore) secondScore = score;
|
|
1268
|
-
}
|
|
1269
|
-
if (best === void 0 || secondScore - bestScore < HINT_MARGIN$2) return void 0;
|
|
1270
|
-
return best;
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Capture a lineage-based reference to `edge`: its two adjacent faces' roles
|
|
1274
|
-
* plus a geometric hint. Returns undefined when the edge doesn't bound two faces
|
|
1275
|
-
* (a boundary/degenerate edge) or when either bounding face has no role yet.
|
|
1276
|
-
*/
|
|
1277
|
-
function createEdgeRef(origin, edge, shape, roles) {
|
|
1278
|
-
const [faceA, faceB] = require_healingFns.facesOfEdge(shape, edge);
|
|
1279
|
-
if (faceA === void 0 || faceB === void 0) return void 0;
|
|
1280
|
-
const roleA = roleOfFace(faceA, origin, roles);
|
|
1281
|
-
const roleB = roleOfFace(faceB, origin, roles);
|
|
1282
|
-
if (roleA === void 0 || roleB === void 0) return void 0;
|
|
1283
|
-
return {
|
|
1284
|
-
origin,
|
|
1285
|
-
faceRoles: [roleA, roleB],
|
|
1286
|
-
hint: captureEdgeHint(edge)
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* Resolve an EdgeRef in `shape`: resolve its two face-roles to current faces,
|
|
1291
|
-
* then return the edge they share. One shared edge → exact; several (the two
|
|
1292
|
-
* faces meet along more than one edge) → disambiguate by hint; none, or a
|
|
1293
|
-
* missing bounding face → broken.
|
|
1294
|
-
*/
|
|
1295
|
-
function resolveEdgeRef(ref, roles, shape) {
|
|
1296
|
-
const [roleA, roleB] = ref.faceRoles;
|
|
1297
|
-
const facesA = facesForRole(shape, ref.origin, roleA, roles);
|
|
1298
|
-
const facesB = facesForRole(shape, ref.origin, roleB, roles);
|
|
1299
|
-
if (facesA.length === 0 || facesB.length === 0) return {
|
|
1300
|
-
ref,
|
|
1301
|
-
reason: "not-found"
|
|
1302
|
-
};
|
|
1303
|
-
const candidates = [];
|
|
1304
|
-
for (const a of facesA) for (const b of facesB) candidates.push(...require_healingFns.sharedEdges(a, b));
|
|
1305
|
-
const unique = dedupeEdges(candidates);
|
|
1306
|
-
if (unique.length === 1) {
|
|
1307
|
-
const [only] = unique;
|
|
1308
|
-
if (only !== void 0) return {
|
|
1309
|
-
edge: only,
|
|
1310
|
-
confidence: "exact"
|
|
1311
|
-
};
|
|
1312
|
-
}
|
|
1313
|
-
if (unique.length > 1) {
|
|
1314
|
-
const best = bestByHint(unique, ref.hint);
|
|
1315
|
-
if (best !== void 0) return {
|
|
1316
|
-
edge: best,
|
|
1317
|
-
confidence: "geometric-fallback"
|
|
1318
|
-
};
|
|
1319
|
-
return {
|
|
1320
|
-
ref,
|
|
1321
|
-
reason: "ambiguous",
|
|
1322
|
-
candidates: unique
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
return {
|
|
1326
|
-
ref,
|
|
1327
|
-
reason: "not-found"
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
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$1 = 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$1) 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
|
|
1448
|
-
//#region src/topology/shapeRef/derivedFaceRefFns.ts
|
|
1449
|
-
/** A face re-derives a bridged face when its normal is nearly identical. */
|
|
1450
|
-
var NORMAL_MATCH = .99;
|
|
1451
|
-
/** A generated face's normal has a positive component along BOTH bridged normals. */
|
|
1452
|
-
var BLEND_THRESHOLD = .1;
|
|
1453
|
-
/** Tiebreak distances closer than this are indistinguishable (→ ambiguous). */
|
|
1454
|
-
var HINT_MARGIN = 1e-6;
|
|
1455
|
-
function normalDot(a, b) {
|
|
1456
|
-
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
1457
|
-
}
|
|
1458
|
-
/** Faces whose outward normal nearly matches `normal` (re-derives a bridged face). */
|
|
1459
|
-
function facesByNormal(shape, normal) {
|
|
1460
|
-
return require_topologyQueryFns.getFaces(shape).filter((f) => normalDot(require_faceFns.normalAt(f), normal) > NORMAL_MATCH);
|
|
1461
|
-
}
|
|
1462
|
-
/**
|
|
1463
|
-
* Faces adjacent to BOTH face sets, excluding the sets themselves. Uses the
|
|
1464
|
-
* cached edge→faces adjacency (`adjacentFaces`) rather than an O(F·N) per-pair
|
|
1465
|
-
* `sharedEdges` scan.
|
|
1466
|
-
*/
|
|
1467
|
-
function betweenFaces(shape, aFaces, bFaces) {
|
|
1468
|
-
const exclude = new Set([...aFaces, ...bFaces].map(require_shapeFns.getHashCode));
|
|
1469
|
-
const adjacentToA = /* @__PURE__ */ new Set();
|
|
1470
|
-
for (const a of aFaces) for (const f of require_healingFns.adjacentFaces(shape, a)) adjacentToA.add(require_shapeFns.getHashCode(f));
|
|
1471
|
-
const result = [];
|
|
1472
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1473
|
-
for (const b of bFaces) for (const f of require_healingFns.adjacentFaces(shape, b)) {
|
|
1474
|
-
const h = require_shapeFns.getHashCode(f);
|
|
1475
|
-
if (exclude.has(h) || seen.has(h) || !adjacentToA.has(h)) continue;
|
|
1476
|
-
seen.add(h);
|
|
1477
|
-
result.push(f);
|
|
1478
|
-
}
|
|
1479
|
-
return result;
|
|
1480
|
-
}
|
|
1481
|
-
/** Face whose center is nearest `point`; undefined on a tie (→ ambiguous). */
|
|
1482
|
-
function nearestFace(faces, point) {
|
|
1483
|
-
let best;
|
|
1484
|
-
let bestDist = Infinity;
|
|
1485
|
-
let secondDist = Infinity;
|
|
1486
|
-
for (const f of faces) {
|
|
1487
|
-
const d = distance(require_faceFns.faceCenter(f), point);
|
|
1488
|
-
if (d < bestDist) {
|
|
1489
|
-
secondDist = bestDist;
|
|
1490
|
-
bestDist = d;
|
|
1491
|
-
best = f;
|
|
1492
|
-
} else if (d < secondDist) secondDist = d;
|
|
1493
|
-
}
|
|
1494
|
-
if (best === void 0 || secondDist - bestDist < HINT_MARGIN) return void 0;
|
|
1495
|
-
return best;
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Capture a reference to the face an `op` (fillet/chamfer) will generate across
|
|
1499
|
-
* `edge`: the roles of the edge's two faces, their outward normals, and the edge
|
|
1500
|
-
* midpoint. Call this on the PRE-op shape. Returns undefined when the edge
|
|
1501
|
-
* doesn't bound two named faces.
|
|
1502
|
-
*/
|
|
1503
|
-
function createDerivedFaceRef(origin, op, edge, preShape, roles) {
|
|
1504
|
-
const [faceA, faceB] = require_healingFns.facesOfEdge(preShape, edge);
|
|
1505
|
-
if (faceA === void 0 || faceB === void 0) return void 0;
|
|
1506
|
-
const roleA = roleOfFace(faceA, origin, roles);
|
|
1507
|
-
const roleB = roleOfFace(faceB, origin, roles);
|
|
1508
|
-
if (roleA === void 0 || roleB === void 0) return void 0;
|
|
1509
|
-
return {
|
|
1510
|
-
origin,
|
|
1511
|
-
op,
|
|
1512
|
-
betweenRoles: [roleA, roleB],
|
|
1513
|
-
hint: {
|
|
1514
|
-
entityType: "derived-face",
|
|
1515
|
-
normalA: require_faceFns.normalAt(faceA),
|
|
1516
|
-
normalB: require_faceFns.normalAt(faceB),
|
|
1517
|
-
edgeMidpoint: vertexCentroid(require_healingFns.verticesOfEdge(edge))
|
|
1518
|
-
}
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
/**
|
|
1522
|
-
* Resolve a DerivedFaceRef in the post-op `shape`: re-derive the two bridged
|
|
1523
|
-
* faces (role table, else by captured normal), then return the face adjacent to
|
|
1524
|
-
* both whose normal blends both. One survivor → resolved; several →
|
|
1525
|
-
* nearest-to-edge-midpoint; none → broken.
|
|
1526
|
-
*/
|
|
1527
|
-
function resolveDerivedFaceRef(ref, roles, shape) {
|
|
1528
|
-
let aFaces = facesForRole(shape, ref.origin, ref.betweenRoles[0], roles);
|
|
1529
|
-
if (aFaces.length === 0) aFaces = facesByNormal(shape, ref.hint.normalA);
|
|
1530
|
-
let bFaces = facesForRole(shape, ref.origin, ref.betweenRoles[1], roles);
|
|
1531
|
-
if (bFaces.length === 0) bFaces = facesByNormal(shape, ref.hint.normalB);
|
|
1532
|
-
if (aFaces.length === 0 || bFaces.length === 0) return {
|
|
1533
|
-
ref,
|
|
1534
|
-
reason: "not-found"
|
|
1535
|
-
};
|
|
1536
|
-
const blended = betweenFaces(shape, aFaces, bFaces).filter((f) => normalDot(require_faceFns.normalAt(f), ref.hint.normalA) > BLEND_THRESHOLD && normalDot(require_faceFns.normalAt(f), ref.hint.normalB) > BLEND_THRESHOLD);
|
|
1537
|
-
if (blended.length === 1) {
|
|
1538
|
-
const [only] = blended;
|
|
1539
|
-
if (only !== void 0) return {
|
|
1540
|
-
face: only,
|
|
1541
|
-
confidence: "geometric-fallback"
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
if (blended.length > 1) {
|
|
1545
|
-
const best = ref.hint.edgeMidpoint && nearestFace(blended, ref.hint.edgeMidpoint);
|
|
1546
|
-
if (best) return {
|
|
1547
|
-
face: best,
|
|
1548
|
-
confidence: "geometric-fallback"
|
|
1549
|
-
};
|
|
1550
|
-
return {
|
|
1551
|
-
ref,
|
|
1552
|
-
reason: "ambiguous",
|
|
1553
|
-
candidates: blended
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
return {
|
|
1557
|
-
ref,
|
|
1558
|
-
reason: "not-found"
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
//#endregion
|
|
1562
1179
|
//#region src/topology/surfaceFns.ts
|
|
1563
1180
|
/**
|
|
1564
1181
|
* Surface creation functions — generate faces from height-map grids.
|
|
@@ -7191,7 +6808,7 @@ exports.addHoles = require_primitiveFns.addHoles;
|
|
|
7191
6808
|
exports.addJoint = require_threadFns.addJoint;
|
|
7192
6809
|
exports.addMate = addMate;
|
|
7193
6810
|
exports.addStep = require_threadFns.addStep;
|
|
7194
|
-
exports.adjacentFaces =
|
|
6811
|
+
exports.adjacentFaces = require_adjacencyFns.adjacentFaces;
|
|
7195
6812
|
exports.all = require_errors.all;
|
|
7196
6813
|
exports.andThen = require_errors.andThen;
|
|
7197
6814
|
exports.applyGlue = applyGlue;
|
|
@@ -7200,7 +6817,7 @@ exports.approximateCurve = require_curveFns.approximateCurve;
|
|
|
7200
6817
|
exports.as2D = require_shapeTypes.as2D;
|
|
7201
6818
|
exports.as3D = require_shapeTypes.as3D;
|
|
7202
6819
|
exports.asTopo = require_faceFns.asTopo;
|
|
7203
|
-
exports.assignRoles =
|
|
6820
|
+
exports.assignRoles = require_refResolveFns.assignRoles;
|
|
7204
6821
|
exports.autoHeal = require_healingFns.autoHeal;
|
|
7205
6822
|
exports.bezier = require_primitiveFns.bezier;
|
|
7206
6823
|
exports.blueprintToDXF = require_importFns.blueprintToDXF;
|
|
@@ -7217,7 +6834,7 @@ exports.bsplineApprox = require_primitiveFns.bsplineApprox;
|
|
|
7217
6834
|
exports.bug = require_errors.bug;
|
|
7218
6835
|
exports.cameraFromPlane = require_cameraFns.cameraFromPlane;
|
|
7219
6836
|
exports.cameraLookAt = require_cameraFns.cameraLookAt;
|
|
7220
|
-
exports.captureHint =
|
|
6837
|
+
exports.captureHint = require_refResolveFns.captureHint;
|
|
7221
6838
|
exports.cast = require_faceFns.cast;
|
|
7222
6839
|
exports.castShape = require_shapeTypes.castShape;
|
|
7223
6840
|
exports.castShape3D = require_shapeTypes.castShape3D;
|
|
@@ -7262,10 +6879,10 @@ exports.createBlueprint = require_blueprintFns.createBlueprint;
|
|
|
7262
6879
|
exports.createCamera = require_cameraFns.createCamera;
|
|
7263
6880
|
exports.createCompound = require_shapeTypes.createCompound;
|
|
7264
6881
|
exports.createCompoundBlueprint = require_blueprintFns.createCompoundBlueprint;
|
|
7265
|
-
exports.createDerivedFaceRef = createDerivedFaceRef;
|
|
6882
|
+
exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
|
|
7266
6883
|
exports.createDistanceQuery = require_measureFns.createDistanceQuery;
|
|
7267
6884
|
exports.createEdge = require_shapeTypes.createEdge;
|
|
7268
|
-
exports.createEdgeRef = createEdgeRef;
|
|
6885
|
+
exports.createEdgeRef = require_refResolveFns.createEdgeRef;
|
|
7269
6886
|
exports.createFace = require_shapeTypes.createFace;
|
|
7270
6887
|
exports.createHandle = require_shapeTypes.createHandle;
|
|
7271
6888
|
exports.createHistory = require_threadFns.createHistory;
|
|
@@ -7274,13 +6891,13 @@ exports.createMeshCache = require_meshFns.createMeshCache;
|
|
|
7274
6891
|
exports.createNamedPlane = require_planeOps.createNamedPlane;
|
|
7275
6892
|
exports.createOperationRegistry = require_workerPool.createOperationRegistry;
|
|
7276
6893
|
exports.createPlane = require_planeOps.createPlane;
|
|
7277
|
-
exports.createRef =
|
|
6894
|
+
exports.createRef = require_refResolveFns.createRef;
|
|
7278
6895
|
exports.createRegistry = require_threadFns.createRegistry;
|
|
7279
6896
|
exports.createShell = require_shapeTypes.createShell;
|
|
7280
6897
|
exports.createSolid = require_shapeTypes.createSolid;
|
|
7281
6898
|
exports.createTaskQueue = require_workerPool.createTaskQueue;
|
|
7282
6899
|
exports.createVertex = require_shapeTypes.createVertex;
|
|
7283
|
-
exports.createVertexRef = createVertexRef;
|
|
6900
|
+
exports.createVertexRef = require_refResolveFns.createVertexRef;
|
|
7284
6901
|
exports.createWire = require_shapeTypes.createWire;
|
|
7285
6902
|
exports.createWorkerClient = require_workerPool.createWorkerClient;
|
|
7286
6903
|
exports.createWorkerHandler = require_workerPool.createWorkerHandler;
|
|
@@ -7317,7 +6934,7 @@ exports.cutBlueprints = require_boolean2D.cutBlueprints;
|
|
|
7317
6934
|
exports.cutWithEvolution = require_healingFns.cutWithEvolution;
|
|
7318
6935
|
exports.cylinder = require_primitiveFns.cylinder;
|
|
7319
6936
|
exports.cylindricalJoint = require_threadFns.cylindricalJoint;
|
|
7320
|
-
exports.defaultScorer =
|
|
6937
|
+
exports.defaultScorer = require_refResolveFns.defaultScorer;
|
|
7321
6938
|
exports.dequeueTask = require_workerPool.dequeueTask;
|
|
7322
6939
|
exports.describe = describe;
|
|
7323
6940
|
exports.deserializeDrawing = require_drawFns.deserializeDrawing;
|
|
@@ -7346,7 +6963,7 @@ exports.drawingIntersect = require_drawFns.drawingIntersect;
|
|
|
7346
6963
|
exports.drawingToSketchOnPlane = require_drawFns.drawingToSketchOnPlane;
|
|
7347
6964
|
exports.drill = drill;
|
|
7348
6965
|
exports.edgeFinder = require_helpers.edgeFinder;
|
|
7349
|
-
exports.edgesOfFace =
|
|
6966
|
+
exports.edgesOfFace = require_adjacencyFns.edgesOfFace;
|
|
7350
6967
|
exports.ellipse = require_primitiveFns.ellipse;
|
|
7351
6968
|
exports.ellipseArc = require_primitiveFns.ellipseArc;
|
|
7352
6969
|
exports.ellipsoid = require_primitiveFns.ellipsoid;
|
|
@@ -7371,8 +6988,8 @@ exports.faceCenter = require_faceFns.faceCenter;
|
|
|
7371
6988
|
exports.faceFinder = require_helpers.faceFinder;
|
|
7372
6989
|
exports.faceGeomType = require_faceFns.faceGeomType;
|
|
7373
6990
|
exports.faceOrientation = require_faceFns.faceOrientation;
|
|
7374
|
-
exports.facesOfEdge =
|
|
7375
|
-
exports.facesOfVertex =
|
|
6991
|
+
exports.facesOfEdge = require_adjacencyFns.facesOfEdge;
|
|
6992
|
+
exports.facesOfVertex = require_adjacencyFns.facesOfVertex;
|
|
7376
6993
|
exports.fieldBoolean = fieldBoolean;
|
|
7377
6994
|
exports.fieldContour = fieldContour;
|
|
7378
6995
|
exports.fieldOffset = fieldOffset;
|
|
@@ -7485,17 +7102,21 @@ exports.isChamferRadius = isChamferRadius;
|
|
|
7485
7102
|
exports.isClosedWire = require_shapeTypes.isClosedWire;
|
|
7486
7103
|
exports.isCompSolid = require_faceFns.isCompSolid;
|
|
7487
7104
|
exports.isCompound = require_shapeTypes.isCompound;
|
|
7105
|
+
exports.isDerivedFaceRef = require_refResolveFns.isDerivedFaceRef;
|
|
7488
7106
|
exports.isDisposeRequest = require_workerPool.isDisposeRequest;
|
|
7489
7107
|
exports.isEdge = require_shapeTypes.isEdge;
|
|
7108
|
+
exports.isEdgeRef = require_refResolveFns.isEdgeRef;
|
|
7490
7109
|
exports.isEmpty = isEmpty;
|
|
7491
7110
|
exports.isEqualShape = require_shapeFns.isEqualShape;
|
|
7492
7111
|
exports.isErr = require_errors.isErr;
|
|
7493
7112
|
exports.isErrorResponse = require_workerPool.isErrorResponse;
|
|
7494
7113
|
exports.isFace = require_shapeTypes.isFace;
|
|
7114
|
+
exports.isFaceRef = require_refResolveFns.isFaceRef;
|
|
7495
7115
|
exports.isFilletRadius = isFilletRadius;
|
|
7496
7116
|
exports.isInitRequest = require_workerPool.isInitRequest;
|
|
7497
7117
|
exports.isInside2D = require_blueprintFns.isInside2D;
|
|
7498
7118
|
exports.isInstanced = isInstanced;
|
|
7119
|
+
exports.isLineageRef = require_refResolveFns.isLineageRef;
|
|
7499
7120
|
exports.isLive = require_shapeTypes.isLive;
|
|
7500
7121
|
exports.isManifoldShell = require_shapeTypes.isManifoldShell;
|
|
7501
7122
|
exports.isNumber = isNumber;
|
|
@@ -7515,6 +7136,7 @@ exports.isSuccessResponse = require_workerPool.isSuccessResponse;
|
|
|
7515
7136
|
exports.isValid = isValid;
|
|
7516
7137
|
exports.isValidSolid = require_shapeTypes.isValidSolid;
|
|
7517
7138
|
exports.isVertex = require_shapeTypes.isVertex;
|
|
7139
|
+
exports.isVertexRef = require_refResolveFns.isVertexRef;
|
|
7518
7140
|
exports.isWire = require_shapeTypes.isWire;
|
|
7519
7141
|
exports.iterCompSolids = require_topologyQueryFns.iterCompSolids;
|
|
7520
7142
|
exports.iterEdges = require_topologyQueryFns.iterEdges;
|
|
@@ -7654,12 +7276,15 @@ exports.resetPerformanceStats = require_shapeTypes.resetPerformanceStats;
|
|
|
7654
7276
|
exports.resize = require_shapeFns.resize;
|
|
7655
7277
|
exports.resolve = resolve;
|
|
7656
7278
|
exports.resolve3D = resolve3D;
|
|
7657
|
-
exports.resolveDerivedFaceRef = resolveDerivedFaceRef;
|
|
7279
|
+
exports.resolveDerivedFaceRef = require_refResolveFns.resolveDerivedFaceRef;
|
|
7658
7280
|
exports.resolveDirection = require_types.resolveDirection;
|
|
7659
|
-
exports.resolveEdgeRef = resolveEdgeRef;
|
|
7281
|
+
exports.resolveEdgeRef = require_refResolveFns.resolveEdgeRef;
|
|
7282
|
+
exports.resolveLineageRef = require_refResolveFns.resolveLineageRef;
|
|
7660
7283
|
exports.resolvePlane = require_planeOps.resolvePlane;
|
|
7661
|
-
exports.resolveRef =
|
|
7662
|
-
exports.
|
|
7284
|
+
exports.resolveRef = require_refResolveFns.resolveRef;
|
|
7285
|
+
exports.resolveRefIn = require_refResolveFns.resolveRefIn;
|
|
7286
|
+
exports.resolveRefParams = require_refResolveFns.resolveRefParams;
|
|
7287
|
+
exports.resolveVertexRef = require_refResolveFns.resolveVertexRef;
|
|
7663
7288
|
exports.reverseCurve = require_blueprintFns.reverseCurve;
|
|
7664
7289
|
exports.revoluteJoint = require_threadFns.revoluteJoint;
|
|
7665
7290
|
exports.revolve = revolve;
|
|
@@ -7698,7 +7323,7 @@ exports.sewShells = require_primitiveFns.sewShells;
|
|
|
7698
7323
|
exports.shape = shape;
|
|
7699
7324
|
exports.shapeToMeshInput = shapeToMeshInput;
|
|
7700
7325
|
exports.shapeType = require_faceFns.shapeType;
|
|
7701
|
-
exports.sharedEdges =
|
|
7326
|
+
exports.sharedEdges = require_adjacencyFns.sharedEdges;
|
|
7702
7327
|
exports.shell = shell;
|
|
7703
7328
|
exports.shellMesh = shellMesh;
|
|
7704
7329
|
exports.shellShape = shellShape;
|
|
@@ -7782,7 +7407,7 @@ exports.unwrapErr = require_errors.unwrapErr;
|
|
|
7782
7407
|
exports.unwrapOr = require_errors.unwrapOr;
|
|
7783
7408
|
exports.unwrapOrElse = require_errors.unwrapOrElse;
|
|
7784
7409
|
exports.updateNode = require_threadFns.updateNode;
|
|
7785
|
-
exports.updateRoles =
|
|
7410
|
+
exports.updateRoles = require_refResolveFns.updateRoles;
|
|
7786
7411
|
exports.uvBounds = require_faceFns.uvBounds;
|
|
7787
7412
|
exports.uvCoordinates = require_faceFns.uvCoordinates;
|
|
7788
7413
|
exports.validSolid = require_shapeTypes.validSolid;
|
|
@@ -7808,8 +7433,8 @@ exports.vecSub = require_vecOps.vecSub;
|
|
|
7808
7433
|
exports.vertex = require_primitiveFns.vertex;
|
|
7809
7434
|
exports.vertexFinder = vertexFinder;
|
|
7810
7435
|
exports.vertexPosition = require_topologyQueryFns.vertexPosition;
|
|
7811
|
-
exports.verticesOfEdge =
|
|
7812
|
-
exports.verticesOfFace =
|
|
7436
|
+
exports.verticesOfEdge = require_adjacencyFns.verticesOfEdge;
|
|
7437
|
+
exports.verticesOfFace = require_adjacencyFns.verticesOfFace;
|
|
7813
7438
|
exports.voxelBoolean = voxelBoolean;
|
|
7814
7439
|
exports.voxelBooleanField = voxelBooleanField;
|
|
7815
7440
|
exports.voxelBooleanFieldShapes = voxelBooleanFieldShapes;
|
|
@@ -7821,7 +7446,7 @@ exports.windingNumbers = windingNumbers;
|
|
|
7821
7446
|
exports.wire = require_primitiveFns.wire;
|
|
7822
7447
|
exports.wireFinder = require_helpers.wireFinder;
|
|
7823
7448
|
exports.wireLoop = require_primitiveFns.wireLoop;
|
|
7824
|
-
exports.wiresOfFace =
|
|
7449
|
+
exports.wiresOfFace = require_adjacencyFns.wiresOfFace;
|
|
7825
7450
|
exports.withKernel = require_shapeTypes.withKernel;
|
|
7826
7451
|
exports.withKernelDir = withKernelDir;
|
|
7827
7452
|
exports.withKernelPnt = withKernelPnt;
|