Jump to content

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

From Wikipedia, the free encyclopedia
Mathematics desk
< June 13 << May | June | Jul >> June 15 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 14[edit]

Bilinear Interpolation Misleading Picture/Equation Combo[edit]

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:

Q11----Q21              Q12----Q22
-        -              -        -
-        -      vs      -        -
-        -              -        -
Q12----Q22              Q11----Q21

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 (talkcontribs) 06:45, 14 June 2018 (UTC)[reply]

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)[reply]