svg`<svg width=${w} height=${h}>
<!--<rect x="0" y="0" width="${w}" height="${h}" fill="${palette[0]}" stroke="none" />-->
${grid.centers.filter(pt => pt.x > 0 && pt.x < width && pt.y > 0 && pt.y < h).reduce((g, d, i) => {
g += `<g transform="translate(${d.x}, ${d.y})">`
g += `<polygon
fill="none"
stroke="black"
stroke-width="0.4"
points="${grid.hexPoints.map(pt => `${pt.x},${pt.y}`).join(' ')}"
/>`
g += `<circle
cx="0" cy="0"
r="${hexSize}"
fill="none"
stroke="black"
stroke-width="0.4"
/>`
const noise = simplex.noise3D(d.x / noiseScale, d.y / noiseScale, seed)
const c = palette[1 + Math.random() * (palette.length - 1) | 0]
g += grid.hexPoints.reduce((paths, pt, j) => {
const center = PVector(pt.x, pt.y).mult(0.5)
let p1 = center.clone().rotateBy(Math.PI/2).mult(noise * .3 + .4).add(center)
let p2 = center.clone().rotateBy(-Math.PI/2).mult(noise * .3 + .4).add(center)
paths += `<path
fill="none"
stroke-width="0.3"
stroke="black"
d="M0 0 L${p1.x} ${p1.y} L${pt.x} ${pt.y} L${p2.x} ${p2.y} Z"
></path>`
return paths
}, '')
g += `</g>`
return g
}, '')}
</svg>`