Skip to content

Preserve small angles in batch rotation logarithmic map - #378

Merged
AlexanderFabisch merged 1 commit into
dfki-ric:developfrom
Doribelove:codex/stable-batch-log-map
Sep 29, 2026
Merged

AlexanderFabisch merged 1 commit into
dfki-ric:developfrom
Doribelove:codex/stable-batch-log-map

Conversation

@Doribelove

Copy link
Copy Markdown

axis_angles_from_matrices currently computes the angle with arccos((trace - 1) / 2). For a rotation of 1e-8 radians, the trace rounds to 3 and the batch logarithmic map returns a zero angle and the identity axis. This loses the rotation in batch processing.

Compute the angle with atan2 using both the trace and the norm of the antisymmetric matrix part, which remains informative near zero. This addresses the batch rotation portion of #377 without changing the scalar rotation or transformation code covered by #374 and #376. The API and precomputed traces/out options remain unchanged.

The regression tests cover zero, small positive and negative angles across seeded random axes, precomputed traces, an output buffer, a single matrix, and rotations near pi. The existing near-pi test now checks the rotation matrix and angle directly: exact pi rotations can legitimately use either axis sign, and the scalar arccos path can round a near-pi angle differently.

Validation:

  • 98 passed in batch_rotations/test/test_batch_rotations.py and trajectories/test.
  • Ruff check and git diff --check passed.
  • Full suite in this environment: 3086 passed, 6 skipped, 7 failed. The same seven failures occur on an unmodified checkout of upstream develop (3084 passed, 6 skipped, 7 failed): one very tight 1e-16 rotation tolerance assertion and six tests requiring optional mesh dependencies.

Code and tests were developed with assistance from OpenAI Codex. The commit is signed off by 李永祺 doribelove@gmail.com.

Signed-off-by: 李永祺 <doribelove@gmail.com>
@AlexanderFabisch
AlexanderFabisch merged commit cedfffd into dfki-ric:develop Sep 29, 2026
@AlexanderFabisch

Copy link
Copy Markdown
Member

Thanks for the contribution @Doribelove !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants