If my calculations are correct (see the attached file), the roll angle expression for pitch=-90° should be:
r = +2.0 * atan2(quat[0],quat[3]);
instead in Rotation::getYawPitchRoll(double& y, double& p, double& r) , (see https://github.com/FreeCAD/FreeCAD/blob ... tation.cpp)
there is:
Code: Select all
else if (fabs(qd2+1.0) < DBL_EPSILON) {
// south pole
y = 0.0;
p = -D_PI/2.0;
r = -2.0 * atan2(quat[0],quat[3]);
}
In the case of pitch=+90° the result of my calculations coincides with the expression in the Rotation::getYawPitchRoll(...) code.
what do you think about it?
Thanks for your attention.
P.S. the rotation implemented in the FC code is the intrinsic rotation zy'x'' (or equivalently the extrinsic rotation XYZ), however, both in the Placement window and in the comment in the Rotation::setYawPitchRoll(...) code there is "Euler angles xy'z'' ". The correct string should be zy'x'' or equivalently XYZ.