ITADN

lerp interpolates the wrong way?

#164Closedgilgamec 创建于 2021-08-24
G
gilgameccommented
I guess I've never had occasion to use it, but I just noticed that `lerp` (in `Additive`) works the opposite way of any other lerp implementation I've seen. (A brief Googling supports this; see [C++](https://en.cppreference.com/w/cpp/numeric/lerp), [GLSL](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/mix.xhtml), [Unity](https://docs.unity3d.com/ScriptReference/Vector3.Lerp.html), [Processing](https://processing.org/reference/lerp_.html).) I'd expect that lerp t a b = a + t * (b - a); that is, that `lerp 0 a b == a` and `lerp 1 a b == b`, and that is the case in all other implementations. However, the implementation in `linear` is the opposite of this, i.e. `lerp 0 a b == b` and `lerp 1 a b == a`. Is this mismatch intentional? If so, can it be clearly documented? If not, might it be fixed? I understand that it's longstanding at this point, but maybe something can be done.
关闭于 2024-04-15 6 条评论