Hello, I am writing a program for a two dimensional look up table. The idea is that the user will enter values for x and y and the program will look up the corresponding output value from the table. For example, consider the table shown below. For this table, if the user enters x = 2 and y = 1 then the program will output 6. If the user enters values between two entries of the table then the program will interpolate. For example, using the same table shown in the attached *.pdf, if the user enters x = 1 and y = 1.5 then the program will output 1.5. Furthermore, if the user enters x = 1.25 and y = 1.25 the program will use bilinear interpolation and output 2.5. With this I am able to handle every x and y input that is within the x and y ranges provided in the table. However, if the user enters input values that are outside the range of the table, how should the program determine its output? If we think our 2d table as a 2d mesh, where every point on the mesh corresponds to an entry in the table, then we can see that I have 9 different regions that I must deal with depending on the users input of x and y. In each of these regions, I must select 4 points so that I can formulate a surface, [tex]f(x,y) = a_0 + a_1 x + a_2 y + a_3 x y[/tex] and solve the for the coefficients [tex]a_0, a_1, a_2, a_3[/tex]. Whenever the input point (x,y) is within the boundaries of the 2d mesh (i.e. marked region 9 in the *.pdf) then selecting the 4 points to use is easy, I just select the 4 surrounding points on the mesh. However, whenever the input point (x,y) is outside the boundaries of the mesh, I don't know how to intelligently select which 4 points to use to define my surface. Any ideas/comments/suggestions?