Suppose I have a 10x10 pixel grid. Assume that each pixel has value 1 (it is not important). Now in the typical case, if I would like to sample a point inside of the grid, for example p1=(0.5,0.5)=(x,y), then we can apply bilinear interpolation by:
Finding x1 by flooring x and x2 = x1+1. x1=0, x2=1
Finding y1 by flooring y and y2 = y2+1 y1=0, y2=1
The resulting values will be a function of the values of the pixels (0,0),(1,0),(0,1),(1,1).
However, suppose now that I have a point outside of the grid. The point p2=(9.5,9.5)=(x,y). Note that as the grid is 0-indexed this point is outside of the grid. What will x1 and y2 be in this case and what will my nearest pixel coordinates be? Do we just change x to the point (9,9) and then perform bilinear interpolation using pixels (8,8),(9,8),(8,9),(9,9)? Or do we perform some kind of padding?
If there are multiple approaches, I am looking for the one that most libraries would use.