align_vectors#

align_vectors(base, target=(0, 0, 1))[source]#

Compute the rotation matrix or Euler angles required to align an initial vector with a target vector. As align_vectors(base, target) @ base = target

Parameters:
baseNDArray

The basis vector. Can be shape (d,) or (n, d).

targetNDArray, optional

The vector to map base to. Can be shape (d,) or (n, d). Default is (0,0,1).

Returns:
NDArray

Rotation matrix mapping base to target.