matvis.coordinates.vecs2rot

matvis.coordinates.vecs2rot(r1, r2)[source]

Construct an axis-angle rotation matrix R that carries vector r1 to r2.

This function has been adopted from pyradiosky.

Parameters:
  • r1 (ndarray, shape (3, N)) – Sets of 3D vectors.

  • r2 (ndarray, shape (3, N)) – Sets of 3D vectors.

Returns:

R – Rotation matrices such that R[…, i] @ r1[:, i] = r2[:, i].

Return type:

ndarray, shape (3, 3, N)