Space parallel links by drawn line, not by link count (#64)

Every link not following a commercial cable curved out by its index among
all links on the city pair, though waves sharing a trench or cable draw as
one line. With a busy trench, leased or own fiber swung out in loops several
times the route length on about half of all routes. Index by drawn line and
scale the spacing with route length.
This commit is contained in:
Frederic Jung 2026-10-25 16:07:03 +01:00
parent b96d5681e2
commit 99e73cb897
No known key found for this signature in database
3 changed files with 18 additions and 5 deletions

View file

@ -554,3 +554,13 @@ test('#64 your own subsea cable runs beside the route, however many waves share
assert.ok(Math.hypot(g[0][0] - ev('CITY.lon.x'), g[0][1] - ev('CITY.lon.y')) < 1, 'still starts in London');
assert.deepEqual(errors, []);
});
test('#64 leased and own land fiber stay near their route next to a trench full of waves', () => {
const { ev, errors } = load();
base(ev);
ev("ACT.buildPop({city:'par'});S.links=[];for(let i=0;i<8;i++)S.links.push({id:'w'+i,a:'fra',b:'par',kind:'wave',tier:2,km:478,sub:false,trench:'t1',cut:0,day:0});S.links.push({id:'d1',a:'fra',b:'par',kind:'df',own:false,km:478,sys:'lite',ch:[],ready:0,cut:0,day:0},{id:'d2',a:'fra',b:'par',kind:'df',own:true,km:478,sys:'lite',ch:[],ready:0,cut:0,day:0});GEO.clear()");
const r = id => ev(`(()=>{const g=linkGeom(S.links.find(l=>l.id==='${id}')),A=CITY.fra,B=CITY.par,L=Math.hypot(B.x-A.x,B.y-A.y);return Math.max(...g.pts.map(p=>segDist(p[0],p[1],[A.x,A.y],[B.x,B.y])))/L;})()`);
assert.equal(ev("['w0','d1','d2'].map(id=>lineIdx(S.links.find(l=>l.id===id))).join()"), '0,1,2', 'eight waves in one trench are one line');
for (const id of ['d1', 'd2']) assert.ok(r(id) < 0.35, `${id} bulges ${r(id).toFixed(2)}× the route`);
assert.deepEqual(errors, []);
});