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 { structureFromTopology } = require('./junction-topology');
|
||||||
const { resolveJunctionBuildPlan, stationAtDistanceFrom } = require('./junction-build-plan');
|
const { resolveJunctionBuildPlan, stationAtDistanceFrom } = require('./junction-build-plan');
|
||||||
const { buildJunctionBoundaryGraph, buildCoreClosure, ringsOverlap } = require('./junction-boundary-graph');
|
const { buildJunctionBoundaryGraph, buildCoreClosure, ringsOverlap } = require('./junction-boundary-graph');
|
||||||
const { solveComplexPavementRegion, rectangle, connectCornerCrossing } = require('./junction-pavement-region');
|
const { solveComplexPavementRegion, rectangle } = require('./junction-pavement-region');
|
||||||
const {
|
const {
|
||||||
buildIslandFromCrossingEdges,
|
buildIslandFromCrossingEdges,
|
||||||
orthogonalCrossingHeadings,
|
orthogonalCrossingHeadings,
|
||||||
@@ -86,7 +86,6 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
const transitionDiagnostics = [];
|
const transitionDiagnostics = [];
|
||||||
const crosswalks = [];
|
const crosswalks = [];
|
||||||
const crossingRegions = [];
|
const crossingRegions = [];
|
||||||
const cornerCrossingFrames = [];
|
|
||||||
const stopLines = [];
|
const stopLines = [];
|
||||||
const islands = [];
|
const islands = [];
|
||||||
const crossingControls = helpers.clusterCrossingControls || new Map();
|
const crossingControls = helpers.clusterCrossingControls || new Map();
|
||||||
@@ -610,12 +609,6 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
const diagonalHeading = outwardHeading;
|
const diagonalHeading = outwardHeading;
|
||||||
const diagonalCenter = helpers.offsetCoordinate(outerMidpoint, outwardHeading, diagonalDepth / 2);
|
const diagonalCenter = helpers.offsetCoordinate(outerMidpoint, outwardHeading, diagonalDepth / 2);
|
||||||
const diagonalSpan = COMPLEX_CROSSWALK_DEPTH_METERS;
|
const diagonalSpan = COMPLEX_CROSSWALK_DEPTH_METERS;
|
||||||
cornerCrossingFrames.push({
|
|
||||||
center: diagonalCenter,
|
|
||||||
heading: diagonalHeading,
|
|
||||||
depth: diagonalDepth,
|
|
||||||
span: diagonalSpan,
|
|
||||||
});
|
|
||||||
const layout = stripeLayout(diagonalDepth);
|
const layout = stripeLayout(diagonalDepth);
|
||||||
const stripeCount = layout.centers.length;
|
const stripeCount = layout.centers.length;
|
||||||
const stripeSpacing = layout.pitch;
|
const stripeSpacing = layout.pitch;
|
||||||
@@ -825,14 +818,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
// core and corner polygons above remain structural inputs for editing and
|
// core and corner polygons above remain structural inputs for editing and
|
||||||
// diagnostics; they are no longer the visible authority at the junction.
|
// diagnostics; they are no longer the visible authority at the junction.
|
||||||
const basePavement = features.map((feature) => feature.geometry.coordinates[0]);
|
const basePavement = features.map((feature) => feature.geometry.coordinates[0]);
|
||||||
const connectedCrossings = [...crossingRegions];
|
const pavementRegion = solveComplexPavementRegion(basePavement, 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]);
|
|
||||||
if (pavementRegion.status === 'supported') {
|
if (pavementRegion.status === 'supported') {
|
||||||
for (const feature of features) feature.properties.pavement_input = true;
|
for (const feature of features) feature.properties.pavement_input = true;
|
||||||
features.push({
|
features.push({
|
||||||
@@ -845,7 +831,7 @@ function buildComplexJunctionGeometry(model, cluster, helpers) {
|
|||||||
center,
|
center,
|
||||||
region_status: 'supported',
|
region_status: 'supported',
|
||||||
region_input_count: pavementRegion.inputCount,
|
region_input_count: pavementRegion.inputCount,
|
||||||
crossing_connector_count: connectors.length,
|
crossing_connector_count: 0,
|
||||||
provenance: 'native-road-complex-junction-pavement-region/v1',
|
provenance: 'native-road-complex-junction-pavement-region/v1',
|
||||||
},
|
},
|
||||||
geometry: { type: 'MultiPolygon', coordinates: pavementRegion.regions },
|
geometry: { type: 'MultiPolygon', coordinates: pavementRegion.regions },
|
||||||
|
|||||||
@@ -33,22 +33,4 @@ function rectangle(center, heading, depth, span) {
|
|||||||
return [first, second, third, fourth, first];
|
return [first, second, third, fourth, first];
|
||||||
}
|
}
|
||||||
|
|
||||||
// A corner crossing keeps its island landing fixed. When its carriageway-side
|
module.exports = { solveComplexPavementRegion, rectangle };
|
||||||
// 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 };
|
|
||||||
@@ -40,7 +40,11 @@ for (const [name, nodeIds] of Object.entries({
|
|||||||
geometry.diagnostics.some((item) => item.rule === 'complex-junction-pavement-region-disconnected'),
|
geometry.diagnostics.some((item) => item.rule === 'complex-junction-pavement-region-disconnected'),
|
||||||
false,
|
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(
|
assert.ok(
|
||||||
multiArea(clipping.difference(stripe.geometry.coordinates, pavement.geometry.coordinates)) < 1e-10,
|
multiArea(clipping.difference(stripe.geometry.coordinates, pavement.geometry.coordinates)) < 1e-10,
|
||||||
`${name} ${stripe.properties.native_id} must lie on the unified pavement`,
|
`${name} ${stripe.properties.native_id} must lie on the unified pavement`,
|
||||||
|
|||||||
Reference in new issue
Block a user