I am trying to figure out how a video game works.
I have the following sets of input XYZ Euler rotation angles:
{227.7864925077059, 196.6832483901486, 273.5349589526048, }
{324.1065706350902, 97.71538438062684, 194.5078890346995, }
{305.3523361919004, 40.39796136356701, 1.274452955717643, }
{267.2835474715415, 63.66771446882535, 38.23358867152928, }
{75.7640308847316, 176.2590411084323, 20.50111392559587, }
{311.7136143070773, 41.61748100222786, 338.9165929136021, }
{336.1259804071169, 103.0109561449019, 124.9513229773858, }
{315.0755333109531, 188.432264168218, 355.8580278939177, }
{4.724265266884365, 275.6663716544084, 119.5568712424085, }
I also have the following output rotation matrices:
{-0.05906248092651367, 0.9560839533805847, 0.2870804667472839, -0.6575067639350891, -0.2536481618881226, 0.7094699144363403, 0.7511301636695862, -0.1468543112277985, 0.6436126828193665, }
{0.1299711465835571, 0.03363195061683655, -0.9909472465515137, 0.7653896808624268, -0.6387360095977783, 0.07870927453041077, -0.6303064823150635, -0.7686907052993774, -0.1087589263916016, }
{0.7613730430603027, 0.01693829894065857, -0.6480927467346191, -0.5413289070129395, 0.5667028427124023, -0.6211367845535278, 0.3567550182342529, 0.8237481117248535, 0.4406414031982422, }
{0.3484266996383667, 0.2745156586170197, -0.8962365984916687, -0.6738671064376831, -0.5912572145462036, -0.4430779218673706, -0.6515381932258606, 0.7583245038986206, -0.02102267742156982, }
{-0.9346696138381958, -0.3494793176651001, -0.0652456134557724, -0.02688942849636078, 0.2524898648262024, -0.9672258496284485, 0.3544992804527283, -0.902282178401947, -0.2453919649124146, }
{0.6975497007369995, -0.2689302265644074, -0.6641542911529541, -0.2232242822647095, 0.7992085218429565, -0.5580651164054871, 0.6808782815933228, 0.5375335812568665, 0.497455894947052, }
{0.1289767026901245, -0.1845313310623169, -0.9743269681930542, -0.5236012935638428, -0.8470766544342041, 0.09111914038658142, -0.8421440124511719, 0.4984066784381867, -0.2058738470077515, }
{-0.986606240272522, 0.07144744694232941, 0.1466401517391205, 0.1544233709573746, 0.6987096071243286, 0.6985401511192322, -0.05254996567964554, 0.7118287682533264, -0.7003843784332275, }
{-0.04870510101318359, 0.08588701486587524, 0.995113730430603, -0.8264822959899902, -0.5629041194915772, 0.008131980895996094, 0.5608519315719605, -0.822047770023346, 0.09840035438537598, }
Can anyone tell at a glance which formulas were used to convert between the Euler angles and matrices? The one in Section 2.1 of the following document is close, in the sense that the results are sometimes off by 180 degrees, or are negative, but also often match up correctly.
https://www.geometrictools.com/Documentation/EulerAngles.pdf
Thanks!
[edit]
Input {0,0,0}
Output {1, 0, 0, 0, 1, 0, 0, 0, 1, }
Input {1,0,0}
Output {1, 0, 0, 0, 0.9998477101325989, 0.01745240576565266, 0, -0.01745240576565266, 0.9998477101325989, }
Input {0,1,0}
Ouput {0.9998477101325989, 0, -0.01745240576565266, 0, 1, 0, 0.01745240576565266, 0, 0.9998477101325989, }
Input {0,0,1}
Output {0.9998477101325989, 0.01745240576565266, 0, -0.01745240576565266, 0.9998477101325989, 0, 0, 0, 1, }
Input {1,1,0}
Output {0.9998477101325989, 5.820766091346741e-011, -0.01745240762829781, 0.0003045864868909121, 0.9998477101325989, 0.0174497477710247, 0.0174497477710247, -0.01745240762829781, 0.9996954202651978, }
Input {0,1,1}
Output {0.9996954202651978, 0.0174497477710247, -0.01745240762829781, -0.01745240762829781, 0.9998477101325989, 5.820766091346741e-011, 0.0174497477710247, 0.0003045864868909121, 0.9998477101325989, }
Input {1,0,1}
Output {0.9998477101325989, 0.01745240762829781, 5.820766091346741e-011, -0.0174497477710247, 0.9996954202651978, 0.01745240762829781, 0.0003045864868909121, -0.0174497477710247, 0.9998477101325989, }
I forgot to add that the z-axis points forward, the x-axis points left, and the y-axis is up. All angles are in degrees.
By looking at the 12 possible forms in Wikipedia (https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix), you see that there is an element $s_2$ or $c_2$, i.e. the sine or cosine of a single angle. You can identify it at a glance.
Then dividing all elements by $c_2$ or $s_2$ (mind the swap), you will see $s_3$ and $c_3$ appear.
This should be enough to identify the ordering of your angles and the exact matrix that is used.
Hint: the sine of the second angle appears as the third matrix element with a change of sign, so presumably $Z_1Y_2X_3$.