Wikipedia:Reference desk/Archives/Mathematics/2018 June 14

= June 14 =

Bilinear Interpolation Misleading Picture/Equation Combo
I was recently using this Wikipedia page: https://en.wikipedia.org/wiki/Bilinear_interpolation

I was using this to view the equations needed in order to put into a video game I'm working on, to use in terrain generation, and upon testing it out, realized that the numbers were seemingly "reversed".

Like this: 15 237 194 150 270 214 197 181 164 148 148 158 168 178 189 81 118 155 192 229 280  79 143 206 107

I thought at first it was an error on my part, maybe accidentally having the array print out reverse or something, but upon using this calculator website: https://www.ajdesigner.com/phpinterpolation/bilinear_interpolation_equation.php

I realized that the "Q11 - Q22" values in their little diagram were in different positions: Q11Q21             Q12Q22 -       -              -        - -        -      vs      -        - -       -              -        - Q12Q22              Q11Q21

This little difference had me putting the corner values in the wrong spots within the equation, because the equations on the wiki page still have those Q values in the same spots, so I was putting the top left corner value where the bottom left corner value was meant, and so on.

Upon changing it so that Q11 was referencing the top left corner, and Q22 was referencing the bottom right, the test worked.

I believe that the picture shown is very misleading as someone may do as I have and assign the known values from the wrong positions and have their numbers reversed! — Preceding unsigned comment added by LKloosterman (talk • contribs) 06:45, 14 June 2018 (UTC)
 * There are, unfortunately, several competing conventions when it comes to how positions in an array or on a plane are indexed. One, as used in the Cartesian coordinate system has the first coordinate going left to right and the second coordinate going down to up. Another, as used in labeling matrix entries, has the first coordinate going up to down and the second coordinate going left to right. To me, the second one makes more sense since it follows the order that words are written on a page, at least for European languages, but the first one has the weight of long tradition behind it. The calculator website you're using seems to be following some kind of hybrid standard, perhaps it's common to use that one in computer graphics. In any case, the article seems to be consistent in the standard it uses, so other than having everyone convert to the same standard (keeping in mind that Americans STILL don't use the metric system) I don't think there's much to be done. --RDBury (talk) 10:58, 14 June 2018 (UTC)