I am seeking assistance with creating a javascript function that can retrieve coordinates within the specified range of a start and endpoint on a grid. Below is a representation of the grid structure:
_______________________
| | | |
| -1,-1 | 0,-1 | 1,-1 |
|_______|_______|_______|
| | | |
| -1,0 | 0,0 | 1,0 |
|_______|_______|_______|
| | | |
| -1,1 | 0,1 | 1,1 |
|_______|_______|_______|
For example, if I specify the range from coordinates (-1,-1) to (0,0), I would expect to receive the following values: (-1,-1), (0,-1), (-1,0), (0,0).
Although these are basic mathematics principles, I am struggling to find an optimal solution for this problem.