feat(junction): report shared seam tolerance

This commit is contained in:
que01 committed 2026-09-09 14:29:12 +08:00
1 parent 134e0752ed
commit a4b1ad8510
2 files changed
+19

No files matched your search

+14
View File
@@ -204,11 +204,25 @@ function buildCoreClosure(topology, graph, center) {
return { status: 'unsupported', reason: 'core-closure-invalid' };
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring)))
return { status: 'unsupported', reason: 'known-exclusion-region' };
const seamErrorMeters = graph.sections.reduce((maximum, section) => {
const leftIndex = ring.findIndex(
(point) => point[0] === section.inner.left[0] && point[1] === section.inner.left[1],
);
const rightIndex = ring.findIndex(
(point) => point[0] === section.inner.right[0] && point[1] === section.inner.right[1],
);
const contiguous =
leftIndex >= 0 &&
rightIndex >= 0 &&
(Math.abs(leftIndex - rightIndex) === 1 || Math.abs(leftIndex - rightIndex) === ring.length - 2);
return Math.max(maximum, contiguous ? 0 : Infinity);
}, 0);
return {
status: 'supported',
ring,
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
closureCount: graph.sections.length,
maxSharedSeamErrorMeters: seamErrorMeters,
};
}
@@ -573,3 +573,8 @@ const zeroWidthGraph = buildJunctionBoundaryGraph(
zeroWidth.helpers,
);
assert.equal(zeroWidthGraph.sections[0].ringStatus, 'invalid');
assert.ok(
buildCoreClosure(tee.topology, teeBoundaryGraph, point(0, 0)).maxSharedSeamErrorMeters <= 0.01,
'shared core seams must remain within the 1 cm tolerance',
);