Not a complete solution, but added this:
fill(60, abs((x - b)/2 ) + abs((y - a)/2), 100);
and this:
y += 25;
to get a diagonal movement. I’m pretty new to coding so unfortunately can’t offer a complete solution. Perhaps this helps? Though, this is not a line per se…
Also under TUTORIALS on the main processing.org site there is a Dan Shiffman 2 DIMENSIONAL ARRAYS tutorial showing a how to make an oscillating grid with a diagonal line. Scroll down to about midway point in text to see.