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
Summary: Update all FB license strings to the new format.
Reviewed By: patricklabatut
Differential Revision: D33403538
fbshipit-source-id: 97a4596c5c888f3c54f44456dc07e718a387a02c
Summary:
Make sure the functions from `rotation_conversion` are jittable, and add some type hints.
Add tests to verify this is the case.
Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/898
Reviewed By: patricklabatut
Differential Revision: D31926103
Pulled By: bottler
fbshipit-source-id: bff6013c5ca2d452e37e631bd902f0674d5ca091
Summary: Because rotations and (rotation) quaternions live on curved manifolds, it doesn't make sense to optimize them directly. Having a prominent option to require gradient on random ones may cause people to try, and isn't particularly useful.
Reviewed By: theschnitz
Differential Revision: D29160734
fbshipit-source-id: fc9e320672349fe334747c5b214655882a460a62
Summary:
As reported on github, `matrix_to_quaternion` was incorrect for rotations by 180˚. We resolved the sign of the component `i` based on the sign of `i*r`, assuming `r > 0`, which is untrue if `r == 0`.
This diff handles special cases and ensures we use the non-zero elements to copy the sign from.
Reviewed By: bottler
Differential Revision: D29149465
fbshipit-source-id: cd508cc31567fc37ea3463dd7e8c8e8d5d64a235
Summary: We can represent a rotation as a vector in the axis direction, whose length is the rotation anticlockwise in radians around that axis.
Reviewed By: gkioxari
Differential Revision: D24306293
fbshipit-source-id: 2e0f138eda8329f6cceff600a6e5f17a00e4deb7
Summary: Issue #119. The function `sqrt(max(x, 0))` is not convex and has infinite gradient at 0, but 0 is a subgradient at 0. Here we implement it in such a way as to give 0 as the gradient.
Reviewed By: gkioxari
Differential Revision: D24306294
fbshipit-source-id: 48d136faca083babad4d64970be7ea522dbe9e09
Summary: Conversion to/from the 6D representation of rotation from the paper http://arxiv.org/abs/1812.07035 ; based on David’s implementation.
Reviewed By: davnov134
Differential Revision: D22234397
fbshipit-source-id: 9e25ee93da7e3a2f2068cbe362cb5edc88649ce0
Summary: The shebang line `#!<path to interpreter>` is only required for Python scripts, so remove it on source files for class or function definitions. Additionally explicitly mark as executable the actual Python scripts in the codebase.
Reviewed By: nikhilaravi
Differential Revision: D20095778
fbshipit-source-id: d312599fba485e978a243292f88a180d71e1b55a
Summary:
Lint related fixes: Improve internal/OSS consistency. Fix the fight between black and certain pyre-ignore markers by moving them to the line before.
Use clang-format-8 automatically if present. Small number of pyre fixes.
arc doesn't run pyre at the moment, so I put back the explicit call to pyre. I don't know if there's an option somewhere to change this.
Reviewed By: nikhilaravi
Differential Revision: D19780518
fbshipit-source-id: ef1c243392322fa074130f6cff2dd8a6f7738a7f
Summary: Fixed the rotation matrices generated by the RotateAxisAngle class and updated the tests. Added documentation for Transforms3d to clarify the conventions.
Reviewed By: gkioxari
Differential Revision: D19912903
fbshipit-source-id: c64926ce4e1381b145811557c32b73663d6d92d1