WPF 3D: How to convert one AxisAngleRotation3D to a separate AxisAngleRotation3D?

I have a three-dimensional view that uses the TrackBall tool from WPF 3D to rotate an object with the mouse. As a result, I get one AxisAngleRotation3D with an Axis vector similar to (0.5, 0.2, 0.6) and an angle, for example. 35. This is wonderful.

What I would like to do is, as an alternative, give the user the ability to rotate the object on a separate axis (i.e. x, y, z). So, if the object rotates around the axis (0.5, 0.2, 0.6) by 35 degrees, how can I convert this into three rotations around each axis, i.e. Xangle for vector (1, 0, 0), Yangle for vector (0, 1, 0) and Zangle for vector (0, 0, 1).

I also need a way to convert them back to a single AxisAngleRotation3D object.

EDIT

I found something at http://www.gamedev.net/reference/articles/article1095.asp . One thing that I learned is that I can easily get the (combined) quaternion from separete AxisAngleRotation3D. For instance,

        private AxisAngleRotation3D _axisX = new AxisAngleRotation3D();
        private AxisAngleRotation3D _axisY = new AxisAngleRotation3D();
        private AxisAngleRotation3D _axisZ = new AxisAngleRotation3D();
...
            _axisX.Axis = new Vector3D(1, 0, 0);
            _axisY.Axis = new Vector3D(0, 1, 0);
            _axisZ.Axis = new Vector3D(0, 0, 1); 
...
            Quaternion qx = new Quaternion(_axisX.Axis, _axisX.Angle);
            Quaternion qy = new Quaternion(_axisY.Axis, _axisY.Angle);
            Quaternion qz = new Quaternion(_axisZ.Axis, _axisZ.Angle);
            Quaternion q = qx * qy * qz;

This is normal. Now the problem is, how can I do the opposite? So, for a given q, how can I find out qx, qy, qz?

+3
source share
2 answers

cuanternion to Euler corners

+1
source

, . . , , , , .

, , . .

0

Source: https://habr.com/ru/post/1765929/


All Articles