rotaxi2mat#

torchspin.rotaxi2mat(n, rho)[source]#

Rotation matrix from an axis and angle (Rodrigues formula).

Parameters:
  • n (str or array_like, shape (3,)) – Rotation axis. Accepts string shortcuts 'x', 'y', 'z', 'xy', 'xz', 'yz', 'xyz'. Does not need to be normalized.

  • rho (float) – Rotation angle in radians.

Returns:

R (ndarray, shape (3, 3)) – Rotation matrix. Apply as v_rot = R.T @ v (passive convention).

Return type:

ndarray

Notes

Uses the Rodrigues formula: R = I + N·sin(ρ) + N²·(1−cos(ρ)), where N is the skew-symmetric cross-product matrix.