grid = (w, h, step) => {
let res = ['g', t(.5,.5)];
for (let x = 0; x <= w; x++) {
res.push(['line', {class: 'grid', x1: step * x, x2: step * x, y1: 0, y2: step * h}]);
}
for (let y = 0; y <= h; y++) {
res.push(['line', {class: 'grid', x1: 0, x2: step * w, y1: step * y, y2: step * y}]);
}
res.push(['g',
['line', {class: 'axis', x1: step, x2: step, y1: 0, y2: step * h}],
['line', {class: 'axis', x1: 0, x2: step * w, y1: step, y2: step}],
['line', {class: 'axis', x1: step * (w - 1), x2: step * (w - 1), y1: 0, y2: step * h}],
['line', {class: 'axis', x1: 0, x2: step * w, y1: step * (h - 1), y2: step * (h - 1)}],
]);
for (let x = 1; x < (w - 1); x++) {
res.push(['text', {class: 'label', x: step * x + (step >> 1), y: 0.75 * step}, x]);
}
for (let y = 1; y < (h - 1); y++) {
res.push(['text', {class: 'label', x: 0.5 * step, y: step * y + 0.75 * step}, letter(y - 1)]);
}
return res;
}