mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-01 03:12:49 +08:00
Summary: This is an extension of https://github.com/facebookresearch/pytorch3d/issues/1544 with various speed, stability, and readability improvements. (I could not find a way to make a commit to the existing PR). This PR is still based on the [Rodrigues' rotation formula](https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Rotation_matrix_%E2%86%94_Euler_axis/angle). The motivation is the same; this change speeds up the conversions up to 10x, depending on the device, batch size, etc. ### Notes - As the angles get very close to `π`, the existing implementation and the proposed one start to differ. However, (my understanding is that) this is not a problem as the axis can not be stably inferred from the rotation matrix in this case in general. - bottler , I tried to follow similar conventions as existing functions to deal with weird angles, let me know if something needs to be changed to merge this. Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1948 Reviewed By: MichaelRamamonjisoa Differential Revision: D69193009 Pulled By: bottler fbshipit-source-id: e5ed34b45b625114ec4419bb89e22a6aefad4eeb