// Shared clean silhouette: sample color inside the PNG; never sample its noisy cutout edge. export function tileSample(f){return {x:Math.round(f.x+f.w*.4),y:Math.round(f.y+f.h*.4),w:Math.round(f.w*.2),h:Math.round(f.h*.2)};} export function roundedHex(x,y,r,rounding=.075){ const vertices=Array.from({length:6},(_,i)=>({x:x+Math.cos(i*Math.PI/3)*r,y:y+Math.sin(i*Math.PI/3)*r})),out=[]; for(let i=0;i<6;i++){ const v=vertices[i],prev=vertices[(i+5)%6],next=vertices[(i+1)%6],a={x:v.x+(prev.x-v.x)*rounding,y:v.y+(prev.y-v.y)*rounding},b={x:v.x+(next.x-v.x)*rounding,y:v.y+(next.y-v.y)*rounding}; for(let j=0;j<=6;j++){const t=j/6,u=1-t;out.push({x:u*u*a.x+2*u*t*v.x+t*t*b.x,y:u*u*a.y+2*u*t*v.y+t*t*b.y});} } return out; }