function lineCoords([x1, y1, x2, y2]) {
const xInc = Math.sign(x2 - x1);
const yInc = Math.sign(y2 - y1);
const numSteps = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)) + 1;
const coords = [];
for (let i = 0; i < numSteps; i++) {
coords.push([x1 + i * xInc, y1 + i * yInc]);
}
return coords;
}