Different results when using Matrix4f.getRotation(AxisAngle4f dest)

Started by huuuubbbb, March 26, 2025, 13:06:31

Previous topic - Next topic

huuuubbbb

When running this code
Matrix4f m = new Matrix4f();
Quaternionf q = new Quaternionf(0.0f, 0.965f, 0.2622f, 0.0f);
m.rotate(q);
AxisAngle4f a = new AxisAngle4f();
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);

i get these results
( 0.000E+0  9.650E-1  2.530E-1 <|  3.142E+0)
( 0.000E+0  9.650E-1  1.000E+0 <|  3.142E+0)
( 0.000E+0  9.650E-1  2.530E-1 <|  3.142E+0)
( 0.000E+0  9.650E-1  1.000E+0 <|  3.142E+0)

This is an edge case where the rotation is around 180 degrees. But why does the result change if the DESTINATION variable has some values in it. Shouldnt the values just be overwritten? I dont understand this behavior. Is this a possible bug? Please explain it :P