feat: preserve safe junction exclusion holes

This commit is contained in:
que01 committed 2026-09-10 09:56:21 +08:00
1 parent c003edaf51
commit 609935d209
2 files changed
+11 -2

No files matched your search

+1 -1
View File
@@ -528,7 +528,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
closure_count: coreClosure.closureCount,
provenance: 'native-road-complex-junction/v7-shared-entry-core',
},
geometry: { type: 'Polygon', coordinates: [coreRing] },
geometry: { type: 'Polygon', coordinates: [coreRing, ...(coreClosure.holes || [])] },
});
else {
cornerDiagnostics.push(
+10 -1
View File
@@ -239,7 +239,15 @@ function buildCoreClosure(topology, graph, center) {
});
if (ring.length < 7 || hasZeroLengthEdge || !paired || Math.abs(signedArea(ring)) < 1e-14 || ringSelfIntersects(ring))
return { status: 'unsupported', reason: 'core-closure-invalid' };
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring)))
const holes = graph.exclusionRegions
.filter((region) => {
const boundaryIntersects = ringSelfIntersects([...region.ring]);
const contained = region.ring.slice(0, -1).every((point) => pointInRing(point, ring));
const clearOfEntries = graph.sections.every((section) => !ringsOverlap(region.ring, section.ring));
return region.isHole === true && !boundaryIntersects && contained && clearOfEntries;
})
.map((region) => region.ring);
if (graph.exclusionRegions.some((region) => ringsOverlap(region.ring, ring) && !holes.includes(region.ring)))
return { status: 'unsupported', reason: 'known-exclusion-region' };
const seamErrors = graph.sections.map((section) => {
const leftIndex = ring.findIndex(
@@ -270,6 +278,7 @@ function buildCoreClosure(topology, graph, center) {
return {
status: 'supported',
ring,
holes,
sharedEdgeRefs: [...pairedEdges.keys()].sort(),
closureCount: graph.sections.length,
maxSharedSeamErrorMeters: seamErrorMeters,