feat(junction): report shared seam tolerance
This commit is contained in:
1 parent
134e0752ed
commit
a4b1ad8510
2 files changed
+19
No files matched your search
@@ -204,11 +204,25 @@ function buildCoreClosure(topology, graph, center) {
|
|||||||
return { status: 'unsupported', reason: 'core-closure-invalid' };
|
return { status: 'unsupported', reason: 'core-closure-invalid' };
|
||||||
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring)))
|
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring)))
|
||||||
return { status: 'unsupported', reason: 'known-exclusion-region' };
|
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 {
|
return {
|
||||||
status: 'supported',
|
status: 'supported',
|
||||||
ring,
|
ring,
|
||||||
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
|
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
|
||||||
closureCount: graph.sections.length,
|
closureCount: graph.sections.length,
|
||||||
|
maxSharedSeamErrorMeters: seamErrorMeters,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -573,3 +573,8 @@ const zeroWidthGraph = buildJunctionBoundaryGraph(
|
|||||||
zeroWidth.helpers,
|
zeroWidth.helpers,
|
||||||
);
|
);
|
||||||
assert.equal(zeroWidthGraph.sections[0].ringStatus, 'invalid');
|
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',
|
||||||
|
);
|
||||||
Reference in new issue
Block a user