Adjust rotEPS for single precision in mju_mat2Rot.

This change defines rotEPS as 1e-6f when mjUSESINGLE is defined, and 1e-9 otherwise. With the larger epsilon for single precision, the algorithm converges in fewer iterations, allowing the test assertion for maximum iterations to be simplified to a constant 150.

PiperOrigin-RevId: 959070496
Change-Id: I4f6fae056cd71955d3921c01a9929af2cdd81fac
This commit is contained in:
Alessio Quaglino
2026-08-04 09:37:44 -07:00
committed by Copybara-Service
parent b3ef7a8c2f
commit 63c7175ed5
2 changed files with 11 additions and 8 deletions
+8 -4
View File
@@ -278,12 +278,16 @@ void mju_quatZ2Vec(mjtNum quat[4], const mjtNum vec[3]) {
// extract 3D rotation from an arbitrary 3x3 matrix
#ifdef mjUSESINGLE
static const mjtNum rotEPS = 1e-6f;
#else
static const mjtNum rotEPS = 1e-9;
#endif
int mju_mat2Rot(mjtNum quat[4], const mjtNum mat[9]) {
// Müller, Matthias, Jan Bender, Nuttapong Chentanez, and Miles Macklin. "A
// robust method to extract the rotational part of deformations." In
// Proceedings of the 9th International Conference on Motion in Games, pp.
// 55-60. 2016.
// Müller, Matthias, Jan Bender, Nuttapong Chentanez, and Miles Macklin.
// "A robust method to extract the rotational part of deformations."
// In Proceedings of the 9th International Conference on Motion in Games,
// pp. 55-60. 2016.
int iter;
mjtNum col1_mat[3] = {mat[0], mat[3], mat[6]};