-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
matrix2euler bug #8
Comments
huh! thanks for the report - I'll take a look now and let you know what I find :) |
Interesting, I'm not sure what the best path forward is here, I'll summarise the code path below This is the zyz extrinsic rotation matrix (intrinsic eulers are directly computed from extrinsic eulers) eulerangles/eulerangles/math/rotation_matrix_to_eulers.py Lines 199 to 204 in 97a9b70
We see that the second euler angle can be read directly from the matrix eulerangles/eulerangles/math/rotation_matrix_to_eulers.py Lines 208 to 209 in 97a9b70
If this angle is close to zero, we are in a 'gimbal lock' scenario where the first and third angles are not independent. This is true for both of your example matrices. eulerangles/eulerangles/math/rotation_matrix_to_eulers.py Lines 211 to 212 in 97a9b70
In this case, we explicitly set the third angle to zero and calculate the first angle only eulerangles/eulerangles/math/rotation_matrix_to_eulers.py Lines 214 to 221 in 97a9b70
For your first matrix, I think the problem is that with such a small difference between |
Thanks for checking! Why do you want to apply the threshold on the difference? I would rather apply on the entries in the rotation matrix itself? |
My thought was that the situation which 'breaks' the code is when the two elements passed to atan2 are very small floats on opposite sides of 0 - for different euler angle conventions and depending on whether or not we are in a gimbal lock case the two elements passed to atan2 will be different so I thought maybe checking there was a good solution A solution you can use within your own code is indeed to sanitise the elements of your rotation matrix though :) I am happy to try to implement a fix here some time next week though, this is a real issue with the package which I'm sure was not the most fun to debug 😆 |
Hey, just wanted to mention that I think I ran into this or similar too: BradyAJohnston/MolecularNodes#366 Euler angles are just the worst sometimes. I guess at some point I should start to understand quaternions.... |
Hi,
thanks for this handy package :-) We are using eulerangles 1.0.2
We discovered a problem with matrix2euler. In short: For two rotation matrices which are almost the same (except some floating point accuracy problems) the euler angles calculated by matix2euler differ quite a lot. Here the script to reproduce it:
That is the output:
The text was updated successfully, but these errors were encountered: