This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Rotation2D slerp computing lerp instead of slerp

Tags: None
(comma "," separated)
User avatar
alecjacobson
Registered Member
Posts
26
Karma
0
It seems (based on inspecting the code and running the following example) that Rotation2D's slerp is actually computing a lerp of the internally stored angle rather than a slerp of the implied rotation.

In this example the two rotations are by CCW by pi*0.9 and CW by pi*0.9. A half-way slerp should then be rotation by pi.

Code: Select all
#include <Eigen/Geometry>
#include <iostream>

int main(int argc, char * argv[])
{
  Eigen::Rotation2Dd a(M_PI*0.9);
  Eigen::Rotation2Dd b(-M_PI*0.9);
  std::cout<<"slerp("<<a.angle()<<","<<b.angle()<<",0.5): "<<
    a.slerp(0.5,b).angle()<<endl;
}


Instead the program above outputs:

Code: Select all
slerp(2.82743,-2.82743,0.5): 0


A more damning example happens if the angles are 0 and 2*pi. These rotations are identical so slerping between them should not change anything yet a halfway slerp using Rotation2D would give pi.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
hm, right, I guess that this Rotation2D class did not get much attention so far... Fixed in the devel branch:

https://bitbucket.org/eigen/eigen/commits/abf1f8e4b424/


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]