Euler Angles not Angle reversible, documentation example lacking, possible gimble lock issue resolveable
Submitted by joh..@..il.com
Assigned to Nobody
Link to original bugzilla bug (#609)
Version: 3.2
Description
In testing the Eigen/EulerAngles implementation I have shown that I create a matrix and go
Matrix > Angles > Matrix
but I cannot successfully go
Angles > Matrix > Angles for any matrix other than the identity matrix.
Example code
// Hand-Craft, ANG > MAT > ANG
// first quad
inputAngles << 0, 0, M_PI/4;
outputMatrix.block<3,3>(0, 0) = (Eigen::AngleAxisf(inputAngles[0], Eigen::Vector3f::UnitZ())
* Eigen::AngleAxisf(inputAngles[1], Eigen::Vector3f::UnitX())
* Eigen::AngleAxisf(inputAngles[2], Eigen::Vector3f::UnitZ())).toRotationMatrix();
outputAngles = inputMat.block<3,3>(0,0).eulerAngles(2, 0, 2); // follows Z-X-Z
with output
inputAngles == [0.78539819, 0.78539819, 0.78539819]
pi/4, pi/4, pi/4
outputAngles == [-2.3561945, -0.78539824, -2.3561945]
-3pi/4, -pi/4, -3pi/4
See this thread for more (http://forum.kde.org/viewtopic.php?f=74&t=111436&p=266230#p266230)
Obviously Euler angles have lots of different conventions -- if the Eigen documentation gave a very thorough walk through for one convention it would be very helpful. Also what the expected domain/range of the three euler angles is would be handy without having to dig through the source code.
Finally it is posited here (https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2012/07/euler-angles.pdf) that according to the Graphics Gems IV method (which, according to the Eigen source code is in use) it is possible to avoid floating point instability by slightly modifying the generation method of the third coefficient