Hello! I've been working on a series of enhancements to the `scipy.spatial.transform.Rotation` module that are ready for review. I'd appreciate a look over them from anyone familiar with this area of the codebase or 3D rotations in general. * ENH: Distance between rotations and rotation equality checks https://github.com/scipy/scipy/pull/17460 * Implements `Rotation.dist()`, which calculates the smallest angular distance between two rotations. * Implements `Rotation.approx_equal()`, which calculates the distance between rotations and checks if the angle in radians is under an absolute tolerance. * ENH: Add the `__pow__` operator for Rotations https://github.com/scipy/scipy/pull/17452 * This adds the `__pow__` operator for Rotation objects. This allows them to be composed with themselves, for example: `R * R == R ** 2`. Fractional powers are also allowed. * ENH: Map the rotation quaternion double cover of rotation space to a unique single cover https://github.com/scipy/scipy/pull/17334 * Rotation quaternions form a dual cover of the rotation space, such that `q = -q` describe the same rotation. Using a `Rotation.as_quat(single_cover=True)` flag (default True), this chooses the representation with a positive `w` term. * Changes the implementation of `Rotation.inv()` so that the signs on the quaternion x, y, z terms are flipped instead of the w term. * ENH: Implement `Rotation.align_constrain()` classmethod https://github.com/scipy/scipy/pull/17542 * This implements the "align-constrain" algorithm for defining a rotation. The user passes in primary and secondary vectors in reference frames A and B. The algorithm calculates a rotation from B to A that exactly aligns the primary vectors, and then rotates about that axis to most closely align the constrained secondary vectors. * Feedback wanted on defining behavior when primary and secondary vectors are parallel. Cheers - Scott Shambaugh
Pretty cool, I'm just a beginner but also interested on the Rotation class. Will give some of my thoughts :)
I believe that these are all now in a good state for final reviews & merge. There are no dependencies between them, so can go in piecemeal. However, I do need a hand debugging a docs build error for ENH: Add the `__pow__` operator for Rotations https://github.com/scipy/scipy/pull/17452. I have not been able to figure out the error after many iterations and attempting to get a more verbose output building docs locally. Summary of changes since the first email: * ENH: Implement Rotation.align_constrain() classmethod https://github.com/scipy/scipy/pull/17542 - extended to allow aligning just primary vectors, such that the primary vectors will be aligned with no rotation about the secondary. This is also the fallback behavior for parallel primary and secondary vectors. Closes an additional issue as a result. * ENH: New Rotation methods: rotation_to(), angle_to(), approx_equal() https://github.com/scipy/scipy/pull/17460 - renamed original functions per reviewer suggestions. * ENH: Map the rotation quaternion double cover of rotation space to a unique single cover https://github.com/scipy/scipy/pull/17334 - a lot of interesting technical discussion, updated name of flag from `single_cover` to `canonical`. * ENH: Add the __pow__ operator for Rotations https://github.com/scipy/scipy/pull/17452 - added support for negative exponents, such that `R ** -2 == R.inv() ** 2`.
participants (2)
-
Evandro Bernardes -
wsshambaugh@gmail.com