-
Notifications
You must be signed in to change notification settings - Fork 69
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
Consider Slerp instead of Squad for rotation interpolation #568
Comments
According to following SE answer, an alternative could be to keep the squad algorithm, but to choose better A and B 'helper quaternions' for that algorithm: |
I have added the |
@scpeters I noticed that the points and orientations given in this issue are too close to each other, and it feels like the 'shaky' movement is due to the radius of the interpolation sphere being too small. Should I add a condition to use Slerp if the final and initial points' and orientations' differences fall within a threshold and Squad if they don't? |
that sounds reasonable; go for it! |
I played around with the values a little and noted that the ‘shaky’ movement stayed even if the points were far apart. So I focused on the difference between the starting and final orientations and made changes in the code accordingly. |
I am using the gz-gui camera tracking plugin to adapt the simulation viewpoint throughout the simulation.
I noticed that motion is sometimes 'shaky' due to the rotation interpolation, e.g. :
squad.mp4
Changing this single line:
gz-math/src/RotationSpline.cc
Line 95 in 6460f7c
to use
Slerp
instead ofSquad
solves the issue:return Quaterniond::Slerp(_t, p, q, _useShortestPath);
slerp.mp4
Is it an option to change this to slerp instead of squad?
Why was squad chosen (I don't find references through 'git blame', seems it was squad from the first commit?)
It seems this is a good reference wrt rotation interpolation:
https://splines.readthedocs.io/en/latest/rotation/index.html
The text was updated successfully, but these errors were encountered: