Check out the Hyperspy Workshop May 13-17, 2024 Online

get_rotation_matrix_between_vectors#

pyxem.utils.vectors.get_rotation_matrix_between_vectors(from_v1, from_v2, to_v1, to_v2)[source]#

Calculates the rotation matrix from one pair of vectors to the other. Handles multiple to-vectors from a single from-vector.

Find R such that v_to = R @ v_from.

Parameters:
  • from_v1, from_v2 (numpy.ndarray) – Vector to rotate _from_.

  • to_v1, to_v2 (numpy.ndarray) – Nx3 array of vectors to rotate _to_.

Returns:

R – Nx3x3 list of rotation matrices between the vector pairs.

Return type:

numpy.ndarray