stable
This commit is contained in:
parent
860471f805
commit
c523bf4380
8 changed files with 76 additions and 26 deletions
|
|
@ -1367,11 +1367,12 @@ export function buildDensityFlowRoadTransportSystem(ctx) {
|
|||
}
|
||||
return best ? { target: best, d: bestD } : null;
|
||||
}
|
||||
function stitchEndpoints(paths, mode, targets, maxAdds, radius) {
|
||||
function stitchEndpoints(paths, mode, targets, maxAdds, radius, probability = 1) {
|
||||
let added = 0;
|
||||
const endpoints = endpointListWithIds(paths);
|
||||
for (const ep of endpoints) {
|
||||
if (added >= maxAdds) break;
|
||||
if (probability < 1 && hash2(ep.x, ep.y, seed + 18331 + added * 17) > probability) continue;
|
||||
const near = nearestWithin(ep, targets, radius, true);
|
||||
if (near && addShortConnector(paths, ep, near.target, mode)) added++;
|
||||
}
|
||||
|
|
@ -1380,7 +1381,7 @@ export function buildDensityFlowRoadTransportSystem(ctx) {
|
|||
const expresswayCells = sampledCells(expressways, 1);
|
||||
const nationalCells = sampledCells([...nationalRoads, ...externalRoads], 1);
|
||||
const localCells = sampledCells(minorRoads, 1);
|
||||
debug.expressway += stitchEndpoints(expressways, "expressway", expresswayCells, 8, 34.0);
|
||||
debug.expressway += stitchEndpoints(expressways, "expressway", expresswayCells, 14, 46.0, 0.62);
|
||||
debug.national += stitchEndpoints(nationalRoads, "national", nationalCells, 48, 14.0);
|
||||
debug.localToNational += stitchEndpoints(minorRoads, "local", nationalCells, 240, 20.0);
|
||||
debug.local += stitchEndpoints(minorRoads, "local", localCells, 260, 16.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue