svg`<svg width="${w}" height="${h}" >
<rect width="${w}" height="${h}" stroke="blue" fill="none" />
<g transform="translate(${(w - nx * gridSize) / 2}, ${(h - ny * gridSize) / 2})">
${array(ny).map(j => {
const s = gridSize / 2
return array(nx).map(i => {
const x = i * gridSize + s
const y = j * gridSize + s
const p = new Polygon(PVector(-s, -s), PVector(s, -s), PVector(-s, s))
const hatches = p.getHatches(-PI/2 + 0.00001, 3, 0, true)
const c = random() < .65 ? 'black' : 'red'
return `<g transform="translate(${x}, ${y}) rotate(${randInt(4) * 90})">
<path
stroke="${c}"
fill="none"
d="M${-s}, ${-s} L${s},${-s} L${-s},${s} Z"
/>
<path
stroke="${c}"
fill="none"
d="${pathFromHatches(hatches)}"
/>
</g>`
}).join('\n')
}).join('\n')}
</g>
</svg>`