feat(junction): close verified complex cores
This commit is contained in:
1 parent
b4abfdb870
commit
88d8b841e5
5 files changed
+97
-25
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
const assert = require('assert/strict');
|
||||
const { resolveJunctionBuildPlan, stationAtDistanceFrom } = require('../src/compile/junction-build-plan');
|
||||
const { buildJunctionBoundaryGraph } = require('../src/compile/junction-boundary-graph');
|
||||
const { buildJunctionBoundaryGraph, buildCoreClosure } = require('../src/compile/junction-boundary-graph');
|
||||
const { classifyJunctionShape } = require('../src/compile/complex-junction');
|
||||
|
||||
const metersPerDegree = 111320;
|
||||
@@ -101,6 +101,10 @@ assert.equal(dividedBoundaryGraph.status, 'entry-sections-only');
|
||||
assert.equal(dividedBoundaryGraph.sections.length, divided.topology.carriageways.length);
|
||||
assert.equal(new Set(dividedBoundaryGraph.sections.map((section) => section.carriagewayKey)).size, 4);
|
||||
assert.equal(dividedBoundaryGraph.edges.length, dividedBoundaryGraph.sections.length * 4);
|
||||
assert.equal(
|
||||
buildCoreClosure(divided.topology, dividedBoundaryGraph, point(0, 0)).reason,
|
||||
'parallel-carriageway-closure-unresolved',
|
||||
);
|
||||
|
||||
// A T junction has explicit, source-stable entry sections. Closure edges are a
|
||||
// later BoundaryGraph concern and must not be fabricated by topology parsing.
|
||||
@@ -112,6 +116,16 @@ const tee = topology('tee', [
|
||||
assert.equal(tee.topology.arms.length, 3);
|
||||
assert.equal(classifyJunctionShape(tee.topology.arms, point(0, 0), tee.helpers).kind, 't-junction');
|
||||
assert.ok(tee.topology.carriageways.every((item) => item.entrySection.feasibility === 'supported'));
|
||||
const teeBoundaryGraph = buildJunctionBoundaryGraph(
|
||||
tee.topology,
|
||||
point(0, 0),
|
||||
{ outerRadiusFor: () => 30, innerRadiusFor: () => 10 },
|
||||
tee.helpers,
|
||||
);
|
||||
const teeCore = buildCoreClosure(tee.topology, teeBoundaryGraph, point(0, 0));
|
||||
assert.equal(teeCore.status, 'supported');
|
||||
assert.equal(teeCore.sharedEdgeRefs.length, teeBoundaryGraph.sections.length);
|
||||
assert.ok(teeCore.ring.every((coordinate) => coordinate.every(Number.isFinite)));
|
||||
|
||||
// Offset and unequal-width approaches preserve individual source sections and
|
||||
// local section tangents rather than a single arm envelope.
|
||||
|
||||
Reference in new issue
Block a user