So I’ve been spending a few hours a day trying to understand linear interpolation. My understanding of the concept has improved, as I didn’t understand the math behind it previously. I decided to get graph paper so I could understand it a better, and Jamie King and bunch of other guys have some hands on demonstration about how it works which was handy.
The demonstration gave me a clue as to how linear interpolation works, so I decided to give it a shot. I wrote a new Vector2f method like so.
[quote] public Vector2f lerpT(Vector2f currentPos, Vector2f newPos, float alpha)
return currentPos.scale(1f - alpha).add(newPos.scale(alpha));
//return Vector3f point1 + alpha * (point2 - point1);
And my main class is like so:
This is what gets printed out into the console.
I calculated the formula from a graph I made and with a calculator and I get the same values in the x and y’s lerpPos vector that is calculated in the code. I also changed it to Vector2f to make it simpler. And instead of LWJGL I decided to make a simple console program in java.
While I understand it a bit more, I’m unsure how I’m supposed to use a velocity vector with the lerp function so I can give something some acceleration(?). I see how the alpha in the formula is important, but I’m unsure how to utilize it.
If anything, I’d like to tryout some easing in and easing out, but the witchcraft needed seems a little bit over my head just at this moment.
Any help or suggestions would be much appreciated.