gaitmap.utils.rotations.find_unsigned_3d_angle#

gaitmap.utils.rotations.find_unsigned_3d_angle(v1: ndarray, v2: ndarray) ndarray | float[source]#

Find the angle (in rad) between two 3D vectors.

Parameters:
v1vector with shape (3,) or array of vectors

axis ([x, y ,z]) or array of axis

v2vector with shape (3,) or array of vectors

axis ([x, y ,z]) or array of axis

Returns:
angle or array of angles between two vectors

Examples

two vectors: 1D

>>> find_unsigned_3d_angle(np.array([-1, 0, 0]), np.array([-1, 0, 0]))
0

two vectors: 2D

>>> find_unsigned_3d_angle(np.array([[-1, 0, 0], [-1, 0, 0]]), np.array([[-1, 0, 0], [-1, 0, 0]]))
array([0,0])