Equivalent rotations of a set of rotations.

Dear All,

Are there some site that I can convert the following set of rotations, of a 3D picture, i.e.

Rot Axe Y → Rot Axe X → Rot Axe Z → Rot Axe X → Rot Axe Y (or any other set of rotations)

in

Rot Axe X → Rot Axe Y → Rot Axe Z (in any sequence)

I have the intuition that can be done through matrices manipulation. But perhaps there are available some site that can input the angles and get the output angles. Or some script already done. Or some Matlab instruction. In last case you can give me the theoretical concerning that.

Thanks,

Luís Gonçalves

You can go to wolfram.com and seach for EulerAngles, RawPitchYawAngles, etc.

Hello,

You can multiply all your input rotations in their order to obtain a singe matrix called R and then do this:

#include <cmath>

double yaw   = std::atan2(R(1,0), R(0,0));
double pitch = std::atan2(-R(2,0), std::sqrt( R(2,1)*R(2,1) + R(2,2)*R(2,2))));
double roll  = std::atan2(R(2,1), R(2,2));

Notice that we named the angles yaw, pitch and roll since whether they actually correspond to rotY, rotX and rotZ depends on your axes conventions (e.g. X is the first axis, right- or left handed, etc.).

Source: Determining yaw, pitch, and roll from a rotation matrix

However, the solution above can exhibit numerical instability whereas the header-olny library Eigen’s implementation (Eigen: Main Page) is gimbal-lock-proof:

   #include <Eigen/Geometry>

   (...)

   Matrix3f R = ...; //multiply all your input rotations here.

   Vector3f angles = R.eulerAngles(2, 1, 0).reverse();

Refer to the documentation of eulerAngeles() here: Eigen: Geometry module

take care,

Paulo