fix: limit junction pavement to arm crossings
This commit is contained in:
1 parent
8882754b23
commit
7ca57a68e6
3 files changed
+9
-37
No files matched your search
@@ -5,7 +5,7 @@ const { COMPLEX_CROSSWALK_DEPTH_METERS } = require('./junction-metrics');
|
||||
const { structureFromTopology } = require('./junction-topology');
|
||||
const { resolveJunctionBuildPlan, stationAtDistanceFrom } = require('./junction-build-plan');
|
||||
const { buildJunctionBoundaryGraph, buildCoreClosure, ringsOverlap } = require('./junction-boundary-graph');
|
||||
const { solveComplexPavementRegion, rectangle, connectCornerCrossing } = require('./junction-pavement-region');
|
||||
const { solveComplexPavementRegion, rectangle } = require('./junction-pavement-region');
|
||||
const {
|
||||
buildIslandFromCrossingEdges,
|
||||
orthogonalCrossingHeadings,
|
||||
@@ -86,7 +86,6 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
const transitionDiagnostics = [];
|
||||
const crosswalks = [];
|
||||
const crossingRegions = [];
|
||||
const cornerCrossingFrames = [];
|
||||
const stopLines = [];
|
||||
const islands = [];
|
||||
const crossingControls = helpers.clusterCrossingControls || new Map();
|
||||
@@ -610,12 +609,6 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
const diagonalHeading = outwardHeading;
|
||||
const diagonalCenter = helpers.offsetCoordinate(outerMidpoint, outwardHeading, diagonalDepth / 2);
|
||||
const diagonalSpan = COMPLEX_CROSSWALK_DEPTH_METERS;
|
||||
cornerCrossingFrames.push({
|
||||
center: diagonalCenter,
|
||||
heading: diagonalHeading,
|
||||
depth: diagonalDepth,
|
||||
span: diagonalSpan,
|
||||
});
|
||||
const layout = stripeLayout(diagonalDepth);
|
||||
const stripeCount = layout.centers.length;
|
||||
const stripeSpacing = layout.pitch;
|
||||
@@ -825,14 +818,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
// core and corner polygons above remain structural inputs for editing and
|
||||
// diagnostics; they are no longer the visible authority at the junction.
|
||||
const basePavement = features.map((feature) => feature.geometry.coordinates[0]);
|
||||
const connectedCrossings = [...crossingRegions];
|
||||
const connectors = [];
|
||||
for (const frame of cornerCrossingFrames) {
|
||||
const solved = connectCornerCrossing(basePavement, connectedCrossings, frame);
|
||||
connectedCrossings.push(solved.region);
|
||||
if (solved.connector) connectors.push(solved.connector);
|
||||
}
|
||||
const pavementRegion = solveComplexPavementRegion(basePavement, [...connectedCrossings, ...connectors]);
|
||||
const pavementRegion = solveComplexPavementRegion(basePavement, crossingRegions);
|
||||
if (pavementRegion.status === 'supported') {
|
||||
for (const feature of features) feature.properties.pavement_input = true;
|
||||
features.push({
|
||||
@@ -845,7 +831,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
||||
center,
|
||||
region_status: 'supported',
|
||||
region_input_count: pavementRegion.inputCount,
|
||||
crossing_connector_count: connectors.length,
|
||||
crossing_connector_count: 0,
|
||||
provenance: 'native-road-complex-junction-pavement-region/v1',
|
||||
},
|
||||
geometry: { type: 'MultiPolygon', coordinates: pavementRegion.regions },
|
||||
|
||||
@@ -33,22 +33,4 @@ function rectangle(center, heading, depth, span) {
|
||||
return [first, second, third, fourth, first];
|
||||
}
|
||||
|
||||
// A corner crossing keeps its island landing fixed. When its carriageway-side
|
||||
// edge does not meet the main paved component, seek the shortest narrow
|
||||
// connector behind it. This is a region constraint, not a move of the zebra.
|
||||
function connectCornerCrossing(parts, crossingRegions, crossing) {
|
||||
const original = rectangle(crossing.center, crossing.heading, crossing.depth, crossing.span);
|
||||
const baseline = solveComplexPavementRegion(parts, [...crossingRegions, original]);
|
||||
if (baseline.status === 'supported') return { region: original, connector: null };
|
||||
for (let along = 0.5; along <= 10; along += 0.5) {
|
||||
for (const lateral of [0, -0.5, 0.5, -1, 1, -1.5, 1.5, -2, 2]) {
|
||||
const center = offset(offset(crossing.center, crossing.heading, -along / 2), crossing.heading + 90, lateral);
|
||||
const connector = rectangle(center, crossing.heading, crossing.depth + along + 0.5, crossing.span);
|
||||
const candidate = solveComplexPavementRegion(parts, [...crossingRegions, original, connector]);
|
||||
if (candidate.status === 'supported') return { region: original, connector };
|
||||
}
|
||||
}
|
||||
return { region: original, connector: null };
|
||||
}
|
||||
|
||||
module.exports = { solveComplexPavementRegion, rectangle, connectCornerCrossing };
|
||||
module.exports = { solveComplexPavementRegion, rectangle };
|
||||
@@ -40,7 +40,11 @@ for (const [name, nodeIds] of Object.entries({
|
||||
geometry.diagnostics.some((item) => item.rule === 'complex-junction-pavement-region-disconnected'),
|
||||
false,
|
||||
);
|
||||
for (const stripe of geometry.crosswalks.features.filter((feature) => feature.properties.cluster_id === name))
|
||||
// The region owns road-arm crossings. The island-hypotenuse crossing is a
|
||||
// pedestrian facility above the road layer and does not expand pavement.
|
||||
for (const stripe of geometry.crosswalks.features.filter(
|
||||
(feature) => feature.properties.cluster_id === name && feature.properties.kind === 'complex-crosswalk',
|
||||
))
|
||||
assert.ok(
|
||||
multiArea(clipping.difference(stripe.geometry.coordinates, pavement.geometry.coordinates)) < 1e-10,
|
||||
`${name} ${stripe.properties.native_id} must lie on the unified pavement`,
|
||||
|
||||
Reference in new issue
Block a user