grid = {
const x0 = -q / 2, x1 = width + q;
const y0 = -q / 2, y1 = height + q;
const n = Math.ceil((x1 - x0) / q);
const m = Math.ceil((y1 - y0) / q);
const grid = new Array(n * m);
for(let j = 0; j < m; ++j){
for (let i = 0; i < n; ++i){
grid[j * n + i] = value(i * q* scale, j * q * scale);
}
}
grid.n = n;
grid.m = m;
return grid;
}