rigid_body_motion.shortest_arc_rotation

rigid_body_motion.shortest_arc_rotation(v1, v2, dim=None, axis=None)[source]

Estimate the shortest-arc rotation between two arrays of vectors.

This method computes the rotation r that satisfies:

\[v_2 / ||v_2|| = rot(r, v_1) / ||v_1||\]
Parameters
v1: array_like, shape (…, 3, …)

The first array of vectors.

v2: array_like, shape (…, 3, …)

The second array of vectors.

dim: str, optional

If the first array is a DataArray, the name of the dimension representing the spatial coordinates of the vectors.

axis: int, optional

The axis of the arrays representing the spatial coordinates of the vectors. Defaults to the last axis of the arrays.

Returns
rotation: array_like, shape (…, 4, …)

The quaternion representation of the shortest-arc rotation.