Need a little math help

Hi.  I'm working on the Blender exporter and I'm stuck on the following math problem.  I have spent MANY HOURS searching the Internet and searching my college math books,  and can't find the answer.



I need to duplicate a -90 degree rotation transformation that is done on a rotation matrix.  Here is my debug showing the euler and quaternion Source and Target values:  ("EULER:" and "QUAT:" are just different forms of the same value; same for "WS EULER" and "WS QUAT".  Details below.)



EULER:[-0.465659, 0.517466, 0.444048](euler)
QUAT:[0.999974, -0.004081, 0.004500, 0.003893](quaternion)
WS EULER:[-2.267587, 0.382622, -0.562424](euler)
WS QUAT:[0.999787, -0.019770, 0.003435, -0.004841](quaternion)



There is definitely an operation to do this transformatoin, because a -90-degree-rotation-only parent node causes the transformation shown from the local EULER/QUAT value to the worldspace WS EULER/WS QUAT value, but everything I try fails.

Some of the many things I have tried:
+ Multiplying the -90-degree-rotation-matrix by the first value just adds -90 degress to the euler X axis value
+ I've tried rotating just the axis element (x/y/z) of the target rotation matrix
+ I've made a unit vector out of the target rotatoin matrix and rotated that
+ I can't multiply 2 quaternions made from the -90 rot + target-rot, because my API doesn't have a quat X quat operation.

Maybe I need to back out the translation from the target rotation before doing my -90 degree rotation... somehow?

If somebody out there likes working math problems, I can provide you with the Blender source file where you can view the 2 nodes and interactively change and view the parameters and results.

I think you need inverse matrix. Code below shows what is the target transform in the source coordinate system.


 //  example uses javax.vecmath.*

   public static void main(String[] args) {
      Transform3D trm1 = new Transform3D();
      Transform3D trm2 = new Transform3D();
      trm1.setEuler(new Vector3d(-0.465659, 0.517466, 0.444048));
      trm2.setEuler(new Vector3d(-2.267587, 0.382622, -0.562424));
      
      trm1.invert();
      Transform3D transformBetween = new Transform3D();
      transformBetween.mul(trm2, trm1);
      System.out.println(transformBetween);

      trm2.rotX(-0.5 * Math.PI);
      System.out.println(trm2);
   }



The rotation is -90 about X-axis.

Thanks for the work.  I will see if I can modify it to do what I need.  What I need is an operation that will do



    [-0.465659, 0.517466, 0.444048] TO [-2.267587, 0.382622, -0.562424]    (Euler)



or



    [0.999974, -0.004081, 0.004500, 0.003893] TO [0.999787, -0.019770, 0.003435, -0.004841] (quaternion)



(which is the effect of the parent node doing some kind of -90 rotation on the specified rotation matr).



Your code is dependent on javax.media.j3d.Transform3D from Java3D also.  BTW, I can't use any Java at all in my tool, but getting the algorithm working in Java would at least be progress.