// Smooth deterministic shoreline shared by drawing and physical habitat checks. export function shoreRadius(w,theta){return w.r*(1+.095*Math.sin(3*theta+(w.seed||0))+.055*Math.sin(5*theta-(w.seed||0)*1.7)+.03*Math.cos(8*theta+(w.seed||0)*.6))} export function waterDistance(water,x,y){ if(!water.length)return Infinity; // Choose a likely nearest shore with only cheap bounds. Every other shore // still receives the exact test, so this changes neither terrain nor physics. let first=0,lower=Infinity; for(let i=0;i=limit*limit)continue; const v=Math.hypot(dx,dy)-shoreRadius(w,Math.atan2(dy,dx));if(v(w.r*1.18)**2)return false;const r=shoreRadius(w,Math.atan2(dy,dx));return d2