You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling inverseRotate on EulerAngles, the procedure is as follows:
convert EulerAngles to RotationQuaternion
call inverted on RotationQuaternion
call rotate on RotationQuaternion
The question is whether rotating with the inverse (transpose) of a RotationMatrix is not the better way. Therefore, I wrote a little test attached below. The output on my machine (compiled in release mode) is:
running 1000000 rotation tests
timing angle.inverseRotate(vector)
Total time: 498 ms. Average: 0.000498 ms
timing angle.toRotationMatrix().inverted().rotate(vector)
Total time: 150 ms. Average: 0.00015 ms
average error: 3.24446e-16
max error 2.67665e-15 for pair:
euler angles: 3.03138 1.18812 -0.602041
vector to rotate: -0.678126 0.990644 -0.910583
vector inverse rotated (direct): -0.203027 -1.45571 -0.331804
vector inverse rotated (rotation matrix transpose): -0.203027 -1.45571 -0.331804
So it seems numerical precision is pretty similar but runtime is faster. So maybe we should specialize inverseRotate for EulerAngles (both Xyz and Zyx)?
When calling inverseRotate on EulerAngles, the procedure is as follows:
The question is whether rotating with the inverse (transpose) of a RotationMatrix is not the better way. Therefore, I wrote a little test attached below. The output on my machine (compiled in release mode) is:
So it seems numerical precision is pretty similar but runtime is faster. So maybe we should specialize inverseRotate for EulerAngles (both Xyz and Zyx)?
@gehrinch As discussed by phone, here the test.
The text was updated successfully, but these errors were encountered: