-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add linear interpolation (LERP) for quats #852
Conversation
Introducing Quaternion LERP as there is SLERP already. No need for NLERP since its just LERP result normalized. Haven't done e2helper desc yet.
what is LERP needed for? |
If I understand it correctly, slerp speeds up, reaches a max speed, and then slows down again. Lerp, on the other hand, rotates/moves stuff at a constant speed. Could be wrong tho |
slerp is spherical linear interpolation. it's linear on a sphere. But I was asking @Kamilczak020 :) |
but I've used slerp in gmod many times and it does speed up, and then slow down, if provided with a constant multiplier. You have to use an equation to change the multiplier a lot to get it to be the same speed throughout the whole rotation. So therefore I just assumed that lerp must be constant speed, otherwise it wouldn't make much sense to have both |
From wikipedia
|
In that case, slerp is implemented incorrectly. |
then it should be fixed. ...so the question still stands: what is LERP used for? |
http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/ This is a good article that gives more info about slerp and similar. (Formatting's a bit broken though.) |
that article lists slerp, nlerp and log-quaternion lerp. nlerp is noted mostly for its performance where constant velocity is not important. It seems commutative here means that you can stack the NLERPs and LQLERPs (but not SLERPs) in whatever order you want |
In conclusion, let's have slerp, nlerp and lqlerp functions and let's a have a table on the wiki comparing the three. Having lerp might cause people to use that and wonder why those stupid useless quaternions are broken and useless |
Merge? |
This needs an E2Helper description, and I won't be home tonight. Happy for this to be merged if somebody can immediately follow it up with adding the description. |
(If anybody's curious about the implementation, I was looking up a reference implementation and ended up here, where the code seems to have been translated from.) |
I should read up on quats one day. |
Introducing Quaternion LERP as there is SLERP already. No need for NLERP since its just LERP result normalized. Haven't done e2helper desc yet.