totally makes sense, although i think if i do the math in floating point, the results will be just as usable when scaling tables from lower resolution ecms. i'll have to do some tests on how well it works on a real VE table or whatever. when you have two axes (for a 3d table) things get a bit more complicated. https://en.wikipedia.org/wiki/Bilinear_interpolation
this is a great approximation that i've been using with success, the compiler reduces it to a few instructions and it runs really quickly
Code:
double x2x1, y2y1, x2x, y2y, yy1, xx1;
x2x1 = x2 - x1;
y2y1 = y2 - y1;
x2x = x2 - x;
y2y = y2 - y;
yy1 = y - y1;
xx1 = x - x1;
return 1.0 / (x2x1 * y2y1) * (
q11 * x2x * y2y +
q21 * xx1 * y2y +
q12 * x2x * yy1 +
q22 * xx1 * yy1
);
Bookmarks