Architect runs: show whether tubes share a trench or take separate paths
Tubes in one trench are drawn as strands of one bundle with an orange '2× one trench' pill; separate paths bow well apart with a green '2 paths' pill. Cut tubes no longer show the backhoe: the monkey does the snipping.
This commit is contained in:
parent
5216a66db3
commit
cbcb242d90
9 changed files with 37 additions and 4 deletions
|
|
@ -37,7 +37,8 @@ function drawCables(ks){const z=cam.z,selC=UI.drag&&UI.drag.mode==='link'?UI.dra
|
|||
ctx.globalAlpha=1;}}}
|
||||
function bezGeom(l,at){const A=CITY[l.a],B=CITY[l.b];const i=at!==undefined?at:lineIdx(l);const key=l.id+'|b'+i;const hit=GEO.get(key);if(hit)return hit;
|
||||
const bx=A.x+wrapDx(A.x,B.x),by=B.y;const dx=bx-A.x,dy=by-A.y,len=Math.hypot(dx,dy)||1;let nx=-dy/len,ny=dx/len;if(ny>0){nx=-nx;ny=-ny;}
|
||||
const base=Math.max(4,Math.min(len*0.1,90)),step=Math.min(16,len*.06),off0=i<=0?base:(i%2?-1:1)*(base*(i%2?0.2:1)+Math.ceil(i/2)*step);
|
||||
// Architect runs bow diverse paths well apart, so two routes never read as one.
|
||||
const wide=S&&S.ar&&pzOn(),base=Math.max(4,Math.min(len*0.1,90)),step=wide?Math.min(30,len*.14):Math.min(16,len*.06),off0=i<=0?base:(i%2?-1:1)*(base*(i%2?(wide?0.9:0.2):1)+Math.ceil(i/2)*step);
|
||||
const mx=(A.x+bx)/2,my=(A.y+by)/2;
|
||||
const sg=Math.sign(off0)||1,mag=Math.abs(off0);
|
||||
// Bend around cities in the way, but gently: short links need less room, no curve bows out more than about a
|
||||
|
|
@ -56,4 +57,6 @@ function bezGeom(l,at){const A=CITY[l.a],B=CITY[l.b];const i=at!==undefined?at:l
|
|||
const g={ax:A.x,ay:A.y,bx,by,cx:best[0],cy:best[1],len};GEO.set(key,g);return g;}
|
||||
const qpt=(g,t)=>[(1-t)*(1-t)*g.ax+2*(1-t)*t*g.cx+t*t*g.bx,(1-t)*(1-t)*g.ay+2*(1-t)*t*g.cy+t*t*g.by];
|
||||
const utilCol=u=>u<=0.001?'#AFC0D6':u<0.65?'#22C47A':u<0.9?'#FFAA1F':'#FF4D5E';
|
||||
|
||||
// How many separate paths (trenches or cables) join this tube's two cities.
|
||||
const arPaths=l=>new Set(pairLinks(l.a,l.b).map(gKey)).size;
|
||||
const AR_PILLS=[]; // filled while the links are drawn, painted after the cities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue