在 x 轴变为 -x 的两个坐标系之间转换四元数

Convert quaternions between two coordinate systems where x axis becomes -x

当x轴变为-x时如何估计新的四元数?

简而言之,当绕y旋转180-y时,我需要估计新的四元数。

如果绕 y 的角度为 30 度,绕 x=20 度,绕 z 的角度为 z = 70 度,则绕 y 的角度应为 180-30 度,因为 x 变为 -x

在四元数中: -x 中的新y 应该是(180-30)*pi/180 并且它的四元数找到如下(原来在https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles 但不同坐标系)

        a = 180-30; //180-30;

        ax = 20 * Math.PI/180;
        ay = a * Math.PI/180;
        az = 70 * Math.PI/180;

        t0 = Math.cos(ay * 0.5);  // yaw
        t1 = Math.sin(ay * 0.5);
        t2 = Math.cos(az * 0.5);  // roll
        t3 = Math.sin(az * 0.5);
        t4 = Math.cos(ax * 0.5);  // pitch
        t5 = Math.sin(ax * 0.5);

        t024 = t0 * t2 * t4;
        t025 = t0 * t2 * t5;
        t034 = t0 * t3 * t4;
        t035 = t0 * t3 * t5;
        t124 = t1 * t2 * t4;
        t125 = t1 * t2 * t5;
        t134 = t1 * t3 * t4;
        t135 = t1 * t3 * t5;

        x = t025 + t134;
        y =-t035 + t124;
        z = t034 + t125;
        w = t024 - t135;