With the line tool I draw a line on an image.

Then I get coordinates of points along the line using this code:

getLine(x1, y1, x2, y2, lineWidth);

run(“Interpolate”, “interval=1”);

getSelectionCoordinates(x, y);

Now I want to do the same but instead of drawing a line I have input 2 points and have recorded their coordinates, (x1,y1) and (x2,y2).

I could use a loop and calculate the in-between coordinates using trivial trigonometry but I’d be surprised if there wasn’t a specific function to do more efficiently.